diff options
author | Chocobozzz <me@florianbigard.com> | 2018-11-23 11:06:10 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-11-23 11:07:00 +0100 |
commit | 1b5e2d72900c8ceaf76940b72839d3c424ac96e8 (patch) | |
tree | 155fb65bd2d35259294dcfdb9d0c3e1de0400b92 /server/controllers | |
parent | f95cb03a29716a455ad89877dfd5192d825e3931 (diff) | |
download | PeerTube-1b5e2d72900c8ceaf76940b72839d3c424ac96e8.tar.gz PeerTube-1b5e2d72900c8ceaf76940b72839d3c424ac96e8.tar.zst PeerTube-1b5e2d72900c8ceaf76940b72839d3c424ac96e8.zip |
Optimize config endpoint
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/api/config.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index 03c1cec7b..5233e9f68 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts | |||
@@ -10,7 +10,7 @@ import { customConfigUpdateValidator } from '../../middlewares/validators/config | |||
10 | import { ClientHtml } from '../../lib/client-html' | 10 | import { ClientHtml } from '../../lib/client-html' |
11 | import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '../../helpers/audit-logger' | 11 | import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '../../helpers/audit-logger' |
12 | import { remove, writeJSON } from 'fs-extra' | 12 | import { remove, writeJSON } from 'fs-extra' |
13 | import { getVersion } from '../../helpers/utils' | 13 | import { getServerCommit } from '../../helpers/utils' |
14 | 14 | ||
15 | const packageJSON = require('../../../../package.json') | 15 | const packageJSON = require('../../../../package.json') |
16 | const configRouter = express.Router() | 16 | const configRouter = express.Router() |
@@ -40,11 +40,11 @@ configRouter.delete('/custom', | |||
40 | ) | 40 | ) |
41 | 41 | ||
42 | let serverCommit: string | 42 | let serverCommit: string |
43 | async function getConfig (req: express.Request, res: express.Response, next: express.NextFunction) { | 43 | async function getConfig (req: express.Request, res: express.Response) { |
44 | const allowed = await isSignupAllowed() | 44 | const allowed = await isSignupAllowed() |
45 | const allowedForCurrentIP = isSignupAllowedForCurrentIP(req.ip) | 45 | const allowedForCurrentIP = isSignupAllowedForCurrentIP(req.ip) |
46 | serverCommit = (serverCommit) ? serverCommit : await getVersion() | 46 | |
47 | if (serverCommit === packageJSON.version) serverCommit = '' | 47 | if (serverCommit === undefined) serverCommit = await getServerCommit() |
48 | 48 | ||
49 | const enabledResolutions = Object.keys(CONFIG.TRANSCODING.RESOLUTIONS) | 49 | const enabledResolutions = Object.keys(CONFIG.TRANSCODING.RESOLUTIONS) |
50 | .filter(key => CONFIG.TRANSCODING.ENABLED === CONFIG.TRANSCODING.RESOLUTIONS[key] === true) | 50 | .filter(key => CONFIG.TRANSCODING.ENABLED === CONFIG.TRANSCODING.RESOLUTIONS[key] === true) |