diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2018-09-29 19:53:49 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-10-01 14:31:01 +0200 |
commit | abb2c7927ca1640a755e0ec32c51bcc9c873b34c (patch) | |
tree | 4ded5e7559d48d450f861f5ec5c0a1a794cc2e15 /server/controllers | |
parent | 26b415176212b44ff6ce168cb00aeb93b10c0cb3 (diff) | |
download | PeerTube-abb2c7927ca1640a755e0ec32c51bcc9c873b34c.tar.gz PeerTube-abb2c7927ca1640a755e0ec32c51bcc9c873b34c.tar.zst PeerTube-abb2c7927ca1640a755e0ec32c51bcc9c873b34c.zip |
show last commit hash alongside server version in footer
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/api/config.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index 95549b724..633cf5e34 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts | |||
@@ -10,6 +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 { version } from '../../tools/cli' | ||
13 | 14 | ||
14 | const packageJSON = require('../../../../package.json') | 15 | const packageJSON = require('../../../../package.json') |
15 | const configRouter = express.Router() | 16 | const configRouter = express.Router() |
@@ -38,9 +39,12 @@ configRouter.delete('/custom', | |||
38 | asyncMiddleware(deleteCustomConfig) | 39 | asyncMiddleware(deleteCustomConfig) |
39 | ) | 40 | ) |
40 | 41 | ||
42 | let serverCommit: string | ||
41 | async function getConfig (req: express.Request, res: express.Response, next: express.NextFunction) { | 43 | async function getConfig (req: express.Request, res: express.Response, next: express.NextFunction) { |
42 | const allowed = await isSignupAllowed() | 44 | const allowed = await isSignupAllowed() |
43 | const allowedForCurrentIP = isSignupAllowedForCurrentIP(req.ip) | 45 | const allowedForCurrentIP = isSignupAllowedForCurrentIP(req.ip) |
46 | serverCommit = (serverCommit) ? serverCommit : version() | ||
47 | if (serverCommit === packageJSON.version) serverCommit = '' | ||
44 | 48 | ||
45 | const enabledResolutions = Object.keys(CONFIG.TRANSCODING.RESOLUTIONS) | 49 | const enabledResolutions = Object.keys(CONFIG.TRANSCODING.RESOLUTIONS) |
46 | .filter(key => CONFIG.TRANSCODING.ENABLED === CONFIG.TRANSCODING.RESOLUTIONS[key] === true) | 50 | .filter(key => CONFIG.TRANSCODING.ENABLED === CONFIG.TRANSCODING.RESOLUTIONS[key] === true) |
@@ -58,6 +62,7 @@ async function getConfig (req: express.Request, res: express.Response, next: exp | |||
58 | } | 62 | } |
59 | }, | 63 | }, |
60 | serverVersion: packageJSON.version, | 64 | serverVersion: packageJSON.version, |
65 | serverCommit, | ||
61 | signup: { | 66 | signup: { |
62 | allowed, | 67 | allowed, |
63 | allowedForCurrentIP, | 68 | allowedForCurrentIP, |