mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
[addon] add cache control for redirect
This commit is contained in:
@@ -44,11 +44,11 @@ async function _unrestrict(apiKey, infoHash, fileIndex) {
|
||||
console.log(`Retrieved torrentId: ${torrentId}`);
|
||||
if (torrentId) {
|
||||
const info = await RD.torrents.info(torrentId);
|
||||
const downloadFile = info.files.find(file => file.id === fileIndex + 1);
|
||||
const targetFile = info.files.find(file => file.id === fileIndex + 1);
|
||||
const selectedFiles = info.files.filter(file => file.selected);
|
||||
const fileLink = info.links.length === 1
|
||||
? info.links[0]
|
||||
: info.links[selectedFiles.indexOf(downloadFile)];
|
||||
: info.links[selectedFiles.indexOf(targetFile)];
|
||||
return _unrestrictLink(RD, fileLink);
|
||||
}
|
||||
return Promise.reject("Failed adding torrent");
|
||||
|
||||
Reference in New Issue
Block a user