diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-22 16:31:47 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-07-24 10:58:16 +0200 |
commit | 7663e55a2cc46a413bceee2787d48902b15ae642 (patch) | |
tree | c54d620617040642d962f9b8c74c7b8e2d745692 /shared | |
parent | e8f902c05cb35f6d5e9b75a23ddabd51c220a976 (diff) | |
download | PeerTube-7663e55a2cc46a413bceee2787d48902b15ae642.tar.gz PeerTube-7663e55a2cc46a413bceee2787d48902b15ae642.tar.zst PeerTube-7663e55a2cc46a413bceee2787d48902b15ae642.zip |
Log error on unknown hook
Diffstat (limited to 'shared')
-rw-r--r-- | shared/models/plugins/client-hook.model.ts | 58 | ||||
-rw-r--r-- | shared/models/plugins/server-hook.model.ts | 51 |
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 @@ | |||
1 | export 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' | | 3 | export 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 | ||
28 | export 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 | |||
31 | export type ClientFilterHookName = keyof typeof clientFilterHookObject | ||
32 | |||
33 | export 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' | 42 | export type ClientActionHookName = keyof typeof clientActionHookObject |
34 | 43 | ||
35 | export type ClientHookName = ClientActionHookName | ClientFilterHookName | 44 | export const clientHookObject = Object.assign({}, clientFilterHookObject, clientActionHookObject) |
45 | export type ClientHookName = keyof typeof clientHookObject | ||
36 | 46 | ||
37 | export interface ClientHook { | 47 | export 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 @@ | |||
1 | export type ServerFilterHookName = | 1 | export 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 | |||
19 | export type ServerFilterHookName = keyof typeof serverFilterHookObject | ||
17 | 20 | ||
18 | export type ServerActionHookName = | 21 | export 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' | | 34 | export type ServerActionHookName = keyof typeof serverActionHookObject |
27 | 'action:api.video-comment-reply.created' | | ||
28 | 'action:api.video-comment.deleted' | ||
29 | 35 | ||
30 | export type ServerHookName = ServerFilterHookName | ServerActionHookName | 36 | export const serverHookObject = Object.assign({}, serverFilterHookObject, serverActionHookObject) |
37 | export type ServerHookName = keyof typeof serverHookObject | ||
31 | 38 | ||
32 | export interface ServerHook { | 39 | export interface ServerHook { |
33 | runHook <T> (hookName: ServerHookName, result?: T, params?: any): Promise<T> | 40 | runHook <T> (hookName: ServerHookName, result?: T, params?: any): Promise<T> |