aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
Diffstat (limited to 'server/models')
-rw-r--r--server/models/server/plugin.ts15
1 files changed, 14 insertions, 1 deletions
diff --git a/server/models/server/plugin.ts b/server/models/server/plugin.ts
index f39b97ef0..a15f9a7e2 100644
--- a/server/models/server/plugin.ts
+++ b/server/models/server/plugin.ts
@@ -10,7 +10,7 @@ import {
10import { PluginType } from '../../../shared/models/plugins/plugin.type' 10import { PluginType } from '../../../shared/models/plugins/plugin.type'
11import { PeerTubePlugin } from '../../../shared/models/plugins/peertube-plugin.model' 11import { PeerTubePlugin } from '../../../shared/models/plugins/peertube-plugin.model'
12import { FindAndCountOptions, json } from 'sequelize' 12import { FindAndCountOptions, json } from 'sequelize'
13import { PeerTubePluginIndex } from '../../../shared/models/plugins/peertube-plugin-index.model' 13import { RegisterServerSettingOptions } from '../../../shared/models/plugins/register-server-setting.model'
14 14
15@DefaultScope(() => ({ 15@DefaultScope(() => ({
16 attributes: { 16 attributes: {
@@ -238,6 +238,19 @@ export class PluginModel extends Model<PluginModel> {
238 return 'peertube-plugin-' + name 238 return 'peertube-plugin-' + name
239 } 239 }
240 240
241 getPublicSettings (registeredSettings: RegisterServerSettingOptions[]) {
242 const result: { [ name: string ]: string } = {}
243 const settings = this.settings || {}
244
245 for (const r of registeredSettings) {
246 if (r.private !== false) continue
247
248 result[r.name] = settings[r.name] || r.default || null
249 }
250
251 return result
252 }
253
241 toFormattedJSON (): PeerTubePlugin { 254 toFormattedJSON (): PeerTubePlugin {
242 return { 255 return {
243 name: this.name, 256 name: this.name,