From 98fc5f8b2e58d4dba0aa5c4e44744a4d0b6235cf Mon Sep 17 00:00:00 2001 From: wipedlifepotato <60944239+wipedlifepotato@users.noreply.github.com> Date: Mon, 14 Sep 2026 05:30:35 +0300 Subject: [PATCH] fix: fix new build js torrent client --- contrib/webconsole/torrent-rpc.js | 2 +- contrib/webconsole/torrent_client.html | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/contrib/webconsole/torrent-rpc.js b/contrib/webconsole/torrent-rpc.js index f596c5dc..1faadff2 100644 --- a/contrib/webconsole/torrent-rpc.js +++ b/contrib/webconsole/torrent-rpc.js @@ -69,7 +69,7 @@ class TorrentClient { method: "POST", body: JSON.stringify({ 'method': 'torrent-get', - 'arguments': { "fields": ["id", "name", "status", "rateDownload", "rateUpload", "totalSize", "percentDone", "files", "peers", "trackers", "trackerStats"] } + 'arguments': { "fields": ["id", "name", "status", "rateDownload", "rateUpload", "totalSize", "percentDone", "files", "peers", "trackers", "trackerStats","hashString"] } }), headers: { 'Content-Type': 'application/json' } }); diff --git a/contrib/webconsole/torrent_client.html b/contrib/webconsole/torrent_client.html index de43d205..9a7cb1eb 100644 --- a/contrib/webconsole/torrent_client.html +++ b/contrib/webconsole/torrent_client.html @@ -68,7 +68,7 @@ const r = await window.tjs.getTorrents() //console.log(`torrents: ${r}`) if (!r?.result?.torrents) return; - r.result.torrents.forEach(async (t) => { + r.arguments.torrents.forEach(async (t) => { console.log(`stop torrent => ${t.id}`) await window.tjs.stopTorrent([t.id]); }); @@ -83,7 +83,7 @@ const r = await window.tjs.getTorrents() //console.log(`torrents: ${r}`) if (!r?.result?.torrents) return; - r.result.torrents.forEach( async (t) =>{ + r.arguments.torrents.forEach( async (t) =>{ console.log(`start torrent => ${t.id}`) await window.tjs.startTorrent([t.id]); }); @@ -97,14 +97,15 @@ try { const r = await window.tjs.getTorrents(); - if (!r?.result?.torrents) + console.log(r) + if (!r?.result == "success") return (statusIndicator.textContent = "STATUS: INVALID_RESPONSE"); - + statusIndicator.textContent = "STATUS: Connected"; statusIndicator.style.color = "rgb(77, 91, 83)"; const torrents = document.getElementById("torrents"); - currentTorrentsData = r.result.torrents; + currentTorrentsData = r.arguments.torrents; if (currentTorrentsData.length === 0) { torrents.innerHTML = "