aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/models
diff options
context:
space:
mode:
authorlutangar <johan.dufour@gmail.com>2022-01-20 12:07:15 +0100
committerChocobozzz <chocobozzz@cpy.re>2022-01-20 13:43:20 +0100
commitd2d4a5a999746ae0f01a2ce89b844252346bab27 (patch)
tree428c6b0767c78398ce093b4969f59c3b174ed7e4 /shared/models
parent82b9a1005cd5f5d3c338270839a24f217594b35d (diff)
downloadPeerTube-d2d4a5a999746ae0f01a2ce89b844252346bab27.tar.gz
PeerTube-d2d4a5a999746ae0f01a2ce89b844252346bab27.tar.zst
PeerTube-d2d4a5a999746ae0f01a2ce89b844252346bab27.zip
Fix plugin settings manager definition
This mainly fix the `onSettingsChange` argument typing. I'm not 100% sure the setting `value` can be a boolean though. But this is how it was typed before so I just made it consistent. Feel free to change - or suggest change - to the type names / location.
Diffstat (limited to 'shared/models')
-rw-r--r--shared/models/plugins/server/managers/plugin-settings-manager.model.ts16
-rw-r--r--shared/models/plugins/server/settings/public-server.setting.ts4
2 files changed, 15 insertions, 5 deletions
diff --git a/shared/models/plugins/server/managers/plugin-settings-manager.model.ts b/shared/models/plugins/server/managers/plugin-settings-manager.model.ts
index 3c28c0565..b628718dd 100644
--- a/shared/models/plugins/server/managers/plugin-settings-manager.model.ts
+++ b/shared/models/plugins/server/managers/plugin-settings-manager.model.ts
@@ -1,9 +1,17 @@
1export type SettingValue = string | boolean
2
3export interface SettingEntries {
4 [settingName: string]: SettingValue
5}
6
7export type SettingsChangeCallback = (settings: SettingEntries) => Promise<any>
8
1export interface PluginSettingsManager { 9export interface PluginSettingsManager {
2 getSetting: (name: string) => Promise<string | boolean> 10 getSetting: (name: string) => Promise<SettingValue>
3 11
4 getSettings: (names: string[]) => Promise<{ [settingName: string]: string | boolean }> 12 getSettings: (names: string[]) => Promise<SettingEntries>
5 13
6 setSetting: (name: string, value: string) => Promise<any> 14 setSetting: (name: string, value: SettingValue) => Promise<any>
7 15
8 onSettingsChange: (cb: (names: string[]) => Promise<any>) => void 16 onSettingsChange: (cb: SettingsChangeCallback) => void
9} 17}
diff --git a/shared/models/plugins/server/settings/public-server.setting.ts b/shared/models/plugins/server/settings/public-server.setting.ts
index 9802c4d7d..d38e5424a 100644
--- a/shared/models/plugins/server/settings/public-server.setting.ts
+++ b/shared/models/plugins/server/settings/public-server.setting.ts
@@ -1,3 +1,5 @@
1import { SettingEntries } from '../managers/plugin-settings-manager.model'
2
1export interface PublicServerSetting { 3export interface PublicServerSetting {
2 publicSettings: { [ name: string ]: string } 4 publicSettings: SettingEntries
3} 5}