This commit is contained in:
William Mantly 2020-02-16 13:05:52 -05:00
parent 789a51c6e2
commit af13200158

7
app.js
View File

@ -19,14 +19,17 @@ var tr_client = new Transmission({
app.post("/__api/torrent", async function(req, res, next){ app.post("/__api/torrent", async function(req, res, next){
if(req.body.api !== '4412') return res.status(421); if(req.body.password !== '4412'){
return res.status(421);
}
try{ try{
let cres = await tr_client.addUrl(Buffer.from(req.body.magnet, 'base64').toString('binary')); let cres = await tr_client.addUrl(Buffer.from(req.body.magnet, 'base64').toString('binary'));
console.log(cres) res.json(cres)
}catch(e){ }catch(e){
console.error('error', e) console.error('error', e)
res.status(500).json({message: e})
} }
}); });