diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-06 17:13:39 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-08 09:30:31 +0200 |
commit | ce33919c24e7402d92d81f3cd8e545df52d98240 (patch) | |
tree | 7e131a2f8df649899d0a71294665cf386ffb50d4 /server/helpers/utils.ts | |
parent | 788487140c500abeb69ca44daf3a9e26efa8d36f (diff) | |
download | PeerTube-ce33919c24e7402d92d81f3cd8e545df52d98240.tar.gz PeerTube-ce33919c24e7402d92d81f3cd8e545df52d98240.tar.zst PeerTube-ce33919c24e7402d92d81f3cd8e545df52d98240.zip |
Import magnets with webtorrent
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 | } |