]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - shared/models/plugins/client-hook.model.ts
Merge branch 'signup-hooks' into 'develop'
[github/Chocobozzz/PeerTube.git] / shared / models / plugins / client-hook.model.ts
1 // Data from API hooks: {hookType}:api.{location}.{elementType}.{actionType}.{target}
2
3 export const clientFilterHookObject = {
4 // Filter params/result of the function that fetch videos of the trending page
5 'filter:api.trending-videos.videos.list.params': true,
6 'filter:api.trending-videos.videos.list.result': true,
7
8 // Filter params/result of the function that fetch videos of the trending page
9 'filter:api.most-liked-videos.videos.list.params': true,
10 'filter:api.most-liked-videos.videos.list.result': true,
11
12 // Filter params/result of the function that fetch videos of the local page
13 'filter:api.local-videos.videos.list.params': true,
14 'filter:api.local-videos.videos.list.result': true,
15
16 // Filter params/result of the function that fetch videos of the recently-added page
17 'filter:api.recently-added-videos.videos.list.params': true,
18 'filter:api.recently-added-videos.videos.list.result': true,
19
20 // Filter params/result of the function that fetch videos of the user subscription page
21 'filter:api.user-subscriptions-videos.videos.list.params': true,
22 'filter:api.user-subscriptions-videos.videos.list.result': true,
23
24 // Filter params/result of the function that fetch the video of the video-watch page
25 'filter:api.video-watch.video.get.params': true,
26 'filter:api.video-watch.video.get.result': true,
27
28 // Filter params/result of the function that fetch the threads of the video-watch page
29 'filter:api.video-watch.video-threads.list.params': true,
30 'filter:api.video-watch.video-threads.list.result': true,
31
32 // Filter params/result of the function that fetch the replies of a thread in the video-watch page
33 'filter:api.video-watch.video-thread-replies.list.params': true,
34 'filter:api.video-watch.video-thread-replies.list.result': true,
35
36 // Filter params/result of the function that fetch videos according to the user search
37 'filter:api.search.videos.list.params': true,
38 'filter:api.search.videos.list.result': true,
39 // Filter params/result of the function that fetch video-channels according to the user search
40 'filter:api.search.video-channels.list.params': true,
41 'filter:api.search.video-channels.list.result': true,
42
43 // Filter form
44 'filter:api.signup.registration.create.params': true
45 }
46
47 export type ClientFilterHookName = keyof typeof clientFilterHookObject
48
49 export const clientActionHookObject = {
50 // Fired when the application is being initialized
51 'action:application.init': true,
52
53 // Fired when the video watch page is being initialized
54 'action:video-watch.init': true,
55 // Fired when the video watch page loaded the video
56 'action:video-watch.video.loaded': true,
57 // Fired when the player finished loading
58 'action:video-watch.player.loaded': true,
59
60 // Fired when the search page is being initialized
61 'action:search.init': true,
62
63 // Fired every time Angular URL changes
64 'action:router.navigation-end': true,
65
66 // Fired when the registration page is being initialized
67 'action:signup.register.init': true
68 }
69
70 export type ClientActionHookName = keyof typeof clientActionHookObject
71
72 export const clientHookObject = Object.assign({}, clientFilterHookObject, clientActionHookObject)
73 export type ClientHookName = keyof typeof clientHookObject
74
75 export interface ClientHook {
76 runHook <T> (hookName: ClientHookName, result?: T, params?: any): Promise<T>
77 }