diff options
author | lutangar <johan.dufour@gmail.com> | 2022-01-20 12:07:15 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2022-01-20 13:43:20 +0100 |
commit | d2d4a5a999746ae0f01a2ce89b844252346bab27 (patch) | |
tree | 428c6b0767c78398ce093b4969f59c3b174ed7e4 /shared/models/plugins/server | |
parent | 82b9a1005cd5f5d3c338270839a24f217594b35d (diff) | |
download | PeerTube-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/plugins/server')
-rw-r--r-- | shared/models/plugins/server/managers/plugin-settings-manager.model.ts | 16 | ||||
-rw-r--r-- | shared/models/plugins/server/settings/public-server.setting.ts | 4 |
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 @@ | |||
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 | |||
1 | export interface PluginSettingsManager { | 9 | export 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 @@ | |||
1 | import { SettingEntries } from '../managers/plugin-settings-manager.model' | ||
2 | |||
1 | export interface PublicServerSetting { | 3 | export interface PublicServerSetting { |
2 | publicSettings: { [ name: string ]: string } | 4 | publicSettings: SettingEntries |
3 | } | 5 | } |