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