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.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/server/helpers/utils.ts b/server/helpers/utils.ts
index 7abcec5d7..f4cc5547d 100644
--- a/server/helpers/utils.ts
+++ b/server/helpers/utils.ts
@@ -9,6 +9,8 @@ import { ApplicationModel } from '../models/application/application'
9import { pseudoRandomBytesPromise, unlinkPromise } from './core-utils' 9import { pseudoRandomBytesPromise, unlinkPromise } from './core-utils'
10import { logger } from './logger' 10import { logger } from './logger'
11import { isArray } from './custom-validators/misc' 11import { isArray } from './custom-validators/misc'
12import * as crypto from "crypto"
13import { join } from "path"
12 14
13const isCidr = require('is-cidr') 15const isCidr = require('is-cidr')
14 16
@@ -181,8 +183,14 @@ async function getServerActor () {
181 return Promise.resolve(serverActor) 183 return Promise.resolve(serverActor)
182} 184}
183 185
186function generateVideoTmpPath (id: string) {
187 const hash = crypto.createHash('sha256').update(id).digest('hex')
188 return join(CONFIG.STORAGE.VIDEOS_DIR, hash + '-import.mp4')
189}
190
184type SortType = { sortModel: any, sortValue: string } 191type SortType = { sortModel: any, sortValue: string }
185 192
193
186// --------------------------------------------------------------------------- 194// ---------------------------------------------------------------------------
187 195
188export { 196export {
@@ -195,5 +203,6 @@ export {
195 computeResolutionsToTranscode, 203 computeResolutionsToTranscode,
196 resetSequelizeInstance, 204 resetSequelizeInstance,
197 getServerActor, 205 getServerActor,
198 SortType 206 SortType,
207 generateVideoTmpPath
199} 208}