aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/utils.ts')
-rw-r--r--server/helpers/utils.ts26
1 files changed, 1 insertions, 25 deletions
diff --git a/server/helpers/utils.ts b/server/helpers/utils.ts
index 6b9333b53..5a4fe4fdd 100644
--- a/server/helpers/utils.ts
+++ b/server/helpers/utils.ts
@@ -4,7 +4,7 @@ import { join } from 'path'
4import { sha256 } from '@shared/extra-utils' 4import { sha256 } from '@shared/extra-utils'
5import { ResultList } from '@shared/models' 5import { ResultList } from '@shared/models'
6import { CONFIG } from '../initializers/config' 6import { CONFIG } from '../initializers/config'
7import { execPromise, execPromise2, randomBytesPromise } from './core-utils' 7import { randomBytesPromise } from './core-utils'
8import { logger } from './logger' 8import { logger } from './logger'
9 9
10function deleteFileAndCatch (path: string) { 10function deleteFileAndCatch (path: string) {
@@ -44,29 +44,6 @@ function getSecureTorrentName (originalName: string) {
44 return sha256(originalName) + '.torrent' 44 return sha256(originalName) + '.torrent'
45} 45}
46 46
47async function getServerCommit () {
48 try {
49 const tag = await execPromise2(
50 '[ ! -d .git ] || git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || true',
51 { stdio: [ 0, 1, 2 ] }
52 )
53
54 if (tag) return tag.replace(/^v/, '')
55 } catch (err) {
56 logger.debug('Cannot get version from git tags.', { err })
57 }
58
59 try {
60 const version = await execPromise('[ ! -d .git ] || git rev-parse --short HEAD')
61
62 if (version) return version.toString().trim()
63 } catch (err) {
64 logger.debug('Cannot get version from git HEAD.', { err })
65 }
66
67 return ''
68}
69
70/** 47/**
71 * From a filename like "ede4cba5-742b-46fa-a388-9a6eb3a3aeb3.mp4", returns 48 * From a filename like "ede4cba5-742b-46fa-a388-9a6eb3a3aeb3.mp4", returns
72 * only the "ede4cba5-742b-46fa-a388-9a6eb3a3aeb3" part. If the filename does 49 * only the "ede4cba5-742b-46fa-a388-9a6eb3a3aeb3" part. If the filename does
@@ -88,7 +65,6 @@ export {
88 generateRandomString, 65 generateRandomString,
89 getFormattedObjects, 66 getFormattedObjects,
90 getSecureTorrentName, 67 getSecureTorrentName,
91 getServerCommit,
92 generateVideoImportTmpPath, 68 generateVideoImportTmpPath,
93 getUUIDFromFilename 69 getUUIDFromFilename
94} 70}