Add new client hooks

This commit is contained in:
Chocobozzz
2019-07-22 15:38:26 +02:00
parent 5336129c36
commit 954b9c5fbc
3 changed files with 111 additions and 1 deletions

View File

@ -3,6 +3,38 @@ function register ({ registerHook, peertubeHelpers }) {
target: 'action:video-watch.init',
handler: () => console.log('Hello video watch world')
})
registerHook({
target: 'action:video-watch.video.loaded',
handler: () => 'video loaded'
})
registerHook({
target: 'filter:api.video-watch.video.get.result',
handler: video => {
video.name += ' \o/'
return video
}
})
registerHook({
target: 'filter:api.video-watch.video-threads.list.result',
handler: result => {
result.comments.forEach(c => c.text += ' THREAD')
return result
}
})
registerHook({
target: 'filter:api.video-watch.video-thread-replies.list.result',
handler: result => {
result.children.forEach(c => c.comment.text += ' REPLY DEEP 1')
return result
}
})
}
export {