[addon] add proxy for realdebrid unrestrict request

This commit is contained in:
TheBeastLT
2020-03-17 17:53:09 +01:00
parent 727c763e43
commit 7fd638b9e0
3 changed files with 43 additions and 41 deletions

View File

@@ -75,11 +75,13 @@ router.get('/realdebrid/:apiKey/:infoHash/:fileIndex?', (req, res) => {
realDebrid.unrestrict(apiKey, infoHash, isNaN(fileIndex) ? undefined : parseInt(fileIndex))
.then(url => {
console.timeEnd(infoHash);
res.redirect(301, url)
res.writeHead(301, { Location: url });
res.end();
})
.catch(error => {
console.log(error);
res.sendStatus(404);
res.statusCode = 404;
res.end();
});
});