mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-12-01 21:09:17 -06:00
38 lines
893 B
TypeScript
38 lines
893 B
TypeScript
import * as express from 'express'
|
|
import { isSignupAllowed } from '../../helpers/utils'
|
|
|
|
import { CONFIG } from '../../initializers'
|
|
import { asyncMiddleware } from '../../middlewares'
|
|
import { ServerConfig } from '../../../shared'
|
|
|
|
const configRouter = express.Router()
|
|
|
|
configRouter.get('/',
|
|
asyncMiddleware(getConfig)
|
|
)
|
|
|
|
async function getConfig (req: express.Request, res: express.Response, next: express.NextFunction) {
|
|
const allowed = await isSignupAllowed()
|
|
|
|
const enabledResolutions = Object.keys(CONFIG.TRANSCODING.RESOLUTIONS)
|
|
.filter(key => CONFIG.TRANSCODING.RESOLUTIONS[key] === true)
|
|
.map(r => parseInt(r, 10))
|
|
|
|
const json: ServerConfig = {
|
|
signup: {
|
|
allowed
|
|
},
|
|
transcoding: {
|
|
enabledResolutions
|
|
}
|
|
}
|
|
|
|
return res.json(json)
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
export {
|
|
configRouter
|
|
}
|