import * as express from 'express'
+import { omit } from 'lodash'
import { ServerConfig, UserRight } from '../../../shared'
+import { About } from '../../../shared/models/config/about.model'
import { CustomConfig } from '../../../shared/models/config/custom-config.model'
import { unlinkPromise, writeFilePromise } from '../../helpers/core-utils'
import { isSignupAllowed } from '../../helpers/utils'
import { CONFIG, CONSTRAINTS_FIELDS, reloadConfig } from '../../initializers'
import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares'
import { customConfigUpdateValidator } from '../../middlewares/validators/config'
-import { omit } from 'lodash'
const packageJSON = require('../../../../package.json')
const configRouter = express.Router()
+configRouter.get('/about', getAbout)
configRouter.get('/',
asyncMiddleware(getConfig)
)
+
configRouter.get('/custom',
authenticate,
ensureUserHasRight(UserRight.MANAGE_CONFIGURATION),
.map(r => parseInt(r, 10))
const json: ServerConfig = {
+ instance: {
+ name: CONFIG.INSTANCE.NAME
+ },
serverVersion: packageJSON.version,
signup: {
allowed
return res.json(json)
}
+function getAbout (req: express.Request, res: express.Response, next: express.NextFunction) {
+ const about: About = {
+ instance: {
+ name: CONFIG.INSTANCE.NAME,
+ description: CONFIG.INSTANCE.DESCRIPTION,
+ terms: CONFIG.INSTANCE.TERMS
+ }
+ }
+
+ return res.json(about).end()
+}
+
async function getCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) {
const data = customConfig()