]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/controllers/api/config.ts
Take in account transcoding for video quota
[github/Chocobozzz/PeerTube.git] / server / controllers / api / config.ts
CommitLineData
4d4e5cd4 1import * as express from 'express'
65fcc311 2
291e8d3e 3import { isSignupAllowed } from '../../helpers'
6a84aafd 4import { CONFIG } from '../../initializers'
154898b0 5import { ServerConfig } from '../../../shared'
65fcc311
C
6
7const configRouter = express.Router()
8
9configRouter.get('/', getConfig)
10
69818c93 11function 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
33export {
34 configRouter
35}