1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 18:29:27 +02:00

show last commit hash alongside server version in footer

This commit is contained in:
Rigel Kent 2018-09-29 19:53:49 +02:00 committed by Chocobozzz
parent 26b4151762
commit abb2c7927c
6 changed files with 27 additions and 12 deletions

View file

@ -54,6 +54,18 @@ function getSecureTorrentName (originalName: string) {
return sha256(originalName) + '.torrent'
}
function getVersion () {
const tag = require('child_process')
.execSync('[[ ! -d .git ]] || git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || true', { stdio: [0,1,2] })
if (tag) return tag.replace(/^v/, '')
const version = require('child_process')
.execSync('[[ ! -d .git ]] || git rev-parse --short HEAD').toString().trim()
if (version) return version
return require('../../../package.json').version
}
// ---------------------------------------------------------------------------
export {
@ -62,5 +74,6 @@ export {
getFormattedObjects,
getSecureTorrentName,
getServerActor,
getVersion,
generateVideoTmpPath
}