PeerTube/shared/models/plugins/server-hook.model.ts

44 lines
1.4 KiB
TypeScript
Raw Normal View History

2019-07-23 02:48:48 -05:00
// {hookType}:{api?}.{location}.{subLocation?}.{actionType}.{target}
2019-07-22 09:31:47 -05:00
export const serverFilterHookObject = {
'filter:api.videos.list.params': true,
'filter:api.videos.list.result': true,
'filter:api.video.get.result': true,
2019-07-18 07:28:37 -05:00
2019-07-22 09:31:47 -05:00
'filter:api.video.upload.accept.result': true,
'filter:api.video-thread.create.accept.result': true,
'filter:api.video-comment-reply.create.accept.result': true,
2019-07-18 07:28:37 -05:00
2019-07-22 09:31:47 -05:00
'filter:api.video-threads.list.params': true,
'filter:api.video-threads.list.result': true,
2019-07-18 07:28:37 -05:00
2019-07-22 09:31:47 -05:00
'filter:api.video-thread-comments.list.params': true,
'filter:api.video-thread-comments.list.result': true,
2019-07-22 04:14:58 -05:00
2019-07-22 09:31:47 -05:00
'filter:video.auto-blacklist.result': true
}
export type ServerFilterHookName = keyof typeof serverFilterHookObject
2019-07-18 07:28:37 -05:00
2019-07-22 09:31:47 -05:00
export const serverActionHookObject = {
'action:application.listening': true,
2019-07-18 07:28:37 -05:00
2019-07-22 09:31:47 -05:00
'action:api.video.updated': true,
'action:api.video.deleted': true,
'action:api.video.uploaded': true,
'action:api.video.viewed': true,
'action:api.video-thread.created': true,
'action:api.video-comment-reply.created': true,
'action:api.video-comment.deleted': true
}
2019-07-18 07:28:37 -05:00
2019-07-22 09:31:47 -05:00
export type ServerActionHookName = keyof typeof serverActionHookObject
2019-07-18 07:28:37 -05:00
2019-07-22 09:31:47 -05:00
export const serverHookObject = Object.assign({}, serverFilterHookObject, serverActionHookObject)
export type ServerHookName = keyof typeof serverHookObject
2019-07-18 07:28:37 -05:00
export interface ServerHook {
2019-07-22 08:40:13 -05:00
runHook <T> (hookName: ServerHookName, result?: T, params?: any): Promise<T>
2019-07-18 07:28:37 -05:00
}