diff options
Diffstat (limited to 'server/controllers/api/config.ts')
-rw-r--r-- | server/controllers/api/config.ts | 59 |
1 files changed, 31 insertions, 28 deletions
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) | |||
227 | return res.json(data).end() | 227 | return res.json(data).end() |
228 | } | 228 | } |
229 | 229 | ||
230 | function getRegisteredThemes () { | ||
231 | return PluginManager.Instance.getRegisteredThemes() | ||
232 | .map(t => ({ | ||
233 | name: t.name, | ||
234 | version: t.version, | ||
235 | description: t.description, | ||
236 | css: t.css, | ||
237 | clientScripts: t.clientScripts | ||
238 | })) | ||
239 | } | ||
240 | |||
241 | function getEnabledResolutions () { | ||
242 | return Object.keys(CONFIG.TRANSCODING.RESOLUTIONS) | ||
243 | .filter(key => CONFIG.TRANSCODING.ENABLED && CONFIG.TRANSCODING.RESOLUTIONS[ key ] === true) | ||
244 | .map(r => parseInt(r, 10)) | ||
245 | } | ||
246 | |||
247 | function getRegisteredPlugins () { | ||
248 | return PluginManager.Instance.getRegisteredPlugins() | ||
249 | .map(p => ({ | ||
250 | name: p.name, | ||
251 | version: p.version, | ||
252 | description: p.description, | ||
253 | clientScripts: p.clientScripts | ||
254 | })) | ||
255 | } | ||
256 | |||
230 | // --------------------------------------------------------------------------- | 257 | // --------------------------------------------------------------------------- |
231 | 258 | ||
232 | export { | 259 | export { |
233 | configRouter | 260 | configRouter, |
261 | getEnabledResolutions, | ||
262 | getRegisteredPlugins, | ||
263 | getRegisteredThemes | ||
234 | } | 264 | } |
235 | 265 | ||
236 | // --------------------------------------------------------------------------- | 266 | // --------------------------------------------------------------------------- |
@@ -370,30 +400,3 @@ function convertCustomConfigBody (body: CustomConfig) { | |||
370 | 400 | ||
371 | return objectConverter(body, keyConverter, valueConverter) | 401 | return objectConverter(body, keyConverter, valueConverter) |
372 | } | 402 | } |
373 | |||
374 | function getRegisteredThemes () { | ||
375 | return PluginManager.Instance.getRegisteredThemes() | ||
376 | .map(t => ({ | ||
377 | name: t.name, | ||
378 | version: t.version, | ||
379 | description: t.description, | ||
380 | css: t.css, | ||
381 | clientScripts: t.clientScripts | ||
382 | })) | ||
383 | } | ||
384 | |||
385 | function getEnabledResolutions () { | ||
386 | return Object.keys(CONFIG.TRANSCODING.RESOLUTIONS) | ||
387 | .filter(key => CONFIG.TRANSCODING.ENABLED && CONFIG.TRANSCODING.RESOLUTIONS[ key ] === true) | ||
388 | .map(r => parseInt(r, 10)) | ||
389 | } | ||
390 | |||
391 | function getRegisteredPlugins () { | ||
392 | return PluginManager.Instance.getRegisteredPlugins() | ||
393 | .map(p => ({ | ||
394 | name: p.name, | ||
395 | version: p.version, | ||
396 | description: p.description, | ||
397 | clientScripts: p.clientScripts | ||
398 | })) | ||
399 | } | ||