import { ClientHtml } from '../../lib/client-html'
import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '../../helpers/audit-logger'
import { remove, writeJSON } from 'fs-extra'
-import { getVersion } from '../../helpers/utils'
+import { getServerCommit } from '../../helpers/utils'
const packageJSON = require('../../../../package.json')
const configRouter = express.Router()
)
let serverCommit: string
-async function getConfig (req: express.Request, res: express.Response, next: express.NextFunction) {
+async function getConfig (req: express.Request, res: express.Response) {
const allowed = await isSignupAllowed()
const allowedForCurrentIP = isSignupAllowedForCurrentIP(req.ip)
- serverCommit = (serverCommit) ? serverCommit : await getVersion()
- if (serverCommit === packageJSON.version) serverCommit = ''
+
+ if (serverCommit === undefined) serverCommit = await getServerCommit()
const enabledResolutions = Object.keys(CONFIG.TRANSCODING.RESOLUTIONS)
.filter(key => CONFIG.TRANSCODING.ENABLED === CONFIG.TRANSCODING.RESOLUTIONS[key] === true)
return sha256(originalName) + '.torrent'
}
-async function getVersion () {
+async function getServerCommit () {
try {
const tag = await execPromise2(
'[ ! -d .git ] || git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || true',
logger.debug('Cannot get version from git HEAD.', { err })
}
- return require('../../../package.json').version
+ return ''
}
/**
getFormattedObjects,
getSecureTorrentName,
getServerActor,
- getVersion,
+ getServerCommit,
generateVideoTmpPath,
getUUIDFromFilename
}
import * as utils from '../helpers/utils'
import * as YoutubeDLUtils from '../helpers/youtube-dl'
-let versionCommitHash
-
const start = async () => {
await initDatabaseModels(true)
- await utils.getVersion().then((data) => {
- versionCommitHash = data
- })
+ const versionCommitHash = await utils.getServerCommit()
const initContext = (replServer) => {
return (context) => {
initContext(replServer)(replServer.context)
replServer.on('reset', initContext(replServer))
+ replServer.on('exit', () => process.exit())
const resetCommand = {
help: 'Reset REPL',