aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/utils.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2018-09-29 19:53:49 +0200
committerChocobozzz <me@florianbigard.com>2018-10-01 14:31:01 +0200
commitabb2c7927ca1640a755e0ec32c51bcc9c873b34c (patch)
tree4ded5e7559d48d450f861f5ec5c0a1a794cc2e15 /server/helpers/utils.ts
parent26b415176212b44ff6ce168cb00aeb93b10c0cb3 (diff)
downloadPeerTube-abb2c7927ca1640a755e0ec32c51bcc9c873b34c.tar.gz
PeerTube-abb2c7927ca1640a755e0ec32c51bcc9c873b34c.tar.zst
PeerTube-abb2c7927ca1640a755e0ec32c51bcc9c873b34c.zip
show last commit hash alongside server version in footer
Diffstat (limited to 'server/helpers/utils.ts')
-rw-r--r--server/helpers/utils.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/server/helpers/utils.ts b/server/helpers/utils.ts
index a42474417..f5bf6de56 100644
--- a/server/helpers/utils.ts
+++ b/server/helpers/utils.ts
@@ -54,6 +54,18 @@ function getSecureTorrentName (originalName: string) {
54 return sha256(originalName) + '.torrent' 54 return sha256(originalName) + '.torrent'
55} 55}
56 56
57function getVersion () {
58 const tag = require('child_process')
59 .execSync('[[ ! -d .git ]] || git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || true', { stdio: [0,1,2] })
60 if (tag) return tag.replace(/^v/, '')
61
62 const version = require('child_process')
63 .execSync('[[ ! -d .git ]] || git rev-parse --short HEAD').toString().trim()
64 if (version) return version
65
66 return require('../../../package.json').version
67}
68
57// --------------------------------------------------------------------------- 69// ---------------------------------------------------------------------------
58 70
59export { 71export {
@@ -62,5 +74,6 @@ export {
62 getFormattedObjects, 74 getFormattedObjects,
63 getSecureTorrentName, 75 getSecureTorrentName,
64 getServerActor, 76 getServerActor,
77 getVersion,
65 generateVideoTmpPath 78 generateVideoTmpPath
66} 79}