aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/lib/plugins/register-helpers.ts5
-rw-r--r--server/models/server/plugin.ts8
2 files changed, 7 insertions, 6 deletions
diff --git a/server/lib/plugins/register-helpers.ts b/server/lib/plugins/register-helpers.ts
index acca9309a..d1756040a 100644
--- a/server/lib/plugins/register-helpers.ts
+++ b/server/lib/plugins/register-helpers.ts
@@ -17,6 +17,7 @@ import {
17 RegisterServerHookOptions, 17 RegisterServerHookOptions,
18 RegisterServerSettingOptions, 18 RegisterServerSettingOptions,
19 serverHookObject, 19 serverHookObject,
20 SettingsChangeCallback,
20 VideoPlaylistPrivacy, 21 VideoPlaylistPrivacy,
21 VideoPrivacy 22 VideoPrivacy
22} from '@shared/models' 23} from '@shared/models'
@@ -46,7 +47,7 @@ export class RegisterHelpers {
46 private idAndPassAuths: RegisterServerAuthPassOptions[] = [] 47 private idAndPassAuths: RegisterServerAuthPassOptions[] = []
47 private externalAuths: RegisterServerAuthExternalOptions[] = [] 48 private externalAuths: RegisterServerAuthExternalOptions[] = []
48 49
49 private readonly onSettingsChangeCallbacks: ((settings: any) => Promise<any>)[] = [] 50 private readonly onSettingsChangeCallbacks: SettingsChangeCallback[] = []
50 51
51 private readonly router: express.Router 52 private readonly router: express.Router
52 private readonly videoConstantManagerFactory: VideoConstantManagerFactory 53 private readonly videoConstantManagerFactory: VideoConstantManagerFactory
@@ -256,7 +257,7 @@ export class RegisterHelpers {
256 257
257 setSetting: (name: string, value: string) => PluginModel.setSetting(this.plugin.name, this.plugin.type, name, value), 258 setSetting: (name: string, value: string) => PluginModel.setSetting(this.plugin.name, this.plugin.type, name, value),
258 259
259 onSettingsChange: (cb: (settings: any) => Promise<any>) => this.onSettingsChangeCallbacks.push(cb) 260 onSettingsChange: (cb: SettingsChangeCallback) => this.onSettingsChangeCallbacks.push(cb)
260 } 261 }
261 } 262 }
262 263
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'
2import { AllowNull, Column, CreatedAt, DataType, DefaultScope, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' 2import { AllowNull, Column, CreatedAt, DataType, DefaultScope, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'
3import { MPlugin, MPluginFormattable } from '@server/types/models' 3import { MPlugin, MPluginFormattable } from '@server/types/models'
4import { AttributesOnly } from '@shared/typescript-utils' 4import { AttributesOnly } from '@shared/typescript-utils'
5import { PeerTubePlugin, PluginType, RegisterServerSettingOptions } from '../../../shared/models' 5import { PeerTubePlugin, PluginType, RegisterServerSettingOptions, SettingEntries, SettingValue } from '../../../shared/models'
6import { 6import {
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) {