diff options
author | Chocobozzz <me@florianbigard.com> | 2023-08-17 08:59:21 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-08-17 08:59:21 +0200 |
commit | c380e3928517eb5311b38cf257816642617d7a33 (patch) | |
tree | 2ea9b70ebca16b5d109bcce98fe7f944dad89319 /packages/models/src/plugins | |
parent | a8ca6190fb462bf6eb5685cfc1d8ae444164a487 (diff) | |
parent | 3a4992633ee62d5edfbb484d9c6bcb3cf158489d (diff) | |
download | PeerTube-c380e3928517eb5311b38cf257816642617d7a33.tar.gz PeerTube-c380e3928517eb5311b38cf257816642617d7a33.tar.zst PeerTube-c380e3928517eb5311b38cf257816642617d7a33.zip |
Merge branch 'feature/esm-and-nx' into develop
Diffstat (limited to 'packages/models/src/plugins')
38 files changed, 768 insertions, 0 deletions
diff --git a/packages/models/src/plugins/client/client-hook.model.ts b/packages/models/src/plugins/client/client-hook.model.ts new file mode 100644 index 000000000..4a0818c99 --- /dev/null +++ b/packages/models/src/plugins/client/client-hook.model.ts | |||
@@ -0,0 +1,195 @@ | |||
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 the options to load a new video in our player | ||
63 | 'filter:internal.video-watch.player.load-options.params': true, | ||
64 | 'filter:internal.video-watch.player.load-options.result': true, | ||
65 | |||
66 | // Filter our SVG icons content | ||
67 | 'filter:internal.common.svg-icons.get-content.params': true, | ||
68 | 'filter:internal.common.svg-icons.get-content.result': true, | ||
69 | |||
70 | // Filter left menu links | ||
71 | 'filter:left-menu.links.create.result': true, | ||
72 | |||
73 | // Filter upload page alert messages | ||
74 | 'filter:upload.messages.create.result': true, | ||
75 | |||
76 | 'filter:login.instance-about-plugin-panels.create.result': true, | ||
77 | 'filter:signup.instance-about-plugin-panels.create.result': true, | ||
78 | |||
79 | 'filter:share.video-embed-code.build.params': true, | ||
80 | 'filter:share.video-embed-code.build.result': true, | ||
81 | 'filter:share.video-playlist-embed-code.build.params': true, | ||
82 | 'filter:share.video-playlist-embed-code.build.result': true, | ||
83 | |||
84 | 'filter:share.video-embed-url.build.params': true, | ||
85 | 'filter:share.video-embed-url.build.result': true, | ||
86 | 'filter:share.video-playlist-embed-url.build.params': true, | ||
87 | 'filter:share.video-playlist-embed-url.build.result': true, | ||
88 | |||
89 | 'filter:share.video-url.build.params': true, | ||
90 | 'filter:share.video-url.build.result': true, | ||
91 | 'filter:share.video-playlist-url.build.params': true, | ||
92 | 'filter:share.video-playlist-url.build.result': true, | ||
93 | |||
94 | 'filter:video-watch.video-plugin-metadata.result': true, | ||
95 | |||
96 | // Filter videojs options built for PeerTube player | ||
97 | 'filter:internal.player.videojs.options.result': true, | ||
98 | |||
99 | // Filter p2p media loader options built for PeerTube player | ||
100 | 'filter:internal.player.p2p-media-loader.options.result': true | ||
101 | } | ||
102 | |||
103 | export type ClientFilterHookName = keyof typeof clientFilterHookObject | ||
104 | |||
105 | export const clientActionHookObject = { | ||
106 | // Fired when the application is being initialized | ||
107 | 'action:application.init': true, | ||
108 | |||
109 | // Fired when the video watch page is being initialized | ||
110 | 'action:video-watch.init': true, | ||
111 | // Fired when the video watch page loaded the video | ||
112 | 'action:video-watch.video.loaded': true, | ||
113 | // Fired when the player finished loading | ||
114 | 'action:video-watch.player.loaded': true, | ||
115 | // Fired when the video watch page comments(threads) are loaded and load more comments on scroll | ||
116 | 'action:video-watch.video-threads.loaded': true, | ||
117 | // Fired when a user click on 'View x replies' and they're loaded | ||
118 | 'action:video-watch.video-thread-replies.loaded': true, | ||
119 | |||
120 | // Fired when the video channel creation page is being initialized | ||
121 | 'action:video-channel-create.init': true, | ||
122 | |||
123 | // Fired when the video channel update page is being initialized | ||
124 | 'action:video-channel-update.init': true, | ||
125 | 'action:video-channel-update.video-channel.loaded': true, | ||
126 | |||
127 | // Fired when the page that list video channel videos is being initialized | ||
128 | 'action:video-channel-videos.init': true, | ||
129 | 'action:video-channel-videos.video-channel.loaded': true, | ||
130 | 'action:video-channel-videos.videos.loaded': true, | ||
131 | |||
132 | // Fired when the page that list video channel playlists is being initialized | ||
133 | 'action:video-channel-playlists.init': true, | ||
134 | 'action:video-channel-playlists.video-channel.loaded': true, | ||
135 | 'action:video-channel-playlists.playlists.loaded': true, | ||
136 | |||
137 | // Fired when the video edit page (upload, URL/torrent import, update) is being initialized | ||
138 | // Contains a `type` and `updateForm` object attributes | ||
139 | 'action:video-edit.init': true, | ||
140 | |||
141 | // Fired when values of the video edit form changed | ||
142 | 'action:video-edit.form.updated': true, | ||
143 | |||
144 | // Fired when the login page is being initialized | ||
145 | 'action:login.init': true, | ||
146 | |||
147 | // Fired when the search page is being initialized | ||
148 | 'action:search.init': true, | ||
149 | |||
150 | // Fired every time Angular URL changes | ||
151 | 'action:router.navigation-end': true, | ||
152 | |||
153 | // Fired when the registration page is being initialized | ||
154 | 'action:signup.register.init': true, | ||
155 | |||
156 | // PeerTube >= 3.2 | ||
157 | // Fired when the admin plugin settings page is being initialized | ||
158 | 'action:admin-plugin-settings.init': true, | ||
159 | |||
160 | // Fired when the video upload page is being initialized | ||
161 | 'action:video-upload.init': true, | ||
162 | // Fired when the video import by URL page is being initialized | ||
163 | 'action:video-url-import.init': true, | ||
164 | // Fired when the video import by torrent/magnet URI page is being initialized | ||
165 | 'action:video-torrent-import.init': true, | ||
166 | // Fired when the "Go Live" page is being initialized | ||
167 | 'action:go-live.init': true, | ||
168 | |||
169 | // Fired when the user explicitly logged in/logged out | ||
170 | 'action:auth-user.logged-in': true, | ||
171 | 'action:auth-user.logged-out': true, | ||
172 | // Fired when the application loaded user information (using tokens from the local storage or after a successful login) | ||
173 | 'action:auth-user.information-loaded': true, | ||
174 | |||
175 | // Fired when the modal to download a video/caption is shown | ||
176 | 'action:modal.video-download.shown': true, | ||
177 | // Fired when the modal to share a video/playlist is shown | ||
178 | 'action:modal.share.shown': true, | ||
179 | |||
180 | // ####### Embed hooks ####### | ||
181 | // /!\ In embed scope, peertube helpers are not available | ||
182 | // ########################### | ||
183 | |||
184 | // Fired when the embed loaded the player | ||
185 | 'action:embed.player.loaded': true | ||
186 | } | ||
187 | |||
188 | export type ClientActionHookName = keyof typeof clientActionHookObject | ||
189 | |||
190 | export const clientHookObject = Object.assign({}, clientFilterHookObject, clientActionHookObject) | ||
191 | export type ClientHookName = keyof typeof clientHookObject | ||
192 | |||
193 | export interface ClientHook { | ||
194 | runHook <T> (hookName: ClientHookName, result?: T, params?: any): Promise<T> | ||
195 | } | ||
diff --git a/packages/models/src/plugins/client/index.ts b/packages/models/src/plugins/client/index.ts new file mode 100644 index 000000000..04fa32d6d --- /dev/null +++ b/packages/models/src/plugins/client/index.ts | |||
@@ -0,0 +1,8 @@ | |||
1 | export * from './client-hook.model.js' | ||
2 | export * from './plugin-client-scope.type.js' | ||
3 | export * from './plugin-element-placeholder.type.js' | ||
4 | export * from './plugin-selector-id.type.js' | ||
5 | export * from './register-client-form-field.model.js' | ||
6 | export * from './register-client-hook.model.js' | ||
7 | export * from './register-client-route.model.js' | ||
8 | export * from './register-client-settings-script.model.js' | ||
diff --git a/packages/models/src/plugins/client/plugin-client-scope.type.ts b/packages/models/src/plugins/client/plugin-client-scope.type.ts new file mode 100644 index 000000000..c09a453b8 --- /dev/null +++ b/packages/models/src/plugins/client/plugin-client-scope.type.ts | |||
@@ -0,0 +1,11 @@ | |||
1 | export type PluginClientScope = | ||
2 | 'common' | | ||
3 | 'video-watch' | | ||
4 | 'search' | | ||
5 | 'signup' | | ||
6 | 'login' | | ||
7 | 'embed' | | ||
8 | 'video-edit' | | ||
9 | 'admin-plugin' | | ||
10 | 'my-library' | | ||
11 | 'video-channel' | ||
diff --git a/packages/models/src/plugins/client/plugin-element-placeholder.type.ts b/packages/models/src/plugins/client/plugin-element-placeholder.type.ts new file mode 100644 index 000000000..7b8a2605b --- /dev/null +++ b/packages/models/src/plugins/client/plugin-element-placeholder.type.ts | |||
@@ -0,0 +1,4 @@ | |||
1 | export type PluginElementPlaceholder = | ||
2 | 'player-next' | | ||
3 | 'share-modal-playlist-settings' | | ||
4 | 'share-modal-video-settings' | ||
diff --git a/packages/models/src/plugins/client/plugin-selector-id.type.ts b/packages/models/src/plugins/client/plugin-selector-id.type.ts new file mode 100644 index 000000000..8d23314b5 --- /dev/null +++ b/packages/models/src/plugins/client/plugin-selector-id.type.ts | |||
@@ -0,0 +1,10 @@ | |||
1 | export type PluginSelectorId = | ||
2 | 'login-form' | | ||
3 | 'menu-user-dropdown-language-item' | | ||
4 | 'about-instance-features' | | ||
5 | 'about-instance-statistics' | | ||
6 | 'about-instance-moderation' | | ||
7 | 'about-menu-instance' | | ||
8 | 'about-menu-peertube' | | ||
9 | 'about-menu-network' | | ||
10 | 'about-instance-other-information' | ||
diff --git a/packages/models/src/plugins/client/register-client-form-field.model.ts b/packages/models/src/plugins/client/register-client-form-field.model.ts new file mode 100644 index 000000000..153c4a6ea --- /dev/null +++ b/packages/models/src/plugins/client/register-client-form-field.model.ts | |||
@@ -0,0 +1,30 @@ | |||
1 | export type RegisterClientFormFieldOptions = { | ||
2 | name?: string | ||
3 | label?: string | ||
4 | type: 'input' | 'input-checkbox' | 'input-password' | 'input-textarea' | 'markdown-text' | 'markdown-enhanced' | 'select' | 'html' | ||
5 | |||
6 | // For select type | ||
7 | options?: { value: string, label: string }[] | ||
8 | |||
9 | // For html type | ||
10 | html?: string | ||
11 | |||
12 | descriptionHTML?: string | ||
13 | |||
14 | // Default setting value | ||
15 | default?: string | boolean | ||
16 | |||
17 | // Not supported by plugin setting registration, use registerSettingsScript instead | ||
18 | hidden?: (options: any) => boolean | ||
19 | |||
20 | // Return undefined | null if there is no error or return a string with the detailed error | ||
21 | // Not supported by plugin setting registration | ||
22 | error?: (options: any) => Promise<{ error: boolean, text?: string }> | ||
23 | } | ||
24 | |||
25 | export interface RegisterClientVideoFieldOptions { | ||
26 | type: 'update' | 'upload' | 'import-url' | 'import-torrent' | 'go-live' | ||
27 | |||
28 | // Default to 'plugin-settings' | ||
29 | tab?: 'main' | 'plugin-settings' | ||
30 | } | ||
diff --git a/packages/models/src/plugins/client/register-client-hook.model.ts b/packages/models/src/plugins/client/register-client-hook.model.ts new file mode 100644 index 000000000..19159ed1e --- /dev/null +++ b/packages/models/src/plugins/client/register-client-hook.model.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | import { ClientHookName } from './client-hook.model.js' | ||
2 | |||
3 | export interface RegisterClientHookOptions { | ||
4 | target: ClientHookName | ||
5 | handler: Function | ||
6 | priority?: number | ||
7 | } | ||
diff --git a/packages/models/src/plugins/client/register-client-route.model.ts b/packages/models/src/plugins/client/register-client-route.model.ts new file mode 100644 index 000000000..271b67834 --- /dev/null +++ b/packages/models/src/plugins/client/register-client-route.model.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | export interface RegisterClientRouteOptions { | ||
2 | route: string | ||
3 | |||
4 | onMount (options: { | ||
5 | rootEl: HTMLElement | ||
6 | }): void | ||
7 | } | ||
diff --git a/packages/models/src/plugins/client/register-client-settings-script.model.ts b/packages/models/src/plugins/client/register-client-settings-script.model.ts new file mode 100644 index 000000000..7de3c1c28 --- /dev/null +++ b/packages/models/src/plugins/client/register-client-settings-script.model.ts | |||
@@ -0,0 +1,8 @@ | |||
1 | import { RegisterServerSettingOptions } from '../server/index.js' | ||
2 | |||
3 | export interface RegisterClientSettingsScriptOptions { | ||
4 | isSettingHidden (options: { | ||
5 | setting: RegisterServerSettingOptions | ||
6 | formValues: { [name: string]: any } | ||
7 | }): boolean | ||
8 | } | ||
diff --git a/packages/models/src/plugins/hook-type.enum.ts b/packages/models/src/plugins/hook-type.enum.ts new file mode 100644 index 000000000..7acc5f48a --- /dev/null +++ b/packages/models/src/plugins/hook-type.enum.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | export const HookType = { | ||
2 | STATIC: 1, | ||
3 | ACTION: 2, | ||
4 | FILTER: 3 | ||
5 | } as const | ||
6 | |||
7 | export type HookType_Type = typeof HookType[keyof typeof HookType] | ||
diff --git a/packages/models/src/plugins/index.ts b/packages/models/src/plugins/index.ts new file mode 100644 index 000000000..1117a946e --- /dev/null +++ b/packages/models/src/plugins/index.ts | |||
@@ -0,0 +1,6 @@ | |||
1 | export * from './client/index.js' | ||
2 | export * from './plugin-index/index.js' | ||
3 | export * from './server/index.js' | ||
4 | export * from './hook-type.enum.js' | ||
5 | export * from './plugin-package-json.model.js' | ||
6 | export * from './plugin.type.js' | ||
diff --git a/packages/models/src/plugins/plugin-index/index.ts b/packages/models/src/plugins/plugin-index/index.ts new file mode 100644 index 000000000..f53b88084 --- /dev/null +++ b/packages/models/src/plugins/plugin-index/index.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export * from './peertube-plugin-index-list.model.js' | ||
2 | export * from './peertube-plugin-index.model.js' | ||
3 | export * from './peertube-plugin-latest-version.model.js' | ||
diff --git a/packages/models/src/plugins/plugin-index/peertube-plugin-index-list.model.ts b/packages/models/src/plugins/plugin-index/peertube-plugin-index-list.model.ts new file mode 100644 index 000000000..98301bbc1 --- /dev/null +++ b/packages/models/src/plugins/plugin-index/peertube-plugin-index-list.model.ts | |||
@@ -0,0 +1,10 @@ | |||
1 | import { PluginType_Type } from '../plugin.type.js' | ||
2 | |||
3 | export interface PeertubePluginIndexList { | ||
4 | start: number | ||
5 | count: number | ||
6 | sort: string | ||
7 | pluginType?: PluginType_Type | ||
8 | currentPeerTubeEngine?: string | ||
9 | search?: string | ||
10 | } | ||
diff --git a/packages/models/src/plugins/plugin-index/peertube-plugin-index.model.ts b/packages/models/src/plugins/plugin-index/peertube-plugin-index.model.ts new file mode 100644 index 000000000..36dfef943 --- /dev/null +++ b/packages/models/src/plugins/plugin-index/peertube-plugin-index.model.ts | |||
@@ -0,0 +1,16 @@ | |||
1 | export interface PeerTubePluginIndex { | ||
2 | npmName: string | ||
3 | description: string | ||
4 | homepage: string | ||
5 | createdAt: Date | ||
6 | updatedAt: Date | ||
7 | |||
8 | popularity: number | ||
9 | |||
10 | latestVersion: string | ||
11 | |||
12 | official: boolean | ||
13 | |||
14 | name?: string | ||
15 | installed?: boolean | ||
16 | } | ||
diff --git a/packages/models/src/plugins/plugin-index/peertube-plugin-latest-version.model.ts b/packages/models/src/plugins/plugin-index/peertube-plugin-latest-version.model.ts new file mode 100644 index 000000000..811a64429 --- /dev/null +++ b/packages/models/src/plugins/plugin-index/peertube-plugin-latest-version.model.ts | |||
@@ -0,0 +1,10 @@ | |||
1 | export interface PeertubePluginLatestVersionRequest { | ||
2 | currentPeerTubeEngine?: string | ||
3 | |||
4 | npmNames: string[] | ||
5 | } | ||
6 | |||
7 | export type PeertubePluginLatestVersionResponse = { | ||
8 | npmName: string | ||
9 | latestVersion: string | null | ||
10 | }[] | ||
diff --git a/packages/models/src/plugins/plugin-package-json.model.ts b/packages/models/src/plugins/plugin-package-json.model.ts new file mode 100644 index 000000000..5b9ccec56 --- /dev/null +++ b/packages/models/src/plugins/plugin-package-json.model.ts | |||
@@ -0,0 +1,29 @@ | |||
1 | import { PluginClientScope } from './client/plugin-client-scope.type.js' | ||
2 | |||
3 | export type PluginTranslationPathsJSON = { | ||
4 | [ locale: string ]: string | ||
5 | } | ||
6 | |||
7 | export type ClientScriptJSON = { | ||
8 | script: string | ||
9 | scopes: PluginClientScope[] | ||
10 | } | ||
11 | |||
12 | export type PluginPackageJSON = { | ||
13 | name: string | ||
14 | version: string | ||
15 | description: string | ||
16 | engine: { peertube: string } | ||
17 | |||
18 | homepage: string | ||
19 | author: string | ||
20 | bugs: string | ||
21 | library: string | ||
22 | |||
23 | staticDirs: { [ name: string ]: string } | ||
24 | css: string[] | ||
25 | |||
26 | clientScripts: ClientScriptJSON[] | ||
27 | |||
28 | translations: PluginTranslationPathsJSON | ||
29 | } | ||
diff --git a/packages/models/src/plugins/plugin.type.ts b/packages/models/src/plugins/plugin.type.ts new file mode 100644 index 000000000..7d03012e6 --- /dev/null +++ b/packages/models/src/plugins/plugin.type.ts | |||
@@ -0,0 +1,6 @@ | |||
1 | export const PluginType = { | ||
2 | PLUGIN: 1, | ||
3 | THEME: 2 | ||
4 | } as const | ||
5 | |||
6 | export type PluginType_Type = typeof PluginType[keyof typeof PluginType] | ||
diff --git a/packages/models/src/plugins/server/api/index.ts b/packages/models/src/plugins/server/api/index.ts new file mode 100644 index 000000000..1e3842c46 --- /dev/null +++ b/packages/models/src/plugins/server/api/index.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export * from './install-plugin.model.js' | ||
2 | export * from './manage-plugin.model.js' | ||
3 | export * from './peertube-plugin.model.js' | ||
diff --git a/packages/models/src/plugins/server/api/install-plugin.model.ts b/packages/models/src/plugins/server/api/install-plugin.model.ts new file mode 100644 index 000000000..a1d009a00 --- /dev/null +++ b/packages/models/src/plugins/server/api/install-plugin.model.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | export interface InstallOrUpdatePlugin { | ||
2 | npmName?: string | ||
3 | pluginVersion?: string | ||
4 | path?: string | ||
5 | } | ||
diff --git a/packages/models/src/plugins/server/api/manage-plugin.model.ts b/packages/models/src/plugins/server/api/manage-plugin.model.ts new file mode 100644 index 000000000..612b3056c --- /dev/null +++ b/packages/models/src/plugins/server/api/manage-plugin.model.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export interface ManagePlugin { | ||
2 | npmName: string | ||
3 | } | ||
diff --git a/packages/models/src/plugins/server/api/peertube-plugin.model.ts b/packages/models/src/plugins/server/api/peertube-plugin.model.ts new file mode 100644 index 000000000..0bc1b095b --- /dev/null +++ b/packages/models/src/plugins/server/api/peertube-plugin.model.ts | |||
@@ -0,0 +1,16 @@ | |||
1 | import { PluginType_Type } from '../../plugin.type.js' | ||
2 | |||
3 | export interface PeerTubePlugin { | ||
4 | name: string | ||
5 | type: PluginType_Type | ||
6 | latestVersion: string | ||
7 | version: string | ||
8 | enabled: boolean | ||
9 | uninstalled: boolean | ||
10 | peertubeEngine: string | ||
11 | description: string | ||
12 | homepage: string | ||
13 | settings: { [ name: string ]: string } | ||
14 | createdAt: Date | ||
15 | updatedAt: Date | ||
16 | } | ||
diff --git a/packages/models/src/plugins/server/index.ts b/packages/models/src/plugins/server/index.ts new file mode 100644 index 000000000..04412318b --- /dev/null +++ b/packages/models/src/plugins/server/index.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | export * from './api/index.js' | ||
2 | export * from './managers/index.js' | ||
3 | export * from './settings/index.js' | ||
4 | export * from './plugin-constant-manager.model.js' | ||
5 | export * from './plugin-translation.model.js' | ||
6 | export * from './register-server-hook.model.js' | ||
7 | export * from './server-hook.model.js' | ||
diff --git a/packages/models/src/plugins/server/managers/index.ts b/packages/models/src/plugins/server/managers/index.ts new file mode 100644 index 000000000..2433dd9bf --- /dev/null +++ b/packages/models/src/plugins/server/managers/index.ts | |||
@@ -0,0 +1,9 @@ | |||
1 | |||
2 | export * from './plugin-playlist-privacy-manager.model.js' | ||
3 | export * from './plugin-settings-manager.model.js' | ||
4 | export * from './plugin-storage-manager.model.js' | ||
5 | export * from './plugin-transcoding-manager.model.js' | ||
6 | export * from './plugin-video-category-manager.model.js' | ||
7 | export * from './plugin-video-language-manager.model.js' | ||
8 | export * from './plugin-video-licence-manager.model.js' | ||
9 | export * from './plugin-video-privacy-manager.model.js' | ||
diff --git a/packages/models/src/plugins/server/managers/plugin-playlist-privacy-manager.model.ts b/packages/models/src/plugins/server/managers/plugin-playlist-privacy-manager.model.ts new file mode 100644 index 000000000..212c910c5 --- /dev/null +++ b/packages/models/src/plugins/server/managers/plugin-playlist-privacy-manager.model.ts | |||
@@ -0,0 +1,12 @@ | |||
1 | import { VideoPlaylistPrivacyType } from '../../../videos/playlist/video-playlist-privacy.model.js' | ||
2 | import { ConstantManager } from '../plugin-constant-manager.model.js' | ||
3 | |||
4 | export interface PluginPlaylistPrivacyManager extends ConstantManager<VideoPlaylistPrivacyType> { | ||
5 | /** | ||
6 | * PUBLIC = 1, | ||
7 | * UNLISTED = 2, | ||
8 | * PRIVATE = 3 | ||
9 | * @deprecated use `deleteConstant` instead | ||
10 | */ | ||
11 | deletePlaylistPrivacy: (privacyKey: VideoPlaylistPrivacyType) => boolean | ||
12 | } | ||
diff --git a/packages/models/src/plugins/server/managers/plugin-settings-manager.model.ts b/packages/models/src/plugins/server/managers/plugin-settings-manager.model.ts new file mode 100644 index 000000000..b628718dd --- /dev/null +++ b/packages/models/src/plugins/server/managers/plugin-settings-manager.model.ts | |||
@@ -0,0 +1,17 @@ | |||
1 | export type SettingValue = string | boolean | ||
2 | |||
3 | export interface SettingEntries { | ||
4 | [settingName: string]: SettingValue | ||
5 | } | ||
6 | |||
7 | export type SettingsChangeCallback = (settings: SettingEntries) => Promise<any> | ||
8 | |||
9 | export interface PluginSettingsManager { | ||
10 | getSetting: (name: string) => Promise<SettingValue> | ||
11 | |||
12 | getSettings: (names: string[]) => Promise<SettingEntries> | ||
13 | |||
14 | setSetting: (name: string, value: SettingValue) => Promise<any> | ||
15 | |||
16 | onSettingsChange: (cb: SettingsChangeCallback) => void | ||
17 | } | ||
diff --git a/packages/models/src/plugins/server/managers/plugin-storage-manager.model.ts b/packages/models/src/plugins/server/managers/plugin-storage-manager.model.ts new file mode 100644 index 000000000..51567044a --- /dev/null +++ b/packages/models/src/plugins/server/managers/plugin-storage-manager.model.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | export interface PluginStorageManager { | ||
2 | getData: (key: string) => Promise<string> | ||
3 | |||
4 | storeData: (key: string, data: any) => Promise<any> | ||
5 | } | ||
diff --git a/packages/models/src/plugins/server/managers/plugin-transcoding-manager.model.ts b/packages/models/src/plugins/server/managers/plugin-transcoding-manager.model.ts new file mode 100644 index 000000000..235f5c65d --- /dev/null +++ b/packages/models/src/plugins/server/managers/plugin-transcoding-manager.model.ts | |||
@@ -0,0 +1,13 @@ | |||
1 | import { EncoderOptionsBuilder } from '../../../videos/transcoding/index.js' | ||
2 | |||
3 | export interface PluginTranscodingManager { | ||
4 | addLiveProfile (encoder: string, profile: string, builder: EncoderOptionsBuilder): boolean | ||
5 | |||
6 | addVODProfile (encoder: string, profile: string, builder: EncoderOptionsBuilder): boolean | ||
7 | |||
8 | addLiveEncoderPriority (streamType: 'audio' | 'video', encoder: string, priority: number): void | ||
9 | |||
10 | addVODEncoderPriority (streamType: 'audio' | 'video', encoder: string, priority: number): void | ||
11 | |||
12 | removeAllProfilesAndEncoderPriorities(): void | ||
13 | } | ||
diff --git a/packages/models/src/plugins/server/managers/plugin-video-category-manager.model.ts b/packages/models/src/plugins/server/managers/plugin-video-category-manager.model.ts new file mode 100644 index 000000000..9da691e11 --- /dev/null +++ b/packages/models/src/plugins/server/managers/plugin-video-category-manager.model.ts | |||
@@ -0,0 +1,13 @@ | |||
1 | import { ConstantManager } from '../plugin-constant-manager.model.js' | ||
2 | |||
3 | export interface PluginVideoCategoryManager extends ConstantManager<number> { | ||
4 | /** | ||
5 | * @deprecated use `addConstant` instead | ||
6 | */ | ||
7 | addCategory: (categoryKey: number, categoryLabel: string) => boolean | ||
8 | |||
9 | /** | ||
10 | * @deprecated use `deleteConstant` instead | ||
11 | */ | ||
12 | deleteCategory: (categoryKey: number) => boolean | ||
13 | } | ||
diff --git a/packages/models/src/plugins/server/managers/plugin-video-language-manager.model.ts b/packages/models/src/plugins/server/managers/plugin-video-language-manager.model.ts new file mode 100644 index 000000000..712486075 --- /dev/null +++ b/packages/models/src/plugins/server/managers/plugin-video-language-manager.model.ts | |||
@@ -0,0 +1,13 @@ | |||
1 | import { ConstantManager } from '../plugin-constant-manager.model.js' | ||
2 | |||
3 | export interface PluginVideoLanguageManager extends ConstantManager<string> { | ||
4 | /** | ||
5 | * @deprecated use `addConstant` instead | ||
6 | */ | ||
7 | addLanguage: (languageKey: string, languageLabel: string) => boolean | ||
8 | |||
9 | /** | ||
10 | * @deprecated use `deleteConstant` instead | ||
11 | */ | ||
12 | deleteLanguage: (languageKey: string) => boolean | ||
13 | } | ||
diff --git a/packages/models/src/plugins/server/managers/plugin-video-licence-manager.model.ts b/packages/models/src/plugins/server/managers/plugin-video-licence-manager.model.ts new file mode 100644 index 000000000..cebae8d95 --- /dev/null +++ b/packages/models/src/plugins/server/managers/plugin-video-licence-manager.model.ts | |||
@@ -0,0 +1,13 @@ | |||
1 | import { ConstantManager } from '../plugin-constant-manager.model.js' | ||
2 | |||
3 | export interface PluginVideoLicenceManager extends ConstantManager<number> { | ||
4 | /** | ||
5 | * @deprecated use `addConstant` instead | ||
6 | */ | ||
7 | addLicence: (licenceKey: number, licenceLabel: string) => boolean | ||
8 | |||
9 | /** | ||
10 | * @deprecated use `deleteConstant` instead | ||
11 | */ | ||
12 | deleteLicence: (licenceKey: number) => boolean | ||
13 | } | ||
diff --git a/packages/models/src/plugins/server/managers/plugin-video-privacy-manager.model.ts b/packages/models/src/plugins/server/managers/plugin-video-privacy-manager.model.ts new file mode 100644 index 000000000..260cee683 --- /dev/null +++ b/packages/models/src/plugins/server/managers/plugin-video-privacy-manager.model.ts | |||
@@ -0,0 +1,13 @@ | |||
1 | import { VideoPrivacyType } from '../../../videos/video-privacy.enum.js' | ||
2 | import { ConstantManager } from '../plugin-constant-manager.model.js' | ||
3 | |||
4 | export interface PluginVideoPrivacyManager extends ConstantManager<VideoPrivacyType> { | ||
5 | /** | ||
6 | * PUBLIC = 1, | ||
7 | * UNLISTED = 2, | ||
8 | * PRIVATE = 3 | ||
9 | * INTERNAL = 4 | ||
10 | * @deprecated use `deleteConstant` instead | ||
11 | */ | ||
12 | deletePrivacy: (privacyKey: VideoPrivacyType) => boolean | ||
13 | } | ||
diff --git a/packages/models/src/plugins/server/plugin-constant-manager.model.ts b/packages/models/src/plugins/server/plugin-constant-manager.model.ts new file mode 100644 index 000000000..4de3ce38f --- /dev/null +++ b/packages/models/src/plugins/server/plugin-constant-manager.model.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | export interface ConstantManager <K extends string | number> { | ||
2 | addConstant: (key: K, label: string) => boolean | ||
3 | deleteConstant: (key: K) => boolean | ||
4 | getConstantValue: (key: K) => string | ||
5 | getConstants: () => Record<K, string> | ||
6 | resetConstants: () => void | ||
7 | } | ||
diff --git a/packages/models/src/plugins/server/plugin-translation.model.ts b/packages/models/src/plugins/server/plugin-translation.model.ts new file mode 100644 index 000000000..a2dd8e560 --- /dev/null +++ b/packages/models/src/plugins/server/plugin-translation.model.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | export type PluginTranslation = { | ||
2 | [ npmName: string ]: { | ||
3 | [ key: string ]: string | ||
4 | } | ||
5 | } | ||
diff --git a/packages/models/src/plugins/server/register-server-hook.model.ts b/packages/models/src/plugins/server/register-server-hook.model.ts new file mode 100644 index 000000000..05c883f1f --- /dev/null +++ b/packages/models/src/plugins/server/register-server-hook.model.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | import { ServerHookName } from './server-hook.model.js' | ||
2 | |||
3 | export interface RegisterServerHookOptions { | ||
4 | target: ServerHookName | ||
5 | handler: Function | ||
6 | priority?: number | ||
7 | } | ||
diff --git a/packages/models/src/plugins/server/server-hook.model.ts b/packages/models/src/plugins/server/server-hook.model.ts new file mode 100644 index 000000000..cf387ffd7 --- /dev/null +++ b/packages/models/src/plugins/server/server-hook.model.ts | |||
@@ -0,0 +1,221 @@ | |||
1 | // {hookType}:{root}.{location}.{subLocation?}.{actionType}.{target} | ||
2 | |||
3 | export const serverFilterHookObject = { | ||
4 | // Filter params/result used to list videos for the REST API | ||
5 | // (used by the trending page, recently-added page, local page etc) | ||
6 | 'filter:api.videos.list.params': true, | ||
7 | 'filter:api.videos.list.result': true, | ||
8 | |||
9 | // Filter params/result used to list a video playlists videos | ||
10 | // for the REST API | ||
11 | 'filter:api.video-playlist.videos.list.params': true, | ||
12 | 'filter:api.video-playlist.videos.list.result': true, | ||
13 | |||
14 | // Filter params/result used to list account videos for the REST API | ||
15 | 'filter:api.accounts.videos.list.params': true, | ||
16 | 'filter:api.accounts.videos.list.result': true, | ||
17 | |||
18 | // Filter params/result used to list channel videos for the REST API | ||
19 | 'filter:api.video-channels.videos.list.params': true, | ||
20 | 'filter:api.video-channels.videos.list.result': true, | ||
21 | |||
22 | // Filter params/result used to list my user videos for the REST API | ||
23 | 'filter:api.user.me.videos.list.params': true, | ||
24 | 'filter:api.user.me.videos.list.result': true, | ||
25 | |||
26 | // Filter params/result used to list overview videos for the REST API | ||
27 | 'filter:api.overviews.videos.list.params': true, | ||
28 | 'filter:api.overviews.videos.list.result': true, | ||
29 | |||
30 | // Filter params/result used to list subscription videos for the REST API | ||
31 | 'filter:api.user.me.subscription-videos.list.params': true, | ||
32 | 'filter:api.user.me.subscription-videos.list.result': true, | ||
33 | |||
34 | // Filter params/results to search videos/channels in the DB or on the remote index | ||
35 | 'filter:api.search.videos.local.list.params': true, | ||
36 | 'filter:api.search.videos.local.list.result': true, | ||
37 | 'filter:api.search.videos.index.list.params': true, | ||
38 | 'filter:api.search.videos.index.list.result': true, | ||
39 | 'filter:api.search.video-channels.local.list.params': true, | ||
40 | 'filter:api.search.video-channels.local.list.result': true, | ||
41 | 'filter:api.search.video-channels.index.list.params': true, | ||
42 | 'filter:api.search.video-channels.index.list.result': true, | ||
43 | 'filter:api.search.video-playlists.local.list.params': true, | ||
44 | 'filter:api.search.video-playlists.local.list.result': true, | ||
45 | 'filter:api.search.video-playlists.index.list.params': true, | ||
46 | 'filter:api.search.video-playlists.index.list.result': true, | ||
47 | |||
48 | // Filter the result of the get function | ||
49 | // Used to get detailed video information (video watch page for example) | ||
50 | 'filter:api.video.get.result': true, | ||
51 | |||
52 | // Filter params/results when listing video channels | ||
53 | 'filter:api.video-channels.list.params': true, | ||
54 | 'filter:api.video-channels.list.result': true, | ||
55 | |||
56 | // Filter the result when getting a video channel | ||
57 | 'filter:api.video-channel.get.result': true, | ||
58 | |||
59 | // Filter the result of the accept upload/live, import via torrent/url functions | ||
60 | // If this function returns false then the upload is aborted with an error | ||
61 | 'filter:api.video.upload.accept.result': true, | ||
62 | 'filter:api.live-video.create.accept.result': true, | ||
63 | 'filter:api.video.pre-import-url.accept.result': true, | ||
64 | 'filter:api.video.pre-import-torrent.accept.result': true, | ||
65 | 'filter:api.video.post-import-url.accept.result': true, | ||
66 | 'filter:api.video.post-import-torrent.accept.result': true, | ||
67 | 'filter:api.video.update-file.accept.result': true, | ||
68 | // Filter the result of the accept comment (thread or reply) functions | ||
69 | // If the functions return false then the user cannot post its comment | ||
70 | 'filter:api.video-thread.create.accept.result': true, | ||
71 | 'filter:api.video-comment-reply.create.accept.result': true, | ||
72 | |||
73 | // Filter attributes when creating video object | ||
74 | 'filter:api.video.upload.video-attribute.result': true, | ||
75 | 'filter:api.video.import-url.video-attribute.result': true, | ||
76 | 'filter:api.video.import-torrent.video-attribute.result': true, | ||
77 | 'filter:api.video.live.video-attribute.result': true, | ||
78 | |||
79 | // Filter params/result used to list threads of a specific video | ||
80 | // (used by the video watch page) | ||
81 | 'filter:api.video-threads.list.params': true, | ||
82 | 'filter:api.video-threads.list.result': true, | ||
83 | |||
84 | // Filter params/result used to list replies of a specific thread | ||
85 | // (used by the video watch page when we click on the "View replies" button) | ||
86 | 'filter:api.video-thread-comments.list.params': true, | ||
87 | 'filter:api.video-thread-comments.list.result': true, | ||
88 | |||
89 | // Filter get stats result | ||
90 | 'filter:api.server.stats.get.result': true, | ||
91 | |||
92 | // Filter result used to check if we need to auto blacklist a video | ||
93 | // (fired when a local or remote video is created or updated) | ||
94 | 'filter:video.auto-blacklist.result': true, | ||
95 | |||
96 | // Filter result used to check if a user can register on the instance | ||
97 | 'filter:api.user.signup.allowed.result': true, | ||
98 | |||
99 | // Filter result used to check if a user can send a registration request on the instance | ||
100 | // PeerTube >= 5.1 | ||
101 | 'filter:api.user.request-signup.allowed.result': true, | ||
102 | |||
103 | // Filter result used to check if video/torrent download is allowed | ||
104 | 'filter:api.download.video.allowed.result': true, | ||
105 | 'filter:api.download.torrent.allowed.result': true, | ||
106 | |||
107 | // Filter result to check if the embed is allowed for a particular request | ||
108 | 'filter:html.embed.video.allowed.result': true, | ||
109 | 'filter:html.embed.video-playlist.allowed.result': true, | ||
110 | |||
111 | // Peertube >= 5.2 | ||
112 | 'filter:html.client.json-ld.result': true, | ||
113 | |||
114 | 'filter:job-queue.process.params': true, | ||
115 | 'filter:job-queue.process.result': true, | ||
116 | |||
117 | 'filter:transcoding.manual.resolutions-to-transcode.result': true, | ||
118 | 'filter:transcoding.auto.resolutions-to-transcode.result': true, | ||
119 | |||
120 | 'filter:activity-pub.remote-video-comment.create.accept.result': true, | ||
121 | |||
122 | 'filter:activity-pub.activity.context.build.result': true, | ||
123 | |||
124 | // Filter the result of video JSON LD builder | ||
125 | // You may also need to use filter:activity-pub.activity.context.build.result to also update JSON LD context | ||
126 | 'filter:activity-pub.video.json-ld.build.result': true, | ||
127 | |||
128 | // Filter result to allow custom XMLNS definitions in podcast RSS feeds | ||
129 | // Peertube >= 5.2 | ||
130 | 'filter:feed.podcast.rss.create-custom-xmlns.result': true, | ||
131 | |||
132 | // Filter result to allow custom tags in podcast RSS feeds | ||
133 | // Peertube >= 5.2 | ||
134 | 'filter:feed.podcast.channel.create-custom-tags.result': true, | ||
135 | // Peertube >= 5.2 | ||
136 | 'filter:feed.podcast.video.create-custom-tags.result': true | ||
137 | } | ||
138 | |||
139 | export type ServerFilterHookName = keyof typeof serverFilterHookObject | ||
140 | |||
141 | export const serverActionHookObject = { | ||
142 | // Fired when the application has been loaded and is listening HTTP requests | ||
143 | 'action:application.listening': true, | ||
144 | |||
145 | // Fired when a new notification is created | ||
146 | 'action:notifier.notification.created': true, | ||
147 | |||
148 | // API actions hooks give access to the original express `req` and `res` parameters | ||
149 | |||
150 | // Fired when a local video is updated | ||
151 | 'action:api.video.updated': true, | ||
152 | // Fired when a local video is deleted | ||
153 | 'action:api.video.deleted': true, | ||
154 | // Fired when a local video is uploaded | ||
155 | 'action:api.video.uploaded': true, | ||
156 | // Fired when a local video is viewed | ||
157 | 'action:api.video.viewed': true, | ||
158 | |||
159 | // Fired when a local video file has been replaced by a new one | ||
160 | 'action:api.video.file-updated': true, | ||
161 | |||
162 | // Fired when a video channel is created | ||
163 | 'action:api.video-channel.created': true, | ||
164 | // Fired when a video channel is updated | ||
165 | 'action:api.video-channel.updated': true, | ||
166 | // Fired when a video channel is deleted | ||
167 | 'action:api.video-channel.deleted': true, | ||
168 | |||
169 | // Fired when a live video is created | ||
170 | 'action:api.live-video.created': true, | ||
171 | // Fired when a live video starts or ends | ||
172 | // Peertube >= 5.2 | ||
173 | 'action:live.video.state.updated': true, | ||
174 | |||
175 | // Fired when a thread is created | ||
176 | 'action:api.video-thread.created': true, | ||
177 | // Fired when a reply to a thread is created | ||
178 | 'action:api.video-comment-reply.created': true, | ||
179 | // Fired when a comment (thread or reply) is deleted | ||
180 | 'action:api.video-comment.deleted': true, | ||
181 | |||
182 | // Fired when a caption is created | ||
183 | 'action:api.video-caption.created': true, | ||
184 | // Fired when a caption is deleted | ||
185 | 'action:api.video-caption.deleted': true, | ||
186 | |||
187 | // Fired when a user is blocked (banned) | ||
188 | 'action:api.user.blocked': true, | ||
189 | // Fired when a user is unblocked (unbanned) | ||
190 | 'action:api.user.unblocked': true, | ||
191 | // Fired when a user registered on the instance | ||
192 | 'action:api.user.registered': true, | ||
193 | // Fired when a user requested registration on the instance | ||
194 | // PeerTube >= 5.1 | ||
195 | 'action:api.user.requested-registration': true, | ||
196 | // Fired when an admin/moderator created a user | ||
197 | 'action:api.user.created': true, | ||
198 | // Fired when a user is removed by an admin/moderator | ||
199 | 'action:api.user.deleted': true, | ||
200 | // Fired when a user is updated by an admin/moderator | ||
201 | 'action:api.user.updated': true, | ||
202 | |||
203 | // Fired when a user got a new oauth2 token | ||
204 | 'action:api.user.oauth2-got-token': true, | ||
205 | |||
206 | // Fired when a video is added to a playlist | ||
207 | 'action:api.video-playlist-element.created': true, | ||
208 | |||
209 | // Fired when a remote video has been created/updated | ||
210 | 'action:activity-pub.remote-video.created': true, | ||
211 | 'action:activity-pub.remote-video.updated': true | ||
212 | } | ||
213 | |||
214 | export type ServerActionHookName = keyof typeof serverActionHookObject | ||
215 | |||
216 | export const serverHookObject = Object.assign({}, serverFilterHookObject, serverActionHookObject) | ||
217 | export type ServerHookName = keyof typeof serverHookObject | ||
218 | |||
219 | export interface ServerHook { | ||
220 | runHook <T> (hookName: ServerHookName, result?: T, params?: any): Promise<T> | ||
221 | } | ||
diff --git a/packages/models/src/plugins/server/settings/index.ts b/packages/models/src/plugins/server/settings/index.ts new file mode 100644 index 000000000..4bdccaa4a --- /dev/null +++ b/packages/models/src/plugins/server/settings/index.ts | |||
@@ -0,0 +1,2 @@ | |||
1 | export * from './public-server.setting.js' | ||
2 | export * from './register-server-setting.model.js' | ||
diff --git a/packages/models/src/plugins/server/settings/public-server.setting.ts b/packages/models/src/plugins/server/settings/public-server.setting.ts new file mode 100644 index 000000000..0b6251aa3 --- /dev/null +++ b/packages/models/src/plugins/server/settings/public-server.setting.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | import { SettingEntries } from '../managers/plugin-settings-manager.model.js' | ||
2 | |||
3 | export interface PublicServerSetting { | ||
4 | publicSettings: SettingEntries | ||
5 | } | ||
diff --git a/packages/models/src/plugins/server/settings/register-server-setting.model.ts b/packages/models/src/plugins/server/settings/register-server-setting.model.ts new file mode 100644 index 000000000..8cde8eaaa --- /dev/null +++ b/packages/models/src/plugins/server/settings/register-server-setting.model.ts | |||
@@ -0,0 +1,12 @@ | |||
1 | import { RegisterClientFormFieldOptions } from '../../client/index.js' | ||
2 | |||
3 | export type RegisterServerSettingOptions = RegisterClientFormFieldOptions & { | ||
4 | // If the setting is not private, anyone can view its value (client code included) | ||
5 | // If the setting is private, only server-side hooks can access it | ||
6 | // Mainly used by the PeerTube client to get admin config | ||
7 | private: boolean | ||
8 | } | ||
9 | |||
10 | export interface RegisteredServerSettings { | ||
11 | registeredSettings: RegisterServerSettingOptions[] | ||
12 | } | ||