]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/controllers/api/config.ts
Add ability to disable video comments
[github/Chocobozzz/PeerTube.git] / server / controllers / api / config.ts
CommitLineData
4d4e5cd4 1import * as express from 'express'
da854ddd 2import { isSignupAllowed } from '../../helpers/utils'
65fcc311 3
6a84aafd 4import { CONFIG } from '../../initializers'
eb080476 5import { asyncMiddleware } from '../../middlewares'
154898b0 6import { ServerConfig } from '../../../shared'
65fcc311
C
7
8const configRouter = express.Router()
9
eb080476
C
10configRouter.get('/',
11 asyncMiddleware(getConfig)
12)
65fcc311 13
eb080476
C
14async 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
35export {
36 configRouter
37}