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