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