🐛 Fixing Deluge integration

Thanks to @scttcper for fixing https://github.com/scttcper/deluge/issues/106 so quickly !
This commit is contained in:
ajnart
2022-06-07 09:50:04 +02:00
parent 29c9f3ecac
commit de0c625f88
6 changed files with 77 additions and 45 deletions

View File

@@ -24,36 +24,34 @@ async function Post(req: NextApiRequest, res: NextApiResponse) {
}
if (qBittorrentService) {
torrents.push(
...(
...((
await new QBittorrent({
baseUrl: qBittorrentService.url,
username: qBittorrentService.username,
password: qBittorrentService.password,
}).getAllData()
).torrents
).torrents)
);
}
if (delugeService) {
const delugeTorrents = (
await new Deluge({
baseUrl: delugeService.url,
username: delugeService.username,
password: delugeService.password,
}).getAllData()
).torrents;
delugeTorrents.forEach((delugeTorrent) =>
torrents.push({ ...delugeTorrent, progress: delugeTorrent.progress / 100 })
torrents.push(
...((
await new Deluge({
baseUrl: delugeService.url,
password: delugeService.password,
}).getAllData()
).torrents)
);
}
if (transmissionService) {
torrents.push(
...(
...((
await new Transmission({
baseUrl: transmissionService.url,
username: transmissionService.username,
password: transmissionService.password,
}).getAllData()
).torrents
).torrents)
);
}
res.status(200).json(torrents);