aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/config.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/config.ts')
-rw-r--r--server/controllers/api/config.ts39
1 files changed, 33 insertions, 6 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts
index b80ea4902..bd100ef9c 100644
--- a/server/controllers/api/config.ts
+++ b/server/controllers/api/config.ts
@@ -113,7 +113,15 @@ async function getConfig (req: express.Request, res: express.Response) {
113 webtorrent: { 113 webtorrent: {
114 enabled: CONFIG.TRANSCODING.WEBTORRENT.ENABLED 114 enabled: CONFIG.TRANSCODING.WEBTORRENT.ENABLED
115 }, 115 },
116 enabledResolutions: getEnabledResolutions() 116 enabledResolutions: getEnabledResolutions('vod')
117 },
118 live: {
119 enabled: CONFIG.LIVE.ENABLED,
120
121 transcoding: {
122 enabled: CONFIG.LIVE.TRANSCODING.ENABLED,
123 enabledResolutions: getEnabledResolutions('live')
124 }
117 }, 125 },
118 import: { 126 import: {
119 videos: { 127 videos: {
@@ -232,7 +240,7 @@ async function deleteCustomConfig (req: express.Request, res: express.Response)
232 240
233 const data = customConfig() 241 const data = customConfig()
234 242
235 return res.json(data).end() 243 return res.json(data)
236} 244}
237 245
238async function updateCustomConfig (req: express.Request, res: express.Response) { 246async function updateCustomConfig (req: express.Request, res: express.Response) {
@@ -254,7 +262,7 @@ async function updateCustomConfig (req: express.Request, res: express.Response)
254 oldCustomConfigAuditKeys 262 oldCustomConfigAuditKeys
255 ) 263 )
256 264
257 return res.json(data).end() 265 return res.json(data)
258} 266}
259 267
260function getRegisteredThemes () { 268function getRegisteredThemes () {
@@ -268,9 +276,13 @@ function getRegisteredThemes () {
268 })) 276 }))
269} 277}
270 278
271function getEnabledResolutions () { 279function getEnabledResolutions (type: 'vod' | 'live') {
272 return Object.keys(CONFIG.TRANSCODING.RESOLUTIONS) 280 const transcoding = type === 'vod'
273 .filter(key => CONFIG.TRANSCODING.ENABLED && CONFIG.TRANSCODING.RESOLUTIONS[key] === true) 281 ? CONFIG.TRANSCODING
282 : CONFIG.LIVE.TRANSCODING
283
284 return Object.keys(transcoding.RESOLUTIONS)
285 .filter(key => transcoding.ENABLED && transcoding.RESOLUTIONS[key] === true)
274 .map(r => parseInt(r, 10)) 286 .map(r => parseInt(r, 10))
275} 287}
276 288
@@ -411,6 +423,21 @@ function customConfig (): CustomConfig {
411 enabled: CONFIG.TRANSCODING.HLS.ENABLED 423 enabled: CONFIG.TRANSCODING.HLS.ENABLED
412 } 424 }
413 }, 425 },
426 live: {
427 enabled: CONFIG.LIVE.ENABLED,
428 transcoding: {
429 enabled: CONFIG.LIVE.TRANSCODING.ENABLED,
430 threads: CONFIG.LIVE.TRANSCODING.THREADS,
431 resolutions: {
432 '240p': CONFIG.LIVE.TRANSCODING.RESOLUTIONS['240p'],
433 '360p': CONFIG.LIVE.TRANSCODING.RESOLUTIONS['360p'],
434 '480p': CONFIG.LIVE.TRANSCODING.RESOLUTIONS['480p'],
435 '720p': CONFIG.LIVE.TRANSCODING.RESOLUTIONS['720p'],
436 '1080p': CONFIG.LIVE.TRANSCODING.RESOLUTIONS['1080p'],
437 '2160p': CONFIG.LIVE.TRANSCODING.RESOLUTIONS['2160p']
438 }
439 }
440 },
414 import: { 441 import: {
415 videos: { 442 videos: {
416 http: { 443 http: {