]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - shared/models/plugins/client/client-hook.model.ts
Alert user for low quota and video auto-block on upload page (#4336)
[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 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 // Filter params/result of the function that fetch video playlists according to the user search
44 'filter:api.search.video-playlists.list.params': true,
45 'filter:api.search.video-playlists.list.result': true,
46
47 // Filter form
48 'filter:api.signup.registration.create.params': true,
49
50 // Filter the options to create our player
51 'filter:internal.video-watch.player.build-options.params': true,
52 'filter:internal.video-watch.player.build-options.result': true,
53
54 // Filter our SVG icons content
55 'filter:internal.common.svg-icons.get-content.params': true,
56 'filter:internal.common.svg-icons.get-content.result': true,
57
58 // Filter left menu links
59 'filter:left-menu.links.create.result': true,
60
61 // Filter upload page alert messages
62 'filter:upload-page.alert-messages.edit.result': true,
63
64 // Filter videojs options built for PeerTube player
65 'filter:internal.player.videojs.options.result': true
66 }
67
68 export type ClientFilterHookName = keyof typeof clientFilterHookObject
69
70 export const clientActionHookObject = {
71 // Fired when the application is being initialized
72 'action:application.init': true,
73
74 // Fired when the video watch page is being initialized
75 'action:video-watch.init': true,
76 // Fired when the video watch page loaded the video
77 'action:video-watch.video.loaded': true,
78 // Fired when the player finished loading
79 'action:video-watch.player.loaded': true,
80 // Fired when the video watch page comments(threads) are loaded and load more comments on scroll
81 'action:video-watch.video-threads.loaded': true,
82 // Fired when a user click on 'View x replies' and they're loaded
83 'action:video-watch.video-thread-replies.loaded': true,
84
85 // Fired when the video edit page (upload, URL/torrent import, update) is being initialized
86 'action:video-edit.init': true,
87
88 // Fired when the login page is being initialized
89 'action:login.init': true,
90
91 // Fired when the search page is being initialized
92 'action:search.init': true,
93
94 // Fired every time Angular URL changes
95 'action:router.navigation-end': true,
96
97 // Fired when the registration page is being initialized
98 'action:signup.register.init': true,
99
100 // PeerTube >= 3.2
101 // Fired when the admin plugin settings page is being initialized
102 'action:admin-plugin-settings.init': true,
103
104 // Fired when the video upload page is being initalized
105 'action:video-upload.init': true,
106 // Fired when the video import by URL page is being initalized
107 'action:video-url-import.init': true,
108 // Fired when the video import by torrent/magnet URI page is being initalized
109 'action:video-torrent-import.init': true,
110 // Fired when the "Go Live" page is being initalized
111 'action:go-live.init': true,
112
113 // Fired when the user explicitely logged in/logged out
114 'action:auth-user.logged-in': true,
115 'action:auth-user.logged-out': true,
116 // Fired when the application loaded user information (using tokens from the local storage or after a successful login)
117 'action:auth-user.information-loaded': true,
118
119 // Fired when the modal to download a video/caption is shown
120 'action:modal.video-download.shown': true,
121
122 // ####### Embed hooks #######
123 // /!\ In embed scope, peertube helpers are not available
124 // ###########################
125
126 // Fired when the embed loaded the player
127 'action:embed.player.loaded': true
128 }
129
130 export type ClientActionHookName = keyof typeof clientActionHookObject
131
132 export const clientHookObject = Object.assign({}, clientFilterHookObject, clientActionHookObject)
133 export type ClientHookName = keyof typeof clientHookObject
134
135 export interface ClientHook {
136 runHook <T> (hookName: ClientHookName, result?: T, params?: any): Promise<T>
137 }