aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/core-utils.ts3
-rw-r--r--server/helpers/webtorrent.ts5
2 files changed, 5 insertions, 3 deletions
diff --git a/server/helpers/core-utils.ts b/server/helpers/core-utils.ts
index 64818d036..9771351e1 100644
--- a/server/helpers/core-utils.ts
+++ b/server/helpers/core-utils.ts
@@ -3,7 +3,6 @@
3 Useful to avoid circular dependencies. 3 Useful to avoid circular dependencies.
4*/ 4*/
5 5
6import * as createTorrent from 'create-torrent'
7import { createHash, HexBase64Latin1Encoding, pseudoRandomBytes } from 'crypto' 6import { createHash, HexBase64Latin1Encoding, pseudoRandomBytes } from 'crypto'
8import { isAbsolute, join } from 'path' 7import { isAbsolute, join } from 'path'
9import * as pem from 'pem' 8import * as pem from 'pem'
@@ -257,7 +256,6 @@ function promisify2WithVoid<T, U> (func: (arg1: T, arg2: U, cb: (err: any) => vo
257const pseudoRandomBytesPromise = promisify1<number, Buffer>(pseudoRandomBytes) 256const pseudoRandomBytesPromise = promisify1<number, Buffer>(pseudoRandomBytes)
258const createPrivateKey = promisify1<number, { key: string }>(pem.createPrivateKey) 257const createPrivateKey = promisify1<number, { key: string }>(pem.createPrivateKey)
259const getPublicKey = promisify1<string, { publicKey: string }>(pem.getPublicKey) 258const getPublicKey = promisify1<string, { publicKey: string }>(pem.getPublicKey)
260const createTorrentPromise = promisify2<string, any, any>(createTorrent)
261const execPromise2 = promisify2<string, any, string>(exec) 259const execPromise2 = promisify2<string, any, string>(exec)
262const execPromise = promisify1<string, string>(exec) 260const execPromise = promisify1<string, string>(exec)
263 261
@@ -288,7 +286,6 @@ export {
288 pseudoRandomBytesPromise, 286 pseudoRandomBytesPromise,
289 createPrivateKey, 287 createPrivateKey,
290 getPublicKey, 288 getPublicKey,
291 createTorrentPromise,
292 execPromise2, 289 execPromise2,
293 execPromise 290 execPromise
294} 291}
diff --git a/server/helpers/webtorrent.ts b/server/helpers/webtorrent.ts
index 14dfe0d28..d2a22e8f0 100644
--- a/server/helpers/webtorrent.ts
+++ b/server/helpers/webtorrent.ts
@@ -4,6 +4,8 @@ import * as WebTorrent from 'webtorrent'
4import { createWriteStream, ensureDir, remove } from 'fs-extra' 4import { createWriteStream, ensureDir, remove } from 'fs-extra'
5import { CONFIG } from '../initializers/config' 5import { CONFIG } from '../initializers/config'
6import { dirname, join } from 'path' 6import { dirname, join } from 'path'
7import * as createTorrent from 'create-torrent'
8import { promisify2 } from './core-utils'
7 9
8async function downloadWebTorrentVideo (target: { magnetUri: string, torrentName?: string }, timeout: number) { 10async function downloadWebTorrentVideo (target: { magnetUri: string, torrentName?: string }, timeout: number) {
9 const id = target.magnetUri || target.torrentName 11 const id = target.magnetUri || target.torrentName
@@ -57,9 +59,12 @@ async function downloadWebTorrentVideo (target: { magnetUri: string, torrentName
57 }) 59 })
58} 60}
59 61
62const createTorrentPromise = promisify2<string, any, any>(createTorrent)
63
60// --------------------------------------------------------------------------- 64// ---------------------------------------------------------------------------
61 65
62export { 66export {
67 createTorrentPromise,
63 downloadWebTorrentVideo 68 downloadWebTorrentVideo
64} 69}
65 70