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