aboutsummaryrefslogtreecommitdiffhomepage
path: root/packages/models/src/plugins/server/server-hook.model.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/models/src/plugins/server/server-hook.model.ts')
-rw-r--r--packages/models/src/plugins/server/server-hook.model.ts221
1 files changed, 221 insertions, 0 deletions
diff --git a/packages/models/src/plugins/server/server-hook.model.ts b/packages/models/src/plugins/server/server-hook.model.ts
new file mode 100644
index 000000000..cf387ffd7
--- /dev/null
+++ b/packages/models/src/plugins/server/server-hook.model.ts
@@ -0,0 +1,221 @@
1// {hookType}:{root}.{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 a video playlists videos
10 // for the REST API
11 'filter:api.video-playlist.videos.list.params': true,
12 'filter:api.video-playlist.videos.list.result': true,
13
14 // Filter params/result used to list account videos for the REST API
15 'filter:api.accounts.videos.list.params': true,
16 'filter:api.accounts.videos.list.result': true,
17
18 // Filter params/result used to list channel videos for the REST API
19 'filter:api.video-channels.videos.list.params': true,
20 'filter:api.video-channels.videos.list.result': true,
21
22 // Filter params/result used to list my user videos for the REST API
23 'filter:api.user.me.videos.list.params': true,
24 'filter:api.user.me.videos.list.result': true,
25
26 // Filter params/result used to list overview videos for the REST API
27 'filter:api.overviews.videos.list.params': true,
28 'filter:api.overviews.videos.list.result': true,
29
30 // Filter params/result used to list subscription videos for the REST API
31 'filter:api.user.me.subscription-videos.list.params': true,
32 'filter:api.user.me.subscription-videos.list.result': true,
33
34 // Filter params/results to search videos/channels in the DB or on the remote index
35 'filter:api.search.videos.local.list.params': true,
36 'filter:api.search.videos.local.list.result': true,
37 'filter:api.search.videos.index.list.params': true,
38 'filter:api.search.videos.index.list.result': true,
39 'filter:api.search.video-channels.local.list.params': true,
40 'filter:api.search.video-channels.local.list.result': true,
41 'filter:api.search.video-channels.index.list.params': true,
42 'filter:api.search.video-channels.index.list.result': true,
43 'filter:api.search.video-playlists.local.list.params': true,
44 'filter:api.search.video-playlists.local.list.result': true,
45 'filter:api.search.video-playlists.index.list.params': true,
46 'filter:api.search.video-playlists.index.list.result': true,
47
48 // Filter the result of the get function
49 // Used to get detailed video information (video watch page for example)
50 'filter:api.video.get.result': true,
51
52 // Filter params/results when listing video channels
53 'filter:api.video-channels.list.params': true,
54 'filter:api.video-channels.list.result': true,
55
56 // Filter the result when getting a video channel
57 'filter:api.video-channel.get.result': true,
58
59 // Filter the result of the accept upload/live, import via torrent/url functions
60 // If this function returns false then the upload is aborted with an error
61 'filter:api.video.upload.accept.result': true,
62 'filter:api.live-video.create.accept.result': true,
63 'filter:api.video.pre-import-url.accept.result': true,
64 'filter:api.video.pre-import-torrent.accept.result': true,
65 'filter:api.video.post-import-url.accept.result': true,
66 'filter:api.video.post-import-torrent.accept.result': true,
67 'filter:api.video.update-file.accept.result': true,
68 // Filter the result of the accept comment (thread or reply) functions
69 // If the functions return false then the user cannot post its comment
70 'filter:api.video-thread.create.accept.result': true,
71 'filter:api.video-comment-reply.create.accept.result': true,
72
73 // Filter attributes when creating video object
74 'filter:api.video.upload.video-attribute.result': true,
75 'filter:api.video.import-url.video-attribute.result': true,
76 'filter:api.video.import-torrent.video-attribute.result': true,
77 'filter:api.video.live.video-attribute.result': true,
78
79 // Filter params/result used to list threads of a specific video
80 // (used by the video watch page)
81 'filter:api.video-threads.list.params': true,
82 'filter:api.video-threads.list.result': true,
83
84 // Filter params/result used to list replies of a specific thread
85 // (used by the video watch page when we click on the "View replies" button)
86 'filter:api.video-thread-comments.list.params': true,
87 'filter:api.video-thread-comments.list.result': true,
88
89 // Filter get stats result
90 'filter:api.server.stats.get.result': true,
91
92 // Filter result used to check if we need to auto blacklist a video
93 // (fired when a local or remote video is created or updated)
94 'filter:video.auto-blacklist.result': true,
95
96 // Filter result used to check if a user can register on the instance
97 'filter:api.user.signup.allowed.result': true,
98
99 // Filter result used to check if a user can send a registration request on the instance
100 // PeerTube >= 5.1
101 'filter:api.user.request-signup.allowed.result': true,
102
103 // Filter result used to check if video/torrent download is allowed
104 'filter:api.download.video.allowed.result': true,
105 'filter:api.download.torrent.allowed.result': true,
106
107 // Filter result to check if the embed is allowed for a particular request
108 'filter:html.embed.video.allowed.result': true,
109 'filter:html.embed.video-playlist.allowed.result': true,
110
111 // Peertube >= 5.2
112 'filter:html.client.json-ld.result': true,
113
114 'filter:job-queue.process.params': true,
115 'filter:job-queue.process.result': true,
116
117 'filter:transcoding.manual.resolutions-to-transcode.result': true,
118 'filter:transcoding.auto.resolutions-to-transcode.result': true,
119
120 'filter:activity-pub.remote-video-comment.create.accept.result': true,
121
122 'filter:activity-pub.activity.context.build.result': true,
123
124 // Filter the result of video JSON LD builder
125 // You may also need to use filter:activity-pub.activity.context.build.result to also update JSON LD context
126 'filter:activity-pub.video.json-ld.build.result': true,
127
128 // Filter result to allow custom XMLNS definitions in podcast RSS feeds
129 // Peertube >= 5.2
130 'filter:feed.podcast.rss.create-custom-xmlns.result': true,
131
132 // Filter result to allow custom tags in podcast RSS feeds
133 // Peertube >= 5.2
134 'filter:feed.podcast.channel.create-custom-tags.result': true,
135 // Peertube >= 5.2
136 'filter:feed.podcast.video.create-custom-tags.result': true
137}
138
139export type ServerFilterHookName = keyof typeof serverFilterHookObject
140
141export const serverActionHookObject = {
142 // Fired when the application has been loaded and is listening HTTP requests
143 'action:application.listening': true,
144
145 // Fired when a new notification is created
146 'action:notifier.notification.created': true,
147
148 // API actions hooks give access to the original express `req` and `res` parameters
149
150 // Fired when a local video is updated
151 'action:api.video.updated': true,
152 // Fired when a local video is deleted
153 'action:api.video.deleted': true,
154 // Fired when a local video is uploaded
155 'action:api.video.uploaded': true,
156 // Fired when a local video is viewed
157 'action:api.video.viewed': true,
158
159 // Fired when a local video file has been replaced by a new one
160 'action:api.video.file-updated': true,
161
162 // Fired when a video channel is created
163 'action:api.video-channel.created': true,
164 // Fired when a video channel is updated
165 'action:api.video-channel.updated': true,
166 // Fired when a video channel is deleted
167 'action:api.video-channel.deleted': true,
168
169 // Fired when a live video is created
170 'action:api.live-video.created': true,
171 // Fired when a live video starts or ends
172 // Peertube >= 5.2
173 'action:live.video.state.updated': true,
174
175 // Fired when a thread is created
176 'action:api.video-thread.created': true,
177 // Fired when a reply to a thread is created
178 'action:api.video-comment-reply.created': true,
179 // Fired when a comment (thread or reply) is deleted
180 'action:api.video-comment.deleted': true,
181
182 // Fired when a caption is created
183 'action:api.video-caption.created': true,
184 // Fired when a caption is deleted
185 'action:api.video-caption.deleted': true,
186
187 // Fired when a user is blocked (banned)
188 'action:api.user.blocked': true,
189 // Fired when a user is unblocked (unbanned)
190 'action:api.user.unblocked': true,
191 // Fired when a user registered on the instance
192 'action:api.user.registered': true,
193 // Fired when a user requested registration on the instance
194 // PeerTube >= 5.1
195 'action:api.user.requested-registration': true,
196 // Fired when an admin/moderator created a user
197 'action:api.user.created': true,
198 // Fired when a user is removed by an admin/moderator
199 'action:api.user.deleted': true,
200 // Fired when a user is updated by an admin/moderator
201 'action:api.user.updated': true,
202
203 // Fired when a user got a new oauth2 token
204 'action:api.user.oauth2-got-token': true,
205
206 // Fired when a video is added to a playlist
207 'action:api.video-playlist-element.created': true,
208
209 // Fired when a remote video has been created/updated
210 'action:activity-pub.remote-video.created': true,
211 'action:activity-pub.remote-video.updated': true
212}
213
214export type ServerActionHookName = keyof typeof serverActionHookObject
215
216export const serverHookObject = Object.assign({}, serverFilterHookObject, serverActionHookObject)
217export type ServerHookName = keyof typeof serverHookObject
218
219export interface ServerHook {
220 runHook <T> (hookName: ServerHookName, result?: T, params?: any): Promise<T>
221}