Add missing hooks to hello world plugin

This commit is contained in:
Chocobozzz 2019-12-05 17:08:33 +01:00
parent cb8a9c1b0e
commit 115c234a6d
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 24 additions and 1 deletions

View File

@ -35,6 +35,16 @@ function register ({ registerHook, peertubeHelpers }) {
return result
}
})
registerHook({
target: 'filter:internal.video-watch.player.build-options.result',
handler: (result, params) => {
console.log('Running player build options hook for video %s.', params.video.name)
result.playerOptions.common.inactivityTimeout = 10000
return result
}
})
}
export {

View File

@ -19,6 +19,19 @@ async function register ({
handler: () => console.log('fake hook')
})
registerHook({
target: 'filter:api.user.signup.allowed.result',
handler: (result, params) => {
if (result.allowed === false) return result
if (params && params.body.email.includes('laposte.net')) {
return { allowed: false, errorMessage: 'laposte.net emails are not allowed on this instance' }
}
return result
}
})
registerSetting({
name: 'admin-name',
label: 'Admin name',

View File

@ -1,6 +1,6 @@
{
"name": "peertube-plugin-hello-world",
"version": "0.0.13",
"version": "0.0.14",
"description": "Hello world PeerTube plugin example",
"engine": {
"peertube": ">=1.3.0"