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