]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - shared/models/plugins/server/server-hook.model.ts
Add video caption created and deleted hooks
[github/Chocobozzz/PeerTube.git] / shared / models / plugins / server / server-hook.model.ts
1 // {hookType}:{api?}.{location}.{subLocation?}.{actionType}.{target}
2
3 export 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 channel 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 params/result used to list my user videos for the REST API
18 'filter:api.user.me.videos.list.params': true,
19 'filter:api.user.me.videos.list.result': true,
20
21 // Filter params/result used to list overview videos for the REST API
22 'filter:api.overviews.videos.list.params': true,
23 'filter:api.overviews.videos.list.result': true,
24
25 // Filter params/results to search videos/channels in the DB or on the remote index
26 'filter:api.search.videos.local.list.params': true,
27 'filter:api.search.videos.local.list.result': true,
28 'filter:api.search.videos.index.list.params': true,
29 'filter:api.search.videos.index.list.result': true,
30 'filter:api.search.video-channels.local.list.params': true,
31 'filter:api.search.video-channels.local.list.result': true,
32 'filter:api.search.video-channels.index.list.params': true,
33 'filter:api.search.video-channels.index.list.result': true,
34 'filter:api.search.video-playlists.local.list.params': true,
35 'filter:api.search.video-playlists.local.list.result': true,
36 'filter:api.search.video-playlists.index.list.params': true,
37 'filter:api.search.video-playlists.index.list.result': true,
38
39 // Filter the result of the get function
40 // Used to get detailed video information (video watch page for example)
41 'filter:api.video.get.result': true,
42
43 // Filter the result of the accept upload/live, import via torrent/url functions
44 // If this function returns false then the upload is aborted with an error
45 'filter:api.video.upload.accept.result': true,
46 'filter:api.live-video.create.accept.result': true,
47 'filter:api.video.pre-import-url.accept.result': true,
48 'filter:api.video.pre-import-torrent.accept.result': true,
49 'filter:api.video.post-import-url.accept.result': true,
50 'filter:api.video.post-import-torrent.accept.result': true,
51 // Filter the result of the accept comment (thread or reply) functions
52 // If the functions return false then the user cannot post its comment
53 'filter:api.video-thread.create.accept.result': true,
54 'filter:api.video-comment-reply.create.accept.result': true,
55
56 // Filter attributes when creating video object
57 'filter:api.video.upload.video-attribute.result': true,
58 'filter:api.video.import-url.video-attribute.result': true,
59 'filter:api.video.import-torrent.video-attribute.result': true,
60 'filter:api.video.live.video-attribute.result': true,
61
62 // Filter params/result used to list threads of a specific video
63 // (used by the video watch page)
64 'filter:api.video-threads.list.params': true,
65 'filter:api.video-threads.list.result': true,
66
67 // Filter params/result used to list replies of a specific thread
68 // (used by the video watch page when we click on the "View replies" button)
69 'filter:api.video-thread-comments.list.params': true,
70 'filter:api.video-thread-comments.list.result': true,
71
72 // Filter get stats result
73 'filter:api.server.stats.get.result': true,
74
75 // Filter result used to check if we need to auto blacklist a video
76 // (fired when a local or remote video is created or updated)
77 'filter:video.auto-blacklist.result': true,
78
79 // Filter result used to check if a user can register on the instance
80 'filter:api.user.signup.allowed.result': true,
81
82 // Filter result used to check if video/torrent download is allowed
83 'filter:api.download.video.allowed.result': true,
84 'filter:api.download.torrent.allowed.result': true,
85
86 // Filter result to check if the embed is allowed for a particular request
87 'filter:html.embed.video.allowed.result': true,
88 'filter:html.embed.video-playlist.allowed.result': true
89 }
90
91 export type ServerFilterHookName = keyof typeof serverFilterHookObject
92
93 export const serverActionHookObject = {
94 // Fired when the application has been loaded and is listening HTTP requests
95 'action:application.listening': true,
96
97 // API actions hooks give access to the original express `req` and `res` parameters
98
99 // Fired when a local video is updated
100 'action:api.video.updated': true,
101 // Fired when a local video is deleted
102 'action:api.video.deleted': true,
103 // Fired when a local video is uploaded
104 'action:api.video.uploaded': true,
105 // Fired when a local video is viewed
106 'action:api.video.viewed': true,
107
108 // Fired when a live video is created
109 'action:api.live-video.created': true,
110
111 // Fired when a thread is created
112 'action:api.video-thread.created': true,
113 // Fired when a reply to a thread is created
114 'action:api.video-comment-reply.created': true,
115 // Fired when a comment (thread or reply) is deleted
116 'action:api.video-comment.deleted': true,
117
118 // Fired when a caption is created
119 'action:api.video-caption.created': true,
120 // Fired when a caption is deleted
121 'action:api.video-caption.deleted': true,
122
123 // Fired when a user is blocked (banned)
124 'action:api.user.blocked': true,
125 // Fired when a user is unblocked (unbanned)
126 'action:api.user.unblocked': true,
127 // Fired when a user registered on the instance
128 'action:api.user.registered': true,
129 // Fired when an admin/moderator created a user
130 'action:api.user.created': true,
131 // Fired when a user is removed by an admin/moderator
132 'action:api.user.deleted': true,
133 // Fired when a user is updated by an admin/moderator
134 'action:api.user.updated': true,
135
136 // Fired when a user got a new oauth2 token
137 'action:api.user.oauth2-got-token': true,
138
139 // Fired when a video is added to a playlist
140 'action:api.video-playlist-element.created': true
141 }
142
143 export type ServerActionHookName = keyof typeof serverActionHookObject
144
145 export const serverHookObject = Object.assign({}, serverFilterHookObject, serverActionHookObject)
146 export type ServerHookName = keyof typeof serverHookObject
147
148 export interface ServerHook {
149 runHook <T> (hookName: ServerHookName, result?: T, params?: any): Promise<T>
150 }