]>
Commit | Line | Data |
---|---|---|
4d4e5cd4 | 1 | import * as express from 'express' |
65fcc311 | 2 | |
291e8d3e | 3 | import { isSignupAllowed } from '../../helpers' |
6a84aafd | 4 | import { CONFIG } from '../../initializers' |
eb080476 | 5 | import { asyncMiddleware } from '../../middlewares' |
154898b0 | 6 | import { ServerConfig } from '../../../shared' |
65fcc311 C |
7 | |
8 | const configRouter = express.Router() | |
9 | ||
eb080476 C |
10 | configRouter.get('/', |
11 | asyncMiddleware(getConfig) | |
12 | ) | |
65fcc311 | 13 | |
eb080476 C |
14 | async function getConfig (req: express.Request, res: express.Response, next: express.NextFunction) { |
15 | const allowed = await isSignupAllowed() | |
291e8d3e | 16 | |
eb080476 C |
17 | const enabledResolutions = Object.keys(CONFIG.TRANSCODING.RESOLUTIONS) |
18 | .filter(key => CONFIG.TRANSCODING.RESOLUTIONS[key] === true) | |
19 | .map(r => parseInt(r, 10)) | |
6a84aafd | 20 | |
eb080476 C |
21 | const json: ServerConfig = { |
22 | signup: { | |
23 | allowed | |
24 | }, | |
25 | transcoding: { | |
26 | enabledResolutions | |
65fcc311 | 27 | } |
eb080476 | 28 | } |
6a84aafd | 29 | |
eb080476 | 30 | return res.json(json) |
65fcc311 C |
31 | } |
32 | ||
33 | // --------------------------------------------------------------------------- | |
34 | ||
35 | export { | |
36 | configRouter | |
37 | } |