aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/config.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-08 15:54:08 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-07-24 10:58:16 +0200
commit18a6f04c071f7a0735eb39b8c67fd51a082d1a31 (patch)
treeb9fb0637878390d32b5c73d02b8eee2ef48cbfa5 /server/controllers/api/config.ts
parent2c0539420d77339e6afe8d7920b44af4c0dcb1e6 (diff)
downloadPeerTube-18a6f04c071f7a0735eb39b8c67fd51a082d1a31.tar.gz
PeerTube-18a6f04c071f7a0735eb39b8c67fd51a082d1a31.tar.zst
PeerTube-18a6f04c071f7a0735eb39b8c67fd51a082d1a31.zip
WIP plugins: hook on client side
Diffstat (limited to 'server/controllers/api/config.ts')
-rw-r--r--server/controllers/api/config.ts19
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 @@
1import * as express from 'express' 1import * as express from 'express'
2import { snakeCase } from 'lodash' 2import { snakeCase } from 'lodash'
3import { ServerConfig, UserRight } from '../../../shared' 3import { ServerConfig, ServerConfigPlugin, UserRight } from '../../../shared'
4import { About } from '../../../shared/models/server/about.model' 4import { About } from '../../../shared/models/server/about.model'
5import { CustomConfig } from '../../../shared/models/server/custom-config.model' 5import { CustomConfig } from '../../../shared/models/server/custom-config.model'
6import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup' 6import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup'
@@ -15,6 +15,8 @@ import { Emailer } from '../../lib/emailer'
15import { isNumeric } from 'validator' 15import { isNumeric } from 'validator'
16import { objectConverter } from '../../helpers/core-utils' 16import { objectConverter } from '../../helpers/core-utils'
17import { CONFIG, reloadConfig } from '../../initializers/config' 17import { CONFIG, reloadConfig } from '../../initializers/config'
18import { PluginManager } from '../../lib/plugins/plugin-manager'
19import { PluginType } from '../../../shared/models/plugins/plugin.type'
18 20
19const packageJSON = require('../../../../package.json') 21const packageJSON = require('../../../../package.json')
20const configRouter = express.Router() 22const 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 },