blob: 35c89835b3d613f80f08f330c50012f2ab9411e1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
import * as express from 'express'
import { isSignupAllowed } from '../../helpers/utils'
import { CONFIG, CONSTRAINTS_FIELDS } 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
},
avatar: {
file: {
size: {
max: CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max
},
extensions: CONSTRAINTS_FIELDS.ACTORS.AVATAR.EXTNAME
}
},
video: {
file: {
extensions: CONSTRAINTS_FIELDS.VIDEOS.EXTNAME
}
}
}
return res.json(json)
}
// ---------------------------------------------------------------------------
export {
configRouter
}
|