From ba211e7386bb2f25e37a4c5bcdfeb4237e1cd315 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 26 Jul 2019 09:35:43 +0200 Subject: Add public settings endpoint --- .../plugin-show-installed/plugin-show-installed.component.ts | 2 +- client/src/app/+admin/plugins/shared/plugin-api.service.ts | 4 ++-- client/src/app/core/plugins/plugin.service.ts | 7 ++++--- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'client') 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 this.pluginService.getPlugin(npmName) .pipe(switchMap(plugin => { return this.pluginService.getPluginRegisteredSettings(plugin.name, plugin.type) - .pipe(map(data => ({ plugin, registeredSettings: data.settings }))) + .pipe(map(data => ({ plugin, registeredSettings: data.registeredSettings }))) })) .subscribe( ({ 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' import { ManagePlugin } from '@shared/models/plugins/manage-plugin.model' import { InstallOrUpdatePlugin } from '@shared/models/plugins/install-plugin.model' import { PeerTubePluginIndex } from '@shared/models/plugins/peertube-plugin-index.model' -import { RegisterServerSettingOptions } from '@shared/models/plugins/register-server-setting.model' +import { RegisteredServerSettings, RegisterServerSettingOptions } from '@shared/models/plugins/register-server-setting.model' import { PluginService } from '@app/core/plugins/plugin.service' @Injectable() @@ -91,7 +91,7 @@ export class PluginApiService { const npmName = this.pluginService.nameToNpmName(pluginName, pluginType) const path = PluginApiService.BASE_PLUGIN_URL + '/' + npmName + '/registered-settings' - return this.authHttp.get<{ settings: RegisterServerSettingOptions[] }>(path) + return this.authHttp.get(path) .pipe(catchError(res => this.restExtractor.handleError(res))) } 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' import { HttpClient } from '@angular/common/http' import { RestExtractor } from '@app/shared/rest' import { PluginType } from '@shared/models/plugins/plugin.type' +import { PublicServerSetting } from '@shared/models/plugins/public-server.setting' interface HookStructValue extends RegisterClientHookOptions { plugin: ServerConfigPlugin @@ -241,11 +242,11 @@ export class PluginService implements ClientHook { getSettings: () => { const npmName = this.nameToNpmName(pluginInfo.plugin.name, pluginInfo.pluginType) - const path = PluginService.BASE_PLUGIN_URL + '/' + npmName + const path = PluginService.BASE_PLUGIN_URL + '/' + npmName + '/public-settings' - return this.authHttp.get(path) + return this.authHttp.get(path) .pipe( - map(p => p.settings), + map(p => p.publicSettings), catchError(res => this.restExtractor.handleError(res)) ) .toPromise() -- cgit v1.2.3