diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-08 15:54:08 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-07-24 10:58:16 +0200 |
commit | 18a6f04c071f7a0735eb39b8c67fd51a082d1a31 (patch) | |
tree | b9fb0637878390d32b5c73d02b8eee2ef48cbfa5 /server/controllers/api | |
parent | 2c0539420d77339e6afe8d7920b44af4c0dcb1e6 (diff) | |
download | PeerTube-18a6f04c071f7a0735eb39b8c67fd51a082d1a31.tar.gz PeerTube-18a6f04c071f7a0735eb39b8c67fd51a082d1a31.tar.zst PeerTube-18a6f04c071f7a0735eb39b8c67fd51a082d1a31.zip |
WIP plugins: hook on client side
Diffstat (limited to 'server/controllers/api')
-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 | }, |