diff options
Diffstat (limited to 'server/helpers/utils.ts')
-rw-r--r-- | server/helpers/utils.ts | 11 |
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' | |||
9 | import { pseudoRandomBytesPromise, unlinkPromise } from './core-utils' | 9 | import { pseudoRandomBytesPromise, unlinkPromise } from './core-utils' |
10 | import { logger } from './logger' | 10 | import { logger } from './logger' |
11 | import { isArray } from './custom-validators/misc' | 11 | import { isArray } from './custom-validators/misc' |
12 | import * as crypto from "crypto" | ||
13 | import { join } from "path" | ||
12 | 14 | ||
13 | const isCidr = require('is-cidr') | 15 | const 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 | ||
186 | function 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 | |||
184 | type SortType = { sortModel: any, sortValue: string } | 191 | type SortType = { sortModel: any, sortValue: string } |
185 | 192 | ||
193 | |||
186 | // --------------------------------------------------------------------------- | 194 | // --------------------------------------------------------------------------- |
187 | 195 | ||
188 | export { | 196 | export { |
@@ -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 | } |