diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/api/config.ts | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index 1d12f701b..8563b7437 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { snakeCase } from 'lodash' | 2 | import { snakeCase } from 'lodash' |
3 | import { ServerConfig, UserRight } from '../../../shared' | 3 | import { ServerConfig, ServerConfigPlugin, UserRight } from '../../../shared' |
4 | import { About } from '../../../shared/models/server/about.model' | 4 | import { About } from '../../../shared/models/server/about.model' |
5 | import { CustomConfig } from '../../../shared/models/server/custom-config.model' | 5 | import { CustomConfig } from '../../../shared/models/server/custom-config.model' |
6 | import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup' | 6 | import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup' |
@@ -15,6 +15,8 @@ import { Emailer } from '../../lib/emailer' | |||
15 | import { isNumeric } from 'validator' | 15 | import { isNumeric } from 'validator' |
16 | import { objectConverter } from '../../helpers/core-utils' | 16 | import { objectConverter } from '../../helpers/core-utils' |
17 | import { CONFIG, reloadConfig } from '../../initializers/config' | 17 | import { CONFIG, reloadConfig } from '../../initializers/config' |
18 | import { PluginManager } from '../../lib/plugins/plugin-manager' | ||
19 | import { PluginType } from '../../../shared/models/plugins/plugin.type' | ||
18 | 20 | ||
19 | const packageJSON = require('../../../../package.json') | 21 | const packageJSON = require('../../../../package.json') |
20 | const configRouter = express.Router() | 22 | const configRouter = express.Router() |
@@ -54,6 +56,20 @@ async function getConfig (req: express.Request, res: express.Response) { | |||
54 | .filter(key => CONFIG.TRANSCODING.ENABLED && CONFIG.TRANSCODING.RESOLUTIONS[key] === true) | 56 | .filter(key => CONFIG.TRANSCODING.ENABLED && CONFIG.TRANSCODING.RESOLUTIONS[key] === true) |
55 | .map(r => parseInt(r, 10)) | 57 | .map(r => parseInt(r, 10)) |
56 | 58 | ||
59 | const plugins: ServerConfigPlugin[] = [] | ||
60 | const registeredPlugins = PluginManager.Instance.getRegisteredPlugins() | ||
61 | for (const pluginName of Object.keys(registeredPlugins)) { | ||
62 | const plugin = registeredPlugins[ pluginName ] | ||
63 | if (plugin.type !== PluginType.PLUGIN) continue | ||
64 | |||
65 | plugins.push({ | ||
66 | name: plugin.name, | ||
67 | version: plugin.version, | ||
68 | description: plugin.description, | ||
69 | clientScripts: plugin.clientScripts | ||
70 | }) | ||
71 | } | ||
72 | |||
57 | const json: ServerConfig = { | 73 | const json: ServerConfig = { |
58 | instance: { | 74 | instance: { |
59 | name: CONFIG.INSTANCE.NAME, | 75 | name: CONFIG.INSTANCE.NAME, |
@@ -66,6 +82,7 @@ async function getConfig (req: express.Request, res: express.Response) { | |||
66 | css: CONFIG.INSTANCE.CUSTOMIZATIONS.CSS | 82 | css: CONFIG.INSTANCE.CUSTOMIZATIONS.CSS |
67 | } | 83 | } |
68 | }, | 84 | }, |
85 | plugins, | ||
69 | email: { | 86 | email: { |
70 | enabled: Emailer.isEnabled() | 87 | enabled: Emailer.isEnabled() |
71 | }, | 88 | }, |