[addon] removes moch url resolving from addon

This commit is contained in:
TheBeastLT
2020-03-19 12:29:52 +01:00
parent 084744b35b
commit d5a82fc72d
6 changed files with 44 additions and 116 deletions

View File

@@ -4,7 +4,6 @@ const addonInterface = require('./addon');
const { manifest } = require('./lib/manifest');
const parseConfiguration = require('./lib/configuration');
const landingTemplate = require('./lib/landingTemplate');
const realDebrid = require('./moch/realdebrid');
const router = getRouter(addonInterface);
const limiter = rateLimit({
@@ -69,22 +68,6 @@ router.get('/:configuration/:resource/:type/:id.json', (req, res, next) => {
});
});
router.get('/realdebrid/:apiKey/:infoHash/:cachedFileIds/:fileIndex?', (req, res) => {
const { apiKey, infoHash, cachedFileIds, fileIndex } = req.params;
console.log(`Unrestricting ${infoHash} [${fileIndex}]`);
realDebrid.unrestrict(apiKey, infoHash, cachedFileIds, isNaN(fileIndex) ? undefined : parseInt(fileIndex))
.then(url => {
console.log(`Unrestricted ${infoHash} [${fileIndex}] to ${url}`);
res.writeHead(301, { Location: url });
res.end();
})
.catch(error => {
console.log(error);
res.statusCode = 404;
res.end();
});
});
module.exports = function (req, res) {
router(req, res, function () {
res.statusCode = 404;