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.ts32
1 files changed, 17 insertions, 15 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts
index c9a051bdc..5f704f0ee 100644
--- a/server/controllers/api/config.ts
+++ b/server/controllers/api/config.ts
@@ -2,30 +2,32 @@ import * as express from 'express'
2 2
3import { isSignupAllowed } from '../../helpers' 3import { isSignupAllowed } from '../../helpers'
4import { CONFIG } from '../../initializers' 4import { CONFIG } from '../../initializers'
5import { asyncMiddleware } from '../../middlewares'
5import { ServerConfig } from '../../../shared' 6import { ServerConfig } from '../../../shared'
6 7
7const configRouter = express.Router() 8const configRouter = express.Router()
8 9
9configRouter.get('/', getConfig) 10configRouter.get('/',
11 asyncMiddleware(getConfig)
12)
10 13
11function getConfig (req: express.Request, res: express.Response, next: express.NextFunction) { 14async function getConfig (req: express.Request, res: express.Response, next: express.NextFunction) {
15 const allowed = await isSignupAllowed()
12 16
13 isSignupAllowed().then(allowed => { 17 const enabledResolutions = Object.keys(CONFIG.TRANSCODING.RESOLUTIONS)
14 const enabledResolutions = Object.keys(CONFIG.TRANSCODING.RESOLUTIONS) 18 .filter(key => CONFIG.TRANSCODING.RESOLUTIONS[key] === true)
15 .filter(key => CONFIG.TRANSCODING.RESOLUTIONS[key] === true) 19 .map(r => parseInt(r, 10))
16 .map(r => parseInt(r, 10))
17 20
18 const json: ServerConfig = { 21 const json: ServerConfig = {
19 signup: { 22 signup: {
20 allowed 23 allowed
21 }, 24 },
22 transcoding: { 25 transcoding: {
23 enabledResolutions 26 enabledResolutions
24 }
25 } 27 }
28 }
26 29
27 res.json(json) 30 return res.json(json)
28 })
29} 31}
30 32
31// --------------------------------------------------------------------------- 33// ---------------------------------------------------------------------------