aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/models
diff options
context:
space:
mode:
Diffstat (limited to 'shared/models')
-rw-r--r--shared/models/plugins/client-hook.model.ts58
-rw-r--r--shared/models/plugins/server-hook.model.ts51
2 files changed, 63 insertions, 46 deletions
diff --git a/shared/models/plugins/client-hook.model.ts b/shared/models/plugins/client-hook.model.ts
index 89400003e..bf444fe5a 100644
--- a/shared/models/plugins/client-hook.model.ts
+++ b/shared/models/plugins/client-hook.model.ts
@@ -1,38 +1,48 @@
1export type ClientFilterHookName = 1// Data from API hooks: {hookType}:api.{location}.{elementType}.{actionType}.{target}
2 'filter:api.videos.list.trending.params' |
3 'filter:api.videos.list.trending.result' |
4 2
5 'filter:api.videos.list.local.params' | 3export const clientFilterHookObject = {
6 'filter:api.videos.list.local.result' | 4 'filter:api.trending-videos.videos.list.params': true,
5 'filter:api.trending-videos.videos.list.result': true,
7 6
8 'filter:api.videos.list.recently-added.params' | 7 'filter:api.local-videos.videos.list.params': true,
9 'filter:api.videos.list.recently-added.result' | 8 'filter:api.local-videos.videos.list.result': true,
10 9
11 'filter:api.videos.list.user-subscriptions.params' | 10 'filter:api.recently-added-videos.videos.list.params': true,
12 'filter:api.videos.list.user-subscriptions.result' | 11 'filter:api.recently-added-videos.videos.list.result': true,
13 12
14 'filter:api.video-watch.video.get.params' | 13 'filter:api.user-subscriptions-videos.videos.list.params': true,
15 'filter:api.video-watch.video.get.result' | 14 'filter:api.user-subscriptions-videos.videos.list.result': true,
16 15
17 'filter:api.video-watch.video-threads.list.params' | 16 'filter:api.video-watch.video.get.params': true,
18 'filter:api.video-watch.video-threads.list.result' | 17 'filter:api.video-watch.video.get.result': true,
19 18
20 'filter:api.video-watch.video-thread-replies.list.params' | 19 'filter:api.video-watch.video-threads.list.params': true,
21 'filter:api.video-watch.video-thread-replies.list.result' | 20 'filter:api.video-watch.video-threads.list.result': true,
22 21
23 'filter:api.search.videos.list.params' | 22 'filter:api.video-watch.video-thread-replies.list.params': true,
24 'filter:api.search.videos.list.result' | 23 'filter:api.video-watch.video-thread-replies.list.result': true,
25 'filter:api.search.video-channels.list.params' |
26 'filter:api.search.video-channels.list.result'
27 24
28export type ClientActionHookName = 25 'filter:api.search.videos.list.params': true,
29 'action:application.init' | 26 'filter:api.search.videos.list.result': true,
27 'filter:api.search.video-channels.list.params': true,
28 'filter:api.search.video-channels.list.result': true
29}
30
31export type ClientFilterHookName = keyof typeof clientFilterHookObject
32
33export const clientActionHookObject = {
34 'action:application.init': true,
30 35
31 'action:video-watch.init' | 36 'action:video-watch.init': true,
37 'action:video-watch.video.loaded': true,
38
39 'action:search.init': true
40}
32 41
33 'action:video-watch.video.loaded' 42export type ClientActionHookName = keyof typeof clientActionHookObject
34 43
35export type ClientHookName = ClientActionHookName | ClientFilterHookName 44export const clientHookObject = Object.assign({}, clientFilterHookObject, clientActionHookObject)
45export type ClientHookName = keyof typeof clientHookObject
36 46
37export interface ClientHook { 47export interface ClientHook {
38 runHook <T> (hookName: ClientHookName, result?: T, params?: any): Promise<T> 48 runHook <T> (hookName: ClientHookName, result?: T, params?: any): Promise<T>
diff --git a/shared/models/plugins/server-hook.model.ts b/shared/models/plugins/server-hook.model.ts
index 6729e2dab..f53e0ce59 100644
--- a/shared/models/plugins/server-hook.model.ts
+++ b/shared/models/plugins/server-hook.model.ts
@@ -1,33 +1,40 @@
1export type ServerFilterHookName = 1export const serverFilterHookObject = {
2 'filter:api.videos.list.params' | 2 'filter:api.videos.list.params': true,
3 'filter:api.videos.list.result' | 3 'filter:api.videos.list.result': true,
4 'filter:api.video.get.result' | 4 'filter:api.video.get.result': true,
5 5
6 'filter:api.video.upload.accept.result' | 6 'filter:api.video.upload.accept.result': true,
7 'filter:api.video-thread.create.accept.result' | 7 'filter:api.video-thread.create.accept.result': true,
8 'filter:api.video-comment-reply.create.accept.result' | 8 'filter:api.video-comment-reply.create.accept.result': true,
9 9
10 'filter:api.video-threads.list.params' | 10 'filter:api.video-threads.list.params': true,
11 'filter:api.video-threads.list.result' | 11 'filter:api.video-threads.list.result': true,
12 12
13 'filter:api.video-thread-comments.list.params' | 13 'filter:api.video-thread-comments.list.params': true,
14 'filter:api.video-thread-comments.list.result' | 14 'filter:api.video-thread-comments.list.result': true,
15 15
16 'filter:video.auto-blacklist.result' 16 'filter:video.auto-blacklist.result': true
17}
18
19export type ServerFilterHookName = keyof typeof serverFilterHookObject
17 20
18export type ServerActionHookName = 21export const serverActionHookObject = {
19 'action:application.listening' | 22 'action:application.listening': true,
20 23
21 'action:api.video.updated' | 24 'action:api.video.updated': true,
22 'action:api.video.deleted' | 25 'action:api.video.deleted': true,
23 'action:api.video.uploaded' | 26 'action:api.video.uploaded': true,
24 'action:api.video.viewed' | 27 'action:api.video.viewed': true,
28
29 'action:api.video-thread.created': true,
30 'action:api.video-comment-reply.created': true,
31 'action:api.video-comment.deleted': true
32}
25 33
26 'action:api.video-thread.created' | 34export type ServerActionHookName = keyof typeof serverActionHookObject
27 'action:api.video-comment-reply.created' |
28 'action:api.video-comment.deleted'
29 35
30export type ServerHookName = ServerFilterHookName | ServerActionHookName 36export const serverHookObject = Object.assign({}, serverFilterHookObject, serverActionHookObject)
37export type ServerHookName = keyof typeof serverHookObject
31 38
32export interface ServerHook { 39export interface ServerHook {
33 runHook <T> (hookName: ServerHookName, result?: T, params?: any): Promise<T> 40 runHook <T> (hookName: ServerHookName, result?: T, params?: any): Promise<T>