]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - shared/models/plugins/server/server-hook.model.ts
Implement signup approval in server
[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 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/results to search videos/channels in the DB or on the remote index
31 'filter:api.search.videos.local.list.params': true,
32 'filter:api.search.videos.local.list.result': true,
33 'filter:api.search.videos.index.list.params': true,
34 'filter:api.search.videos.index.list.result': true,
35 'filter:api.search.video-channels.local.list.params': true,
36 'filter:api.search.video-channels.local.list.result': true,
37 'filter:api.search.video-channels.index.list.params': true,
38 'filter:api.search.video-channels.index.list.result': true,
39 'filter:api.search.video-playlists.local.list.params': true,
40 'filter:api.search.video-playlists.local.list.result': true,
41 'filter:api.search.video-playlists.index.list.params': true,
42 'filter:api.search.video-playlists.index.list.result': true,
43
44 // Filter the result of the get function
45 // Used to get detailed video information (video watch page for example)
46 'filter:api.video.get.result': true,
47
48 // Filter params/results when listing video channels
49 'filter:api.video-channels.list.params': true,
50 'filter:api.video-channels.list.result': true,
51
52 // Filter the result when getting a video channel
53 'filter:api.video-channel.get.result': true,
54
55 // Filter the result of the accept upload/live, import via torrent/url functions
56 // If this function returns false then the upload is aborted with an error
57 'filter:api.video.upload.accept.result': true,
58 'filter:api.live-video.create.accept.result': true,
59 'filter:api.video.pre-import-url.accept.result': true,
60 'filter:api.video.pre-import-torrent.accept.result': true,
61 'filter:api.video.post-import-url.accept.result': true,
62 'filter:api.video.post-import-torrent.accept.result': true,
63 // Filter the result of the accept comment (thread or reply) functions
64 // If the functions return false then the user cannot post its comment
65 'filter:api.video-thread.create.accept.result': true,
66 'filter:api.video-comment-reply.create.accept.result': true,
67
68 // Filter attributes when creating video object
69 'filter:api.video.upload.video-attribute.result': true,
70 'filter:api.video.import-url.video-attribute.result': true,
71 'filter:api.video.import-torrent.video-attribute.result': true,
72 'filter:api.video.live.video-attribute.result': true,
73
74 // Filter params/result used to list threads of a specific video
75 // (used by the video watch page)
76 'filter:api.video-threads.list.params': true,
77 'filter:api.video-threads.list.result': true,
78
79 // Filter params/result used to list replies of a specific thread
80 // (used by the video watch page when we click on the "View replies" button)
81 'filter:api.video-thread-comments.list.params': true,
82 'filter:api.video-thread-comments.list.result': true,
83
84 // Filter get stats result
85 'filter:api.server.stats.get.result': true,
86
87 // Filter result used to check if we need to auto blacklist a video
88 // (fired when a local or remote video is created or updated)
89 'filter:video.auto-blacklist.result': true,
90
91 // Filter result used to check if a user can register on the instance
92 'filter:api.user.signup.allowed.result': true,
93
94 // Filter result used to check if a user can send a registration request on the instance
95 // PeerTube >= 5.1
96 'filter:api.user.request-signup.allowed.result': true,
97
98 // Filter result used to check if video/torrent download is allowed
99 'filter:api.download.video.allowed.result': true,
100 'filter:api.download.torrent.allowed.result': true,
101
102 // Filter result to check if the embed is allowed for a particular request
103 'filter:html.embed.video.allowed.result': true,
104 'filter:html.embed.video-playlist.allowed.result': true,
105
106 'filter:job-queue.process.params': true,
107 'filter:job-queue.process.result': true,
108
109 'filter:transcoding.manual.resolutions-to-transcode.result': true,
110 'filter:transcoding.auto.resolutions-to-transcode.result': true,
111
112 'filter:activity-pub.remote-video-comment.create.accept.result': true
113 }
114
115 export type ServerFilterHookName = keyof typeof serverFilterHookObject
116
117 export const serverActionHookObject = {
118 // Fired when the application has been loaded and is listening HTTP requests
119 'action:application.listening': true,
120
121 // Fired when a new notification is created
122 'action:notifier.notification.created': true,
123
124 // API actions hooks give access to the original express `req` and `res` parameters
125
126 // Fired when a local video is updated
127 'action:api.video.updated': true,
128 // Fired when a local video is deleted
129 'action:api.video.deleted': true,
130 // Fired when a local video is uploaded
131 'action:api.video.uploaded': true,
132 // Fired when a local video is viewed
133 'action:api.video.viewed': true,
134
135 // Fired when a video channel is created
136 'action:api.video-channel.created': true,
137 // Fired when a video channel is updated
138 'action:api.video-channel.updated': true,
139 // Fired when a video channel is deleted
140 'action:api.video-channel.deleted': true,
141
142 // Fired when a live video is created
143 'action:api.live-video.created': true,
144
145 // Fired when a thread is created
146 'action:api.video-thread.created': true,
147 // Fired when a reply to a thread is created
148 'action:api.video-comment-reply.created': true,
149 // Fired when a comment (thread or reply) is deleted
150 'action:api.video-comment.deleted': true,
151
152 // Fired when a caption is created
153 'action:api.video-caption.created': true,
154 // Fired when a caption is deleted
155 'action:api.video-caption.deleted': true,
156
157 // Fired when a user is blocked (banned)
158 'action:api.user.blocked': true,
159 // Fired when a user is unblocked (unbanned)
160 'action:api.user.unblocked': true,
161 // Fired when a user registered on the instance
162 'action:api.user.registered': true,
163 // Fired when a user requested registration on the instance
164 // PeerTube >= 5.1
165 'action:api.user.requested-registration': true,
166 // Fired when an admin/moderator created a user
167 'action:api.user.created': true,
168 // Fired when a user is removed by an admin/moderator
169 'action:api.user.deleted': true,
170 // Fired when a user is updated by an admin/moderator
171 'action:api.user.updated': true,
172
173 // Fired when a user got a new oauth2 token
174 'action:api.user.oauth2-got-token': true,
175
176 // Fired when a video is added to a playlist
177 'action:api.video-playlist-element.created': true
178 }
179
180 export type ServerActionHookName = keyof typeof serverActionHookObject
181
182 export const serverHookObject = Object.assign({}, serverFilterHookObject, serverActionHookObject)
183 export type ServerHookName = keyof typeof serverHookObject
184
185 export interface ServerHook {
186 runHook <T> (hookName: ServerHookName, result?: T, params?: any): Promise<T>
187 }