diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-26 09:35:43 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-07-26 15:18:29 +0200 |
commit | ba211e7386bb2f25e37a4c5bcdfeb4237e1cd315 (patch) | |
tree | 398bb14a92c7df3765a0a64bac9f4672c5588488 /client/src/app | |
parent | 23bdacf8ec24ce47a15529830e116911d7478598 (diff) | |
download | PeerTube-ba211e7386bb2f25e37a4c5bcdfeb4237e1cd315.tar.gz PeerTube-ba211e7386bb2f25e37a4c5bcdfeb4237e1cd315.tar.zst PeerTube-ba211e7386bb2f25e37a4c5bcdfeb4237e1cd315.zip |
Add public settings endpoint
Diffstat (limited to 'client/src/app')
3 files changed, 7 insertions, 6 deletions
diff --git a/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts b/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts index 569d98482..13d12b145 100644 --- a/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts +++ b/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts | |||
@@ -66,7 +66,7 @@ export class PluginShowInstalledComponent extends FormReactive implements OnInit | |||
66 | this.pluginService.getPlugin(npmName) | 66 | this.pluginService.getPlugin(npmName) |
67 | .pipe(switchMap(plugin => { | 67 | .pipe(switchMap(plugin => { |
68 | return this.pluginService.getPluginRegisteredSettings(plugin.name, plugin.type) | 68 | return this.pluginService.getPluginRegisteredSettings(plugin.name, plugin.type) |
69 | .pipe(map(data => ({ plugin, registeredSettings: data.settings }))) | 69 | .pipe(map(data => ({ plugin, registeredSettings: data.registeredSettings }))) |
70 | })) | 70 | })) |
71 | .subscribe( | 71 | .subscribe( |
72 | ({ plugin, registeredSettings }) => { | 72 | ({ plugin, registeredSettings }) => { |
diff --git a/client/src/app/+admin/plugins/shared/plugin-api.service.ts b/client/src/app/+admin/plugins/shared/plugin-api.service.ts index 343eb57b2..c360fc1b3 100644 --- a/client/src/app/+admin/plugins/shared/plugin-api.service.ts +++ b/client/src/app/+admin/plugins/shared/plugin-api.service.ts | |||
@@ -11,7 +11,7 @@ import { PeerTubePlugin } from '@shared/models/plugins/peertube-plugin.model' | |||
11 | import { ManagePlugin } from '@shared/models/plugins/manage-plugin.model' | 11 | import { ManagePlugin } from '@shared/models/plugins/manage-plugin.model' |
12 | import { InstallOrUpdatePlugin } from '@shared/models/plugins/install-plugin.model' | 12 | import { InstallOrUpdatePlugin } from '@shared/models/plugins/install-plugin.model' |
13 | import { PeerTubePluginIndex } from '@shared/models/plugins/peertube-plugin-index.model' | 13 | import { PeerTubePluginIndex } from '@shared/models/plugins/peertube-plugin-index.model' |
14 | import { RegisterServerSettingOptions } from '@shared/models/plugins/register-server-setting.model' | 14 | import { RegisteredServerSettings, RegisterServerSettingOptions } from '@shared/models/plugins/register-server-setting.model' |
15 | import { PluginService } from '@app/core/plugins/plugin.service' | 15 | import { PluginService } from '@app/core/plugins/plugin.service' |
16 | 16 | ||
17 | @Injectable() | 17 | @Injectable() |
@@ -91,7 +91,7 @@ export class PluginApiService { | |||
91 | const npmName = this.pluginService.nameToNpmName(pluginName, pluginType) | 91 | const npmName = this.pluginService.nameToNpmName(pluginName, pluginType) |
92 | const path = PluginApiService.BASE_PLUGIN_URL + '/' + npmName + '/registered-settings' | 92 | const path = PluginApiService.BASE_PLUGIN_URL + '/' + npmName + '/registered-settings' |
93 | 93 | ||
94 | return this.authHttp.get<{ settings: RegisterServerSettingOptions[] }>(path) | 94 | return this.authHttp.get<RegisteredServerSettings>(path) |
95 | .pipe(catchError(res => this.restExtractor.handleError(res))) | 95 | .pipe(catchError(res => this.restExtractor.handleError(res))) |
96 | } | 96 | } |
97 | 97 | ||
diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts index 45d8088a4..714abd82d 100644 --- a/client/src/app/core/plugins/plugin.service.ts +++ b/client/src/app/core/plugins/plugin.service.ts | |||
@@ -15,6 +15,7 @@ import { PeerTubePlugin } from '@shared/models/plugins/peertube-plugin.model' | |||
15 | import { HttpClient } from '@angular/common/http' | 15 | import { HttpClient } from '@angular/common/http' |
16 | import { RestExtractor } from '@app/shared/rest' | 16 | import { RestExtractor } from '@app/shared/rest' |
17 | import { PluginType } from '@shared/models/plugins/plugin.type' | 17 | import { PluginType } from '@shared/models/plugins/plugin.type' |
18 | import { PublicServerSetting } from '@shared/models/plugins/public-server.setting' | ||
18 | 19 | ||
19 | interface HookStructValue extends RegisterClientHookOptions { | 20 | interface HookStructValue extends RegisterClientHookOptions { |
20 | plugin: ServerConfigPlugin | 21 | plugin: ServerConfigPlugin |
@@ -241,11 +242,11 @@ export class PluginService implements ClientHook { | |||
241 | 242 | ||
242 | getSettings: () => { | 243 | getSettings: () => { |
243 | const npmName = this.nameToNpmName(pluginInfo.plugin.name, pluginInfo.pluginType) | 244 | const npmName = this.nameToNpmName(pluginInfo.plugin.name, pluginInfo.pluginType) |
244 | const path = PluginService.BASE_PLUGIN_URL + '/' + npmName | 245 | const path = PluginService.BASE_PLUGIN_URL + '/' + npmName + '/public-settings' |
245 | 246 | ||
246 | return this.authHttp.get<PeerTubePlugin>(path) | 247 | return this.authHttp.get<PublicServerSetting>(path) |
247 | .pipe( | 248 | .pipe( |
248 | map(p => p.settings), | 249 | map(p => p.publicSettings), |
249 | catchError(res => this.restExtractor.handleError(res)) | 250 | catchError(res => this.restExtractor.handleError(res)) |
250 | ) | 251 | ) |
251 | .toPromise() | 252 | .toPromise() |