diff options
author | Chocobozzz <me@florianbigard.com> | 2021-04-09 13:50:31 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-04-09 13:50:31 +0200 |
commit | 3c47fa3bc0e3f2362bb17976057287a7e9aba46b (patch) | |
tree | 0f74d23e219e7c917034d9cd394fabc4668f16fa /client/src/app/core | |
parent | c713017f3cd2d617da22c24c579342ec4121cfcd (diff) | |
download | PeerTube-3c47fa3bc0e3f2362bb17976057287a7e9aba46b.tar.gz PeerTube-3c47fa3bc0e3f2362bb17976057287a7e9aba46b.tar.zst PeerTube-3c47fa3bc0e3f2362bb17976057287a7e9aba46b.zip |
Add ability to hide plugin settings
Diffstat (limited to 'client/src/app/core')
-rw-r--r-- | client/src/app/core/plugins/plugin.service.ts | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts index c2dcf9fef..1243bac67 100644 --- a/client/src/app/core/plugins/plugin.service.ts +++ b/client/src/app/core/plugins/plugin.service.ts | |||
@@ -19,6 +19,7 @@ import { | |||
19 | PluginTranslation, | 19 | PluginTranslation, |
20 | PluginType, | 20 | PluginType, |
21 | PublicServerSetting, | 21 | PublicServerSetting, |
22 | RegisterClientSettingsScript, | ||
22 | ServerConfigPlugin | 23 | ServerConfigPlugin |
23 | } from '@shared/models' | 24 | } from '@shared/models' |
24 | import { environment } from '../../../environments/environment' | 25 | import { environment } from '../../../environments/environment' |
@@ -58,6 +59,7 @@ export class PluginService implements ClientHook { | |||
58 | private formFields: FormFields = { | 59 | private formFields: FormFields = { |
59 | video: [] | 60 | video: [] |
60 | } | 61 | } |
62 | private settingsScripts: { [ npmName: string ]: RegisterClientSettingsScript } = {} | ||
61 | 63 | ||
62 | constructor ( | 64 | constructor ( |
63 | private authService: AuthService, | 65 | private authService: AuthService, |
@@ -200,6 +202,10 @@ export class PluginService implements ClientHook { | |||
200 | return this.formFields.video.filter(f => f.videoFormOptions.type === type) | 202 | return this.formFields.video.filter(f => f.videoFormOptions.type === type) |
201 | } | 203 | } |
202 | 204 | ||
205 | getRegisteredSettingsScript (npmName: string) { | ||
206 | return this.settingsScripts[npmName] | ||
207 | } | ||
208 | |||
203 | translateBy (npmName: string, toTranslate: string) { | 209 | translateBy (npmName: string, toTranslate: string) { |
204 | const helpers = this.helpers[npmName] | 210 | const helpers = this.helpers[npmName] |
205 | if (!helpers) { | 211 | if (!helpers) { |
@@ -220,6 +226,7 @@ export class PluginService implements ClientHook { | |||
220 | return loadPlugin({ | 226 | return loadPlugin({ |
221 | hooks: this.hooks, | 227 | hooks: this.hooks, |
222 | formFields: this.formFields, | 228 | formFields: this.formFields, |
229 | onSettingsScripts: options => this.settingsScripts[npmName] = options, | ||
223 | pluginInfo, | 230 | pluginInfo, |
224 | peertubeHelpersFactory: () => helpers | 231 | peertubeHelpersFactory: () => helpers |
225 | }) | 232 | }) |