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 /server/models | |
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 'server/models')
-rw-r--r-- | server/models/server/plugin.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/server/models/server/plugin.ts b/server/models/server/plugin.ts index 84f7a14e4..05083e3f7 100644 --- a/server/models/server/plugin.ts +++ b/server/models/server/plugin.ts | |||
@@ -2,7 +2,7 @@ import { FindAndCountOptions, json, QueryTypes } from 'sequelize' | |||
2 | import { AllowNull, Column, CreatedAt, DataType, DefaultScope, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' | 2 | import { AllowNull, Column, CreatedAt, DataType, DefaultScope, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' |
3 | import { MPlugin, MPluginFormattable } from '@server/types/models' | 3 | import { MPlugin, MPluginFormattable } from '@server/types/models' |
4 | import { AttributesOnly } from '@shared/typescript-utils' | 4 | import { AttributesOnly } from '@shared/typescript-utils' |
5 | import { PeerTubePlugin, PluginType, RegisterServerSettingOptions } from '../../../shared/models' | 5 | import { PeerTubePlugin, PluginType, RegisterServerSettingOptions, SettingEntries, SettingValue } from '../../../shared/models' |
6 | import { | 6 | import { |
7 | isPluginDescriptionValid, | 7 | isPluginDescriptionValid, |
8 | isPluginHomepage, | 8 | isPluginHomepage, |
@@ -148,7 +148,7 @@ export class PluginModel extends Model<Partial<AttributesOnly<PluginModel>>> { | |||
148 | 148 | ||
149 | return PluginModel.findOne(query) | 149 | return PluginModel.findOne(query) |
150 | .then(p => { | 150 | .then(p => { |
151 | const result: { [settingName: string ]: string | boolean } = {} | 151 | const result: SettingEntries = {} |
152 | 152 | ||
153 | for (const name of settingNames) { | 153 | for (const name of settingNames) { |
154 | if (!p || !p.settings || p.settings[name] === undefined) { | 154 | if (!p || !p.settings || p.settings[name] === undefined) { |
@@ -166,7 +166,7 @@ export class PluginModel extends Model<Partial<AttributesOnly<PluginModel>>> { | |||
166 | }) | 166 | }) |
167 | } | 167 | } |
168 | 168 | ||
169 | static setSetting (pluginName: string, pluginType: PluginType, settingName: string, settingValue: string) { | 169 | static setSetting (pluginName: string, pluginType: PluginType, settingName: string, settingValue: SettingValue) { |
170 | const query = { | 170 | const query = { |
171 | where: { | 171 | where: { |
172 | name: pluginName, | 172 | name: pluginName, |
@@ -273,7 +273,7 @@ export class PluginModel extends Model<Partial<AttributesOnly<PluginModel>>> { | |||
273 | } | 273 | } |
274 | 274 | ||
275 | getPublicSettings (registeredSettings: RegisterServerSettingOptions[]) { | 275 | getPublicSettings (registeredSettings: RegisterServerSettingOptions[]) { |
276 | const result: { [ name: string ]: string } = {} | 276 | const result: SettingEntries = {} |
277 | const settings = this.settings || {} | 277 | const settings = this.settings || {} |
278 | 278 | ||
279 | for (const r of registeredSettings) { | 279 | for (const r of registeredSettings) { |