]>
Commit | Line | Data |
---|---|---|
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 | 4 | export 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 | |
c3bb0441 | 29 | // Filter params/result of the function that fetch video playlist elements of the video-watch page |
30 | 'filter:api.video-watch.video-playlist-elements.get.params': true, | |
31 | 'filter:api.video-watch.video-playlist-elements.get.result': true, | |
32 | ||
5f189c9c | 33 | // Filter params/result of the function that fetch the threads of the video-watch page |
7663e55a C |
34 | 'filter:api.video-watch.video-threads.list.params': true, |
35 | 'filter:api.video-watch.video-threads.list.result': true, | |
93cae479 | 36 | |
5f189c9c | 37 | // Filter params/result of the function that fetch the replies of a thread in the video-watch page |
7663e55a C |
38 | 'filter:api.video-watch.video-thread-replies.list.params': true, |
39 | 'filter:api.video-watch.video-thread-replies.list.result': true, | |
93cae479 | 40 | |
5f189c9c | 41 | // Filter params/result of the function that fetch videos according to the user search |
7663e55a C |
42 | 'filter:api.search.videos.list.params': true, |
43 | 'filter:api.search.videos.list.result': true, | |
37a44fc9 | 44 | // Filter params/result of the function that fetch video channels according to the user search |
7663e55a | 45 | 'filter:api.search.video-channels.list.params': true, |
ba7b7e57 | 46 | 'filter:api.search.video-channels.list.result': true, |
37a44fc9 C |
47 | // Filter params/result of the function that fetch video playlists according to the user search |
48 | 'filter:api.search.video-playlists.list.params': true, | |
49 | 'filter:api.search.video-playlists.list.result': true, | |
ba7b7e57 RK |
50 | |
51 | // Filter form | |
3d9a63d3 C |
52 | 'filter:api.signup.registration.create.params': true, |
53 | ||
54 | // Filter the options to create our player | |
c2023a9f C |
55 | 'filter:internal.video-watch.player.build-options.params': true, |
56 | 'filter:internal.video-watch.player.build-options.result': true, | |
57 | ||
58 | // Filter our SVG icons content | |
59 | 'filter:internal.common.svg-icons.get-content.params': true, | |
8beea2d3 C |
60 | 'filter:internal.common.svg-icons.get-content.result': true, |
61 | ||
62 | // Filter left menu links | |
72f611ca | 63 | 'filter:left-menu.links.create.result': true, |
64 | ||
4e1592da | 65 | // Filter upload page alert messages |
59c8902a | 66 | 'filter:upload.messages.create.result': true, |
4e1592da | 67 | |
071f3e51 C |
68 | 'filter:login.instance-about-plugin-panels.create.result': true, |
69 | 'filter:signup.instance-about-plugin-panels.create.result': true, | |
70 | ||
72f611ca | 71 | // Filter videojs options built for PeerTube player |
72 | 'filter:internal.player.videojs.options.result': true | |
7663e55a C |
73 | } |
74 | ||
75 | export type ClientFilterHookName = keyof typeof clientFilterHookObject | |
76 | ||
77 | export const clientActionHookObject = { | |
5f189c9c | 78 | // Fired when the application is being initialized |
7663e55a | 79 | 'action:application.init': true, |
93cae479 | 80 | |
5f189c9c | 81 | // Fired when the video watch page is being initialized |
7663e55a | 82 | 'action:video-watch.init': true, |
5f189c9c | 83 | // Fired when the video watch page loaded the video |
7663e55a | 84 | 'action:video-watch.video.loaded': true, |
5f85f8aa RK |
85 | // Fired when the player finished loading |
86 | 'action:video-watch.player.loaded': true, | |
0840ca76 C |
87 | // Fired when the video watch page comments(threads) are loaded and load more comments on scroll |
88 | 'action:video-watch.video-threads.loaded': true, | |
cf387740 B |
89 | // Fired when a user click on 'View x replies' and they're loaded |
90 | 'action:video-watch.video-thread-replies.loaded': true, | |
7663e55a | 91 | |
7294aab0 C |
92 | // Fired when the video edit page (upload, URL/torrent import, update) is being initialized |
93 | 'action:video-edit.init': true, | |
94 | ||
f375bb3d C |
95 | // Fired when the login page is being initialized |
96 | 'action:login.init': true, | |
97 | ||
5f189c9c | 98 | // Fired when the search page is being initialized |
23bdacf8 C |
99 | 'action:search.init': true, |
100 | ||
101 | // Fired every time Angular URL changes | |
ba7b7e57 RK |
102 | 'action:router.navigation-end': true, |
103 | ||
104 | // Fired when the registration page is being initialized | |
f9562863 C |
105 | 'action:signup.register.init': true, |
106 | ||
0ea9f463 C |
107 | // PeerTube >= 3.2 |
108 | // Fired when the admin plugin settings page is being initialized | |
109 | 'action:admin-plugin-settings.init': true, | |
110 | ||
2e257e36 C |
111 | // Fired when the video upload page is being initalized |
112 | 'action:video-upload.init': true, | |
113 | // Fired when the video import by URL page is being initalized | |
114 | 'action:video-url-import.init': true, | |
115 | // Fired when the video import by torrent/magnet URI page is being initalized | |
116 | 'action:video-torrent-import.init': true, | |
117 | // Fired when the "Go Live" page is being initalized | |
118 | 'action:go-live.init': true, | |
119 | ||
faeec106 C |
120 | // Fired when the user explicitely logged in/logged out |
121 | 'action:auth-user.logged-in': true, | |
122 | 'action:auth-user.logged-out': true, | |
123 | // Fired when the application loaded user information (using tokens from the local storage or after a successful login) | |
124 | 'action:auth-user.information-loaded': true, | |
125 | ||
4bc45da3 C |
126 | // Fired when the modal to download a video/caption is shown |
127 | 'action:modal.video-download.shown': true, | |
128 | ||
f9562863 | 129 | // ####### Embed hooks ####### |
4bc45da3 C |
130 | // /!\ In embed scope, peertube helpers are not available |
131 | // ########################### | |
f9562863 C |
132 | |
133 | // Fired when the embed loaded the player | |
134 | 'action:embed.player.loaded': true | |
7663e55a | 135 | } |
93cae479 | 136 | |
7663e55a | 137 | export type ClientActionHookName = keyof typeof clientActionHookObject |
93cae479 | 138 | |
7663e55a C |
139 | export const clientHookObject = Object.assign({}, clientFilterHookObject, clientActionHookObject) |
140 | export type ClientHookName = keyof typeof clientHookObject | |
93cae479 C |
141 | |
142 | export interface ClientHook { | |
143 | runHook <T> (hookName: ClientHookName, result?: T, params?: any): Promise<T> | |
144 | } |