]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - shared/models/plugins/client/client-hook.model.ts
Merge branch 'release/4.3.0' into develop
[github/Chocobozzz/PeerTube.git] / shared / models / plugins / client / 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 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
33 // Filter params/result of the function that fetch the threads of the video-watch page
34 'filter:api.video-watch.video-threads.list.params': true,
35 'filter:api.video-watch.video-threads.list.result': true,
36
37 // Filter params/result of the function that fetch the replies of a thread in the video-watch page
38 'filter:api.video-watch.video-thread-replies.list.params': true,
39 'filter:api.video-watch.video-thread-replies.list.result': true,
40
41 // Filter params/result of the function that fetch videos according to the user search
42 'filter:api.search.videos.list.params': true,
43 'filter:api.search.videos.list.result': true,
44 // Filter params/result of the function that fetch video channels according to the user search
45 'filter:api.search.video-channels.list.params': true,
46 'filter:api.search.video-channels.list.result': true,
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,
50
51 // Filter form
52 'filter:api.signup.registration.create.params': true,
53
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
58 // Filter the options to create our player
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,
64 'filter:internal.common.svg-icons.get-content.result': true,
65
66 // Filter left menu links
67 'filter:left-menu.links.create.result': true,
68
69 // Filter upload page alert messages
70 'filter:upload.messages.create.result': true,
71
72 'filter:login.instance-about-plugin-panels.create.result': true,
73 'filter:signup.instance-about-plugin-panels.create.result': true,
74
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
90 // Filter videojs options built for PeerTube player
91 'filter:internal.player.videojs.options.result': true
92 }
93
94 export type ClientFilterHookName = keyof typeof clientFilterHookObject
95
96 export const clientActionHookObject = {
97 // Fired when the application is being initialized
98 'action:application.init': true,
99
100 // Fired when the video watch page is being initialized
101 'action:video-watch.init': true,
102 // Fired when the video watch page loaded the video
103 'action:video-watch.video.loaded': true,
104 // Fired when the player finished loading
105 'action:video-watch.player.loaded': true,
106 // Fired when the video watch page comments(threads) are loaded and load more comments on scroll
107 'action:video-watch.video-threads.loaded': true,
108 // Fired when a user click on 'View x replies' and they're loaded
109 'action:video-watch.video-thread-replies.loaded': true,
110
111 // Fired when the video channel creation page is being initialized
112 'action:video-channel-create.init': true,
113
114 // Fired when the video channel update page is being initialized
115 'action:video-channel-update.init': true,
116 'action:video-channel-update.video-channel.loaded': true,
117
118 // Fired when the page that list video channel videos is being initialized
119 'action:video-channel-videos.init': true,
120 'action:video-channel-videos.video-channel.loaded': true,
121 'action:video-channel-videos.videos.loaded': true,
122
123 // Fired when the page that list video channel playlists is being initialized
124 'action:video-channel-playlists.init': true,
125 'action:video-channel-playlists.video-channel.loaded': true,
126 'action:video-channel-playlists.playlists.loaded': true,
127
128 // Fired when the video edit page (upload, URL/torrent import, update) is being initialized
129 'action:video-edit.init': true,
130
131 // Fired when the login page is being initialized
132 'action:login.init': true,
133
134 // Fired when the search page is being initialized
135 'action:search.init': true,
136
137 // Fired every time Angular URL changes
138 'action:router.navigation-end': true,
139
140 // Fired when the registration page is being initialized
141 'action:signup.register.init': true,
142
143 // PeerTube >= 3.2
144 // Fired when the admin plugin settings page is being initialized
145 'action:admin-plugin-settings.init': true,
146
147 // Fired when the video upload page is being initialized
148 'action:video-upload.init': true,
149 // Fired when the video import by URL page is being initialized
150 'action:video-url-import.init': true,
151 // Fired when the video import by torrent/magnet URI page is being initialized
152 'action:video-torrent-import.init': true,
153 // Fired when the "Go Live" page is being initialized
154 'action:go-live.init': true,
155
156 // Fired when the user explicitly logged in/logged out
157 'action:auth-user.logged-in': true,
158 'action:auth-user.logged-out': true,
159 // Fired when the application loaded user information (using tokens from the local storage or after a successful login)
160 'action:auth-user.information-loaded': true,
161
162 // Fired when the modal to download a video/caption is shown
163 'action:modal.video-download.shown': true,
164 // Fired when the modal to share a video/playlist is shown
165 'action:modal.share.shown': true,
166
167 // ####### Embed hooks #######
168 // /!\ In embed scope, peertube helpers are not available
169 // ###########################
170
171 // Fired when the embed loaded the player
172 'action:embed.player.loaded': true
173 }
174
175 export type ClientActionHookName = keyof typeof clientActionHookObject
176
177 export const clientHookObject = Object.assign({}, clientFilterHookObject, clientActionHookObject)
178 export type ClientHookName = keyof typeof clientHookObject
179
180 export interface ClientHook {
181 runHook <T> (hookName: ClientHookName, result?: T, params?: any): Promise<T>
182 }