]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/controllers/api/config.ts
Propagate old comment on new follow
[github/Chocobozzz/PeerTube.git] / server / controllers / api / config.ts
1 import * as express from 'express'
2 import { isSignupAllowed } from '../../helpers/utils'
3
4 import { CONFIG } from '../../initializers'
5 import { asyncMiddleware } from '../../middlewares'
6 import { ServerConfig } from '../../../shared'
7
8 const configRouter = express.Router()
9
10 configRouter.get('/',
11 asyncMiddleware(getConfig)
12 )
13
14 async 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
35 export {
36 configRouter
37 }