aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-31 17:47:36 +0100
committerChocobozzz <me@florianbigard.com>2018-01-31 17:51:04 +0100
commit36f9424ff192b0584a433bc196bced6fcf265808 (patch)
tree35d9fa5c53b228f5e7fc27bcc82854d035e9dde8 /server/controllers
parent66b16cafb380012d3eca14e524d86f2450e04069 (diff)
downloadPeerTube-36f9424ff192b0584a433bc196bced6fcf265808.tar.gz
PeerTube-36f9424ff192b0584a433bc196bced6fcf265808.tar.zst
PeerTube-36f9424ff192b0584a433bc196bced6fcf265808.zip
Add about page
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/config.ts20
1 files changed, 19 insertions, 1 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts
index e4cb02820..89163edb3 100644
--- a/server/controllers/api/config.ts
+++ b/server/controllers/api/config.ts
@@ -1,19 +1,22 @@
1import * as express from 'express' 1import * as express from 'express'
2import { omit } from 'lodash'
2import { ServerConfig, UserRight } from '../../../shared' 3import { ServerConfig, UserRight } from '../../../shared'
4import { About } from '../../../shared/models/config/about.model'
3import { CustomConfig } from '../../../shared/models/config/custom-config.model' 5import { CustomConfig } from '../../../shared/models/config/custom-config.model'
4import { unlinkPromise, writeFilePromise } from '../../helpers/core-utils' 6import { unlinkPromise, writeFilePromise } from '../../helpers/core-utils'
5import { isSignupAllowed } from '../../helpers/utils' 7import { isSignupAllowed } from '../../helpers/utils'
6import { CONFIG, CONSTRAINTS_FIELDS, reloadConfig } from '../../initializers' 8import { CONFIG, CONSTRAINTS_FIELDS, reloadConfig } from '../../initializers'
7import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares' 9import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares'
8import { customConfigUpdateValidator } from '../../middlewares/validators/config' 10import { customConfigUpdateValidator } from '../../middlewares/validators/config'
9import { omit } from 'lodash'
10 11
11const packageJSON = require('../../../../package.json') 12const packageJSON = require('../../../../package.json')
12const configRouter = express.Router() 13const configRouter = express.Router()
13 14
15configRouter.get('/about', getAbout)
14configRouter.get('/', 16configRouter.get('/',
15 asyncMiddleware(getConfig) 17 asyncMiddleware(getConfig)
16) 18)
19
17configRouter.get('/custom', 20configRouter.get('/custom',
18 authenticate, 21 authenticate,
19 ensureUserHasRight(UserRight.MANAGE_CONFIGURATION), 22 ensureUserHasRight(UserRight.MANAGE_CONFIGURATION),
@@ -39,6 +42,9 @@ async function getConfig (req: express.Request, res: express.Response, next: exp
39 .map(r => parseInt(r, 10)) 42 .map(r => parseInt(r, 10))
40 43
41 const json: ServerConfig = { 44 const json: ServerConfig = {
45 instance: {
46 name: CONFIG.INSTANCE.NAME
47 },
42 serverVersion: packageJSON.version, 48 serverVersion: packageJSON.version,
43 signup: { 49 signup: {
44 allowed 50 allowed
@@ -64,6 +70,18 @@ async function getConfig (req: express.Request, res: express.Response, next: exp
64 return res.json(json) 70 return res.json(json)
65} 71}
66 72
73function getAbout (req: express.Request, res: express.Response, next: express.NextFunction) {
74 const about: About = {
75 instance: {
76 name: CONFIG.INSTANCE.NAME,
77 description: CONFIG.INSTANCE.DESCRIPTION,
78 terms: CONFIG.INSTANCE.TERMS
79 }
80 }
81
82 return res.json(about).end()
83}
84
67async function getCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) { 85async function getCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) {
68 const data = customConfig() 86 const data = customConfig()
69 87