aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-24 10:21:22 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-07-24 10:58:16 +0200
commit5f189c9c85449951254646ddf6cd6c84bc4c06ff (patch)
tree15a1abee0594be92cc08c86edc544da132ba27d8 /shared
parent51326912d61b05a33dd9cf3ca9befa6e2715b346 (diff)
downloadPeerTube-5f189c9c85449951254646ddf6cd6c84bc4c06ff.tar.gz
PeerTube-5f189c9c85449951254646ddf6cd6c84bc4c06ff.tar.zst
PeerTube-5f189c9c85449951254646ddf6cd6c84bc4c06ff.zip
Add hooks documentation
Diffstat (limited to 'shared')
-rw-r--r--shared/models/plugins/client-hook.model.ts13
-rw-r--r--shared/models/plugins/server-hook.model.ts22
2 files changed, 35 insertions, 0 deletions
diff --git a/shared/models/plugins/client-hook.model.ts b/shared/models/plugins/client-hook.model.ts
index bf444fe5a..87e8092c0 100644
--- a/shared/models/plugins/client-hook.model.ts
+++ b/shared/models/plugins/client-hook.model.ts
@@ -1,29 +1,38 @@
1// Data from API hooks: {hookType}:api.{location}.{elementType}.{actionType}.{target} 1// Data from API hooks: {hookType}:api.{location}.{elementType}.{actionType}.{target}
2 2
3export const clientFilterHookObject = { 3export const clientFilterHookObject = {
4 // Filter params/result of the function that fetch videos of the trending page
4 'filter:api.trending-videos.videos.list.params': true, 5 'filter:api.trending-videos.videos.list.params': true,
5 'filter:api.trending-videos.videos.list.result': true, 6 'filter:api.trending-videos.videos.list.result': true,
6 7
8 // Filter params/result of the function that fetch videos of the local page
7 'filter:api.local-videos.videos.list.params': true, 9 'filter:api.local-videos.videos.list.params': true,
8 'filter:api.local-videos.videos.list.result': true, 10 'filter:api.local-videos.videos.list.result': true,
9 11
12 // Filter params/result of the function that fetch videos of the recently-added page
10 'filter:api.recently-added-videos.videos.list.params': true, 13 'filter:api.recently-added-videos.videos.list.params': true,
11 'filter:api.recently-added-videos.videos.list.result': true, 14 'filter:api.recently-added-videos.videos.list.result': true,
12 15
16 // Filter params/result of the function that fetch videos of the user subscription page
13 'filter:api.user-subscriptions-videos.videos.list.params': true, 17 'filter:api.user-subscriptions-videos.videos.list.params': true,
14 'filter:api.user-subscriptions-videos.videos.list.result': true, 18 'filter:api.user-subscriptions-videos.videos.list.result': true,
15 19
20 // Filter params/result of the function that fetch the video of the video-watch page
16 'filter:api.video-watch.video.get.params': true, 21 'filter:api.video-watch.video.get.params': true,
17 'filter:api.video-watch.video.get.result': true, 22 'filter:api.video-watch.video.get.result': true,
18 23
24 // Filter params/result of the function that fetch the threads of the video-watch page
19 'filter:api.video-watch.video-threads.list.params': true, 25 'filter:api.video-watch.video-threads.list.params': true,
20 'filter:api.video-watch.video-threads.list.result': true, 26 'filter:api.video-watch.video-threads.list.result': true,
21 27
28 // Filter params/result of the function that fetch the replies of a thread in the video-watch page
22 'filter:api.video-watch.video-thread-replies.list.params': true, 29 'filter:api.video-watch.video-thread-replies.list.params': true,
23 'filter:api.video-watch.video-thread-replies.list.result': true, 30 'filter:api.video-watch.video-thread-replies.list.result': true,
24 31
32 // Filter params/result of the function that fetch videos according to the user search
25 'filter:api.search.videos.list.params': true, 33 'filter:api.search.videos.list.params': true,
26 'filter:api.search.videos.list.result': true, 34 'filter:api.search.videos.list.result': true,
35 // Filter params/result of the function that fetch video-channels according to the user search
27 'filter:api.search.video-channels.list.params': true, 36 'filter:api.search.video-channels.list.params': true,
28 'filter:api.search.video-channels.list.result': true 37 'filter:api.search.video-channels.list.result': true
29} 38}
@@ -31,11 +40,15 @@ export const clientFilterHookObject = {
31export type ClientFilterHookName = keyof typeof clientFilterHookObject 40export type ClientFilterHookName = keyof typeof clientFilterHookObject
32 41
33export const clientActionHookObject = { 42export const clientActionHookObject = {
43 // Fired when the application is being initialized
34 'action:application.init': true, 44 'action:application.init': true,
35 45
46 // Fired when the video watch page is being initialized
36 'action:video-watch.init': true, 47 'action:video-watch.init': true,
48 // Fired when the video watch page loaded the video
37 'action:video-watch.video.loaded': true, 49 'action:video-watch.video.loaded': true,
38 50
51 // Fired when the search page is being initialized
39 'action:search.init': true 52 'action:search.init': true
40} 53}
41 54
diff --git a/shared/models/plugins/server-hook.model.ts b/shared/models/plugins/server-hook.model.ts
index fc4c51160..32c7f4688 100644
--- a/shared/models/plugins/server-hook.model.ts
+++ b/shared/models/plugins/server-hook.model.ts
@@ -1,35 +1,57 @@
1// {hookType}:{api?}.{location}.{subLocation?}.{actionType}.{target} 1// {hookType}:{api?}.{location}.{subLocation?}.{actionType}.{target}
2 2
3export const serverFilterHookObject = { 3export const serverFilterHookObject = {
4 // Filter params/result used to list videos for the REST API
5 // (used by the trending page, recently-added page, local page etc)
4 'filter:api.videos.list.params': true, 6 'filter:api.videos.list.params': true,
5 'filter:api.videos.list.result': true, 7 'filter:api.videos.list.result': true,
8 // Filter the result of the get function
9 // Used to get detailed video information (video watch page for example)
6 'filter:api.video.get.result': true, 10 'filter:api.video.get.result': true,
7 11
12 // Filter the result of the accept upload function
13 // If this function returns false then the upload is aborted with an error
8 'filter:api.video.upload.accept.result': true, 14 'filter:api.video.upload.accept.result': true,
15 // Filter the result of the accept comment (thread or reply) functions
16 // If the functions return false then the user cannot post its comment
9 'filter:api.video-thread.create.accept.result': true, 17 'filter:api.video-thread.create.accept.result': true,
10 'filter:api.video-comment-reply.create.accept.result': true, 18 'filter:api.video-comment-reply.create.accept.result': true,
11 19
20 // Filter params/result used to list threads of a specific video
21 // (used by the video watch page)
12 'filter:api.video-threads.list.params': true, 22 'filter:api.video-threads.list.params': true,
13 'filter:api.video-threads.list.result': true, 23 'filter:api.video-threads.list.result': true,
14 24
25 // Filter params/result used to list replies of a specific thread
26 // (used by the video watch page when we click on the "View replies" button)
15 'filter:api.video-thread-comments.list.params': true, 27 'filter:api.video-thread-comments.list.params': true,
16 'filter:api.video-thread-comments.list.result': true, 28 'filter:api.video-thread-comments.list.result': true,
17 29
30 // Filter result used to check if we need to auto blacklist a video
31 // (fired when a local or remote video is created or updated)
18 'filter:video.auto-blacklist.result': true 32 'filter:video.auto-blacklist.result': true
19} 33}
20 34
21export type ServerFilterHookName = keyof typeof serverFilterHookObject 35export type ServerFilterHookName = keyof typeof serverFilterHookObject
22 36
23export const serverActionHookObject = { 37export const serverActionHookObject = {
38 // Fired when the application has been loaded and is listening HTTP requests
24 'action:application.listening': true, 39 'action:application.listening': true,
25 40
41 // Fired when a local video is updated
26 'action:api.video.updated': true, 42 'action:api.video.updated': true,
43 // Fired when a local video is deleted
27 'action:api.video.deleted': true, 44 'action:api.video.deleted': true,
45 // Fired when a local video is uploaded
28 'action:api.video.uploaded': true, 46 'action:api.video.uploaded': true,
47 // Fired when a local video is viewed
29 'action:api.video.viewed': true, 48 'action:api.video.viewed': true,
30 49
50 // Fired when a thread is created
31 'action:api.video-thread.created': true, 51 'action:api.video-thread.created': true,
52 // Fired when a reply to a thread is created
32 'action:api.video-comment-reply.created': true, 53 'action:api.video-comment-reply.created': true,
54 // Fired when a comment (thread or reply) is deleted
33 'action:api.video-comment.deleted': true 55 'action:api.video-comment.deleted': true
34} 56}
35 57