From 174e0855873d7086ad8240599101c2f717ebbd59 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Tue, 17 Dec 2019 13:07:50 +0100 Subject: (nodeinfo) add server config to the nodeinfo metadata --- server/controllers/api/config.ts | 59 +++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 28 deletions(-) (limited to 'server/controllers/api') diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index c593fa302..b2f23c1b0 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts @@ -227,10 +227,40 @@ async function updateCustomConfig (req: express.Request, res: express.Response) return res.json(data).end() } +function getRegisteredThemes () { + return PluginManager.Instance.getRegisteredThemes() + .map(t => ({ + name: t.name, + version: t.version, + description: t.description, + css: t.css, + clientScripts: t.clientScripts + })) +} + +function getEnabledResolutions () { + return Object.keys(CONFIG.TRANSCODING.RESOLUTIONS) + .filter(key => CONFIG.TRANSCODING.ENABLED && CONFIG.TRANSCODING.RESOLUTIONS[ key ] === true) + .map(r => parseInt(r, 10)) +} + +function getRegisteredPlugins () { + return PluginManager.Instance.getRegisteredPlugins() + .map(p => ({ + name: p.name, + version: p.version, + description: p.description, + clientScripts: p.clientScripts + })) +} + // --------------------------------------------------------------------------- export { - configRouter + configRouter, + getEnabledResolutions, + getRegisteredPlugins, + getRegisteredThemes } // --------------------------------------------------------------------------- @@ -370,30 +400,3 @@ function convertCustomConfigBody (body: CustomConfig) { return objectConverter(body, keyConverter, valueConverter) } - -function getRegisteredThemes () { - return PluginManager.Instance.getRegisteredThemes() - .map(t => ({ - name: t.name, - version: t.version, - description: t.description, - css: t.css, - clientScripts: t.clientScripts - })) -} - -function getEnabledResolutions () { - return Object.keys(CONFIG.TRANSCODING.RESOLUTIONS) - .filter(key => CONFIG.TRANSCODING.ENABLED && CONFIG.TRANSCODING.RESOLUTIONS[ key ] === true) - .map(r => parseInt(r, 10)) -} - -function getRegisteredPlugins () { - return PluginManager.Instance.getRegisteredPlugins() - .map(p => ({ - name: p.name, - version: p.version, - description: p.description, - clientScripts: p.clientScripts - })) -} -- cgit v1.2.3