]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - shared/models/plugins/server-hook.model.ts
Use dedicated hooks for account/channel videos
[github/Chocobozzz/PeerTube.git] / shared / models / plugins / server-hook.model.ts
... / ...
CommitLineData
1// {hookType}:{api?}.{location}.{subLocation?}.{actionType}.{target}
2
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)
6 'filter:api.videos.list.params': true,
7 'filter:api.videos.list.result': true,
8
9 // Filter params/result used to list account videos for the REST API
10 'filter:api.accounts.videos.list.params': true,
11 'filter:api.accounts.videos.list.result': true,
12
13 // Filter params/result used to list account videos for the REST API
14 'filter:api.video-channels.videos.list.params': true,
15 'filter:api.video-channels.videos.list.result': true,
16
17 // Filter the result of the get function
18 // Used to get detailed video information (video watch page for example)
19 'filter:api.video.get.result': true,
20
21 // Filter the result of the accept upload/live, import via torrent/url functions
22 // If this function returns false then the upload is aborted with an error
23 'filter:api.video.upload.accept.result': true,
24 'filter:api.live-video.create.accept.result': true,
25 'filter:api.video.pre-import-url.accept.result': true,
26 'filter:api.video.pre-import-torrent.accept.result': true,
27 'filter:api.video.post-import-url.accept.result': true,
28 'filter:api.video.post-import-torrent.accept.result': true,
29 // Filter the result of the accept comment (thread or reply) functions
30 // If the functions return false then the user cannot post its comment
31 'filter:api.video-thread.create.accept.result': true,
32 'filter:api.video-comment-reply.create.accept.result': true,
33
34 // Filter params/result used to list threads of a specific video
35 // (used by the video watch page)
36 'filter:api.video-threads.list.params': true,
37 'filter:api.video-threads.list.result': true,
38
39 // Filter params/result used to list replies of a specific thread
40 // (used by the video watch page when we click on the "View replies" button)
41 'filter:api.video-thread-comments.list.params': true,
42 'filter:api.video-thread-comments.list.result': true,
43
44 // Filter result used to check if we need to auto blacklist a video
45 // (fired when a local or remote video is created or updated)
46 'filter:video.auto-blacklist.result': true,
47
48 // Filter result used to check if a user can register on the instance
49 'filter:api.user.signup.allowed.result': true
50}
51
52export type ServerFilterHookName = keyof typeof serverFilterHookObject
53
54export const serverActionHookObject = {
55 // Fired when the application has been loaded and is listening HTTP requests
56 'action:application.listening': true,
57
58 // Fired when a local video is updated
59 'action:api.video.updated': true,
60 // Fired when a local video is deleted
61 'action:api.video.deleted': true,
62 // Fired when a local video is uploaded
63 'action:api.video.uploaded': true,
64 // Fired when a local video is viewed
65 'action:api.video.viewed': true,
66
67 // Fired when a live video is created
68 'action:api.live-video.created': true,
69
70 // Fired when a thread is created
71 'action:api.video-thread.created': true,
72 // Fired when a reply to a thread is created
73 'action:api.video-comment-reply.created': true,
74 // Fired when a comment (thread or reply) is deleted
75 'action:api.video-comment.deleted': true,
76
77 // Fired when a user is blocked (banned)
78 'action:api.user.blocked': true,
79 // Fired when a user is unblocked (unbanned)
80 'action:api.user.unblocked': true,
81 // Fired when a user registered on the instance
82 'action:api.user.registered': true,
83 // Fired when an admin/moderator created a user
84 'action:api.user.created': true,
85 // Fired when a user is removed by an admin/moderator
86 'action:api.user.deleted': true,
87 // Fired when a user is updated by an admin/moderator
88 'action:api.user.updated': true,
89
90 // Fired when a user got a new oauth2 token
91 'action:api.user.oauth2-got-token': true
92}
93
94export type ServerActionHookName = keyof typeof serverActionHookObject
95
96export const serverHookObject = Object.assign({}, serverFilterHookObject, serverActionHookObject)
97export type ServerHookName = keyof typeof serverHookObject
98
99export interface ServerHook {
100 runHook <T> (hookName: ServerHookName, result?: T, params?: any): Promise<T>
101}