]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - server/controllers/api/config.ts
Begin unit tests
[github/Chocobozzz/PeerTube.git] / server / controllers / api / config.ts
... / ...
CommitLineData
1import * as express from 'express'
2
3import { isSignupAllowed } from '../../helpers'
4import { CONFIG } from '../../initializers'
5import { asyncMiddleware } from '../../middlewares'
6import { ServerConfig } from '../../../shared'
7
8const configRouter = express.Router()
9
10configRouter.get('/',
11 asyncMiddleware(getConfig)
12)
13
14async function getConfig (req: express.Request, res: express.Response, next: express.NextFunction) {
15 const allowed = await isSignupAllowed()
16
17 const enabledResolutions = Object.keys(CONFIG.TRANSCODING.RESOLUTIONS)
18 .filter(key => CONFIG.TRANSCODING.RESOLUTIONS[key] === true)
19 .map(r => parseInt(r, 10))
20
21 const json: ServerConfig = {
22 signup: {
23 allowed
24 },
25 transcoding: {
26 enabledResolutions
27 }
28 }
29
30 return res.json(json)
31}
32
33// ---------------------------------------------------------------------------
34
35export {
36 configRouter
37}