]>
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 | ||
f8b4a71d | 54 | // Filter params/result of the function that fetch video playlist elements of the my-library page |
55 | 'filter:api.my-library.video-playlist-elements.list.params': true, | |
56 | 'filter:api.my-library.video-playlist-elements.list.result': true, | |
57 | ||
3d9a63d3 | 58 | // Filter the options to create our player |
c2023a9f C |
59 | 'filter:internal.video-watch.player.build-options.params': true, |
60 | 'filter:internal.video-watch.player.build-options.result': true, | |
61 | ||
62 | // Filter our SVG icons content | |
63 | 'filter:internal.common.svg-icons.get-content.params': true, | |
8beea2d3 C |
64 | 'filter:internal.common.svg-icons.get-content.result': true, |
65 | ||
66 | // Filter left menu links | |
72f611ca | 67 | 'filter:left-menu.links.create.result': true, |
68 | ||
4e1592da | 69 | // Filter upload page alert messages |
59c8902a | 70 | 'filter:upload.messages.create.result': true, |
4e1592da | 71 | |
071f3e51 C |
72 | 'filter:login.instance-about-plugin-panels.create.result': true, |
73 | 'filter:signup.instance-about-plugin-panels.create.result': true, | |
74 | ||
de615445 C |
75 | 'filter:share.video-embed-code.build.params': true, |
76 | 'filter:share.video-embed-code.build.result': true, | |
77 | 'filter:share.video-playlist-embed-code.build.params': true, | |
78 | 'filter:share.video-playlist-embed-code.build.result': true, | |
79 | ||
80 | 'filter:share.video-embed-url.build.params': true, | |
81 | 'filter:share.video-embed-url.build.result': true, | |
82 | 'filter:share.video-playlist-embed-url.build.params': true, | |
83 | 'filter:share.video-playlist-embed-url.build.result': true, | |
84 | ||
85 | 'filter:share.video-url.build.params': true, | |
86 | 'filter:share.video-url.build.result': true, | |
87 | 'filter:share.video-playlist-url.build.params': true, | |
88 | 'filter:share.video-playlist-url.build.result': true, | |
89 | ||
4899138e C |
90 | 'filter:video-watch.video-plugin-metadata.result': true, |
91 | ||
72f611ca | 92 | // Filter videojs options built for PeerTube player |
9866921c | 93 | 'filter:internal.player.videojs.options.result': true, |
94 | ||
95 | // Filter p2p media loader options built for PeerTube player | |
96 | 'filter:internal.player.p2p-media-loader.options.result': true | |
7663e55a C |
97 | } |
98 | ||
99 | export type ClientFilterHookName = keyof typeof clientFilterHookObject | |
100 | ||
101 | export const clientActionHookObject = { | |
5f189c9c | 102 | // Fired when the application is being initialized |
7663e55a | 103 | 'action:application.init': true, |
93cae479 | 104 | |
5f189c9c | 105 | // Fired when the video watch page is being initialized |
7663e55a | 106 | 'action:video-watch.init': true, |
5f189c9c | 107 | // Fired when the video watch page loaded the video |
7663e55a | 108 | 'action:video-watch.video.loaded': true, |
5f85f8aa RK |
109 | // Fired when the player finished loading |
110 | 'action:video-watch.player.loaded': true, | |
0840ca76 C |
111 | // Fired when the video watch page comments(threads) are loaded and load more comments on scroll |
112 | 'action:video-watch.video-threads.loaded': true, | |
cf387740 B |
113 | // Fired when a user click on 'View x replies' and they're loaded |
114 | 'action:video-watch.video-thread-replies.loaded': true, | |
7663e55a | 115 | |
9ca0f688 C |
116 | // Fired when the video channel creation page is being initialized |
117 | 'action:video-channel-create.init': true, | |
118 | ||
119 | // Fired when the video channel update page is being initialized | |
120 | 'action:video-channel-update.init': true, | |
121 | 'action:video-channel-update.video-channel.loaded': true, | |
122 | ||
123 | // Fired when the page that list video channel videos is being initialized | |
124 | 'action:video-channel-videos.init': true, | |
125 | 'action:video-channel-videos.video-channel.loaded': true, | |
126 | 'action:video-channel-videos.videos.loaded': true, | |
127 | ||
128 | // Fired when the page that list video channel playlists is being initialized | |
129 | 'action:video-channel-playlists.init': true, | |
130 | 'action:video-channel-playlists.video-channel.loaded': true, | |
131 | 'action:video-channel-playlists.playlists.loaded': true, | |
132 | ||
7294aab0 | 133 | // Fired when the video edit page (upload, URL/torrent import, update) is being initialized |
085aba61 | 134 | // Contains a `type` and `updateForm` object attributes |
7294aab0 C |
135 | 'action:video-edit.init': true, |
136 | ||
085aba61 C |
137 | // Fired when values of the video edit form changed |
138 | 'action:video-edit.form.updated': true, | |
139 | ||
f375bb3d C |
140 | // Fired when the login page is being initialized |
141 | 'action:login.init': true, | |
142 | ||
5f189c9c | 143 | // Fired when the search page is being initialized |
23bdacf8 C |
144 | 'action:search.init': true, |
145 | ||
146 | // Fired every time Angular URL changes | |
ba7b7e57 RK |
147 | 'action:router.navigation-end': true, |
148 | ||
149 | // Fired when the registration page is being initialized | |
f9562863 C |
150 | 'action:signup.register.init': true, |
151 | ||
0ea9f463 C |
152 | // PeerTube >= 3.2 |
153 | // Fired when the admin plugin settings page is being initialized | |
154 | 'action:admin-plugin-settings.init': true, | |
155 | ||
7a4fd56c | 156 | // Fired when the video upload page is being initialized |
2e257e36 | 157 | 'action:video-upload.init': true, |
7a4fd56c | 158 | // Fired when the video import by URL page is being initialized |
2e257e36 | 159 | 'action:video-url-import.init': true, |
7a4fd56c | 160 | // Fired when the video import by torrent/magnet URI page is being initialized |
2e257e36 | 161 | 'action:video-torrent-import.init': true, |
7a4fd56c | 162 | // Fired when the "Go Live" page is being initialized |
2e257e36 C |
163 | 'action:go-live.init': true, |
164 | ||
7a4fd56c | 165 | // Fired when the user explicitly logged in/logged out |
faeec106 C |
166 | 'action:auth-user.logged-in': true, |
167 | 'action:auth-user.logged-out': true, | |
168 | // Fired when the application loaded user information (using tokens from the local storage or after a successful login) | |
169 | 'action:auth-user.information-loaded': true, | |
170 | ||
4bc45da3 C |
171 | // Fired when the modal to download a video/caption is shown |
172 | 'action:modal.video-download.shown': true, | |
de615445 C |
173 | // Fired when the modal to share a video/playlist is shown |
174 | 'action:modal.share.shown': true, | |
4bc45da3 | 175 | |
f9562863 | 176 | // ####### Embed hooks ####### |
4bc45da3 C |
177 | // /!\ In embed scope, peertube helpers are not available |
178 | // ########################### | |
f9562863 C |
179 | |
180 | // Fired when the embed loaded the player | |
181 | 'action:embed.player.loaded': true | |
7663e55a | 182 | } |
93cae479 | 183 | |
7663e55a | 184 | export type ClientActionHookName = keyof typeof clientActionHookObject |
93cae479 | 185 | |
7663e55a C |
186 | export const clientHookObject = Object.assign({}, clientFilterHookObject, clientActionHookObject) |
187 | export type ClientHookName = keyof typeof clientHookObject | |
93cae479 C |
188 | |
189 | export interface ClientHook { | |
190 | runHook <T> (hookName: ClientHookName, result?: T, params?: any): Promise<T> | |
191 | } |