From a83eef99da1b338fd38bdba6e31891ba81f4ff37 Mon Sep 17 00:00:00 2001 From: TheBeastLT Date: Fri, 15 Mar 2024 20:39:43 +0200 Subject: [PATCH] improve offcloud link resolving --- addon/moch/offcloud.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addon/moch/offcloud.js b/addon/moch/offcloud.js index 76d01aa..98755b8 100644 --- a/addon/moch/offcloud.js +++ b/addon/moch/offcloud.js @@ -136,8 +136,8 @@ async function _retryCreateTorrent(OC, infoHash, cachedEntryInfo, fileIndex) { async function _unrestrictLink(OC, infoHash, torrent, cachedEntryInfo, fileIndex) { const targetFileName = decodeURIComponent(cachedEntryInfo); const files = await _getFileUrls(OC, torrent) - const targetFile = files.find(file => file.includes(`/${torrent.requestId}/${fileIndex}/`)) - || files.find(file => sameFilename(targetFileName, file.split('/').pop())) + const targetFile = files.find(file => sameFilename(targetFileName, file.split('/').pop())) + || files.find(file => file.includes(`/${torrent.requestId}/${fileIndex}/`)) || files.find(file => isVideo(file)) || files.pop();