diff options
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/core-utils.ts | 3 | ||||
-rw-r--r-- | server/helpers/webtorrent.ts | 5 |
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 | ||
6 | import * as createTorrent from 'create-torrent' | ||
7 | import { createHash, HexBase64Latin1Encoding, pseudoRandomBytes } from 'crypto' | 6 | import { createHash, HexBase64Latin1Encoding, pseudoRandomBytes } from 'crypto' |
8 | import { isAbsolute, join } from 'path' | 7 | import { isAbsolute, join } from 'path' |
9 | import * as pem from 'pem' | 8 | import * as pem from 'pem' |
@@ -257,7 +256,6 @@ function promisify2WithVoid<T, U> (func: (arg1: T, arg2: U, cb: (err: any) => vo | |||
257 | const pseudoRandomBytesPromise = promisify1<number, Buffer>(pseudoRandomBytes) | 256 | const pseudoRandomBytesPromise = promisify1<number, Buffer>(pseudoRandomBytes) |
258 | const createPrivateKey = promisify1<number, { key: string }>(pem.createPrivateKey) | 257 | const createPrivateKey = promisify1<number, { key: string }>(pem.createPrivateKey) |
259 | const getPublicKey = promisify1<string, { publicKey: string }>(pem.getPublicKey) | 258 | const getPublicKey = promisify1<string, { publicKey: string }>(pem.getPublicKey) |
260 | const createTorrentPromise = promisify2<string, any, any>(createTorrent) | ||
261 | const execPromise2 = promisify2<string, any, string>(exec) | 259 | const execPromise2 = promisify2<string, any, string>(exec) |
262 | const execPromise = promisify1<string, string>(exec) | 260 | const 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' | |||
4 | import { createWriteStream, ensureDir, remove } from 'fs-extra' | 4 | import { createWriteStream, ensureDir, remove } from 'fs-extra' |
5 | import { CONFIG } from '../initializers/config' | 5 | import { CONFIG } from '../initializers/config' |
6 | import { dirname, join } from 'path' | 6 | import { dirname, join } from 'path' |
7 | import * as createTorrent from 'create-torrent' | ||
8 | import { promisify2 } from './core-utils' | ||
7 | 9 | ||
8 | async function downloadWebTorrentVideo (target: { magnetUri: string, torrentName?: string }, timeout: number) { | 10 | async 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 | ||
62 | const createTorrentPromise = promisify2<string, any, any>(createTorrent) | ||
63 | |||
60 | // --------------------------------------------------------------------------- | 64 | // --------------------------------------------------------------------------- |
61 | 65 | ||
62 | export { | 66 | export { |
67 | createTorrentPromise, | ||
63 | downloadWebTorrentVideo | 68 | downloadWebTorrentVideo |
64 | } | 69 | } |
65 | 70 | ||