From 02b286f89088e07cac7e7068e884d3be0fd0098b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 6 Sep 2021 09:29:25 +0200 Subject: More robust webtorrent redundancy download Avoid issues with inconsistencies between magnet infohash and torrent infohash, blocking webtorrent upload that will timeout --- server/helpers/webtorrent.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'server/helpers/webtorrent.ts') diff --git a/server/helpers/webtorrent.ts b/server/helpers/webtorrent.ts index 83b46e085..5e1ea6198 100644 --- a/server/helpers/webtorrent.ts +++ b/server/helpers/webtorrent.ts @@ -21,8 +21,8 @@ import { extractVideo } from './video' const createTorrentPromise = promisify2(createTorrent) -async function downloadWebTorrentVideo (target: { magnetUri: string, torrentName?: string }, timeout: number) { - const id = target.magnetUri || target.torrentName +async function downloadWebTorrentVideo (target: { uri: string, torrentName?: string }, timeout: number) { + const id = target.uri || target.torrentName let timer const path = generateVideoImportTmpPath(id) @@ -35,7 +35,7 @@ async function downloadWebTorrentVideo (target: { magnetUri: string, torrentName const webtorrent = new WebTorrent() let file: TorrentFile - const torrentId = target.magnetUri || join(CONFIG.STORAGE.TORRENTS_DIR, target.torrentName) + const torrentId = target.uri || join(CONFIG.STORAGE.TORRENTS_DIR, target.torrentName) const options = { path: directoryPath } const torrent = webtorrent.add(torrentId, options, torrent => { -- cgit v1.2.3