PeerTube/server/tests/fixtures/peertube-plugin-test-four/main.js

40 lines
802 B
JavaScript
Raw Normal View History

2020-04-09 04:00:30 -05:00
async function register ({
peertubeHelpers,
registerHook
2020-04-09 04:00:30 -05:00
}) {
const logger = peertubeHelpers.logger
logger.info('Hello world from plugin four')
2020-04-09 04:00:30 -05:00
const username = 'root'
const results = await peertubeHelpers.database.query(
'SELECT "email" from "user" WHERE "username" = $username',
{
type: 'SELECT',
bind: { username }
}
)
logger.info('root email is ' + results[0]['email'])
registerHook({
target: 'action:api.video.viewed',
handler: async ({ video }) => {
await peertubeHelpers.videos.removeVideo(video.id)
logger.info('Video deleted by plugin four.')
}
})
2020-04-09 04:00:30 -05:00
}
async function unregister () {
return
}
module.exports = {
register,
unregister
}
// ###########################################################################