Add more hooks

This commit is contained in:
Chocobozzz 2022-08-03 10:39:31 +02:00
parent 0faf0330a2
commit 9e515b7230
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 55 additions and 1 deletions

View File

@ -0,0 +1,41 @@
function register ({ registerHook, peertubeHelpers }) {
for (const hook of [
'action:video-channel-create.init',
'action:video-channel-update.init',
'action:video-channel-videos.init',
'action:video-channel-playlists.init'
]) {
registerHook({
target: hook,
handler: () => console.log('Hello world', hook)
})
}
registerHook({
target: 'action:video-channel-update.video-channel.loaded',
handler: ({ videoChannel }) => console.log('Channel loaded', { videoChannel })
})
registerHook({
target: 'action:video-channel-playlists.video-channel.loaded',
handler: ({ videoChannel }) => console.log('Channel loaded', { videoChannel })
})
registerHook({
target: 'action:video-channel-playlists.playlists.loaded',
handler: ({ playlists }) => console.log('Playlists loaded', { playlists })
})
registerHook({
target: 'action:video-channel-videos.video-channel.loaded',
handler: ({ videoChannel }) => console.log('Channel loaded', { videoChannel })
})
registerHook({
target: 'action:video-channel-videos.videos.loaded',
handler: ({ videos }) => console.log('Videos loaded', { videos })
})
}
export {
register
}

View File

@ -71,6 +71,13 @@ function register ({ registerHook, peertubeHelpers }) {
}
})
registerHook({
target: 'action:video-watch.video-threads.loaded',
handler: () => {
console.log('Comments found.', document.querySelectorAll('.comment'));
}
})
for (const hook of [
'filter:api.video-watch.video-playlist-elements.get.result'
]) {

View File

@ -1,6 +1,6 @@
{
"name": "peertube-plugin-hello-world",
"version": "0.0.19",
"version": "0.0.20",
"description": "Hello world PeerTube plugin example",
"engine": {
"peertube": ">=3.2.0"
@ -68,6 +68,12 @@
"scopes": [
"admin-plugin"
]
},
{
"script": "client/video-channel-client-plugin.js",
"scopes": [
"video-channel"
]
}
],
"translations": {