diff --git a/contrib/webconsole/torrent-rpc.js b/contrib/webconsole/torrent-rpc.js index 0d9b5da9..bfc3f1bc 100644 --- a/contrib/webconsole/torrent-rpc.js +++ b/contrib/webconsole/torrent-rpc.js @@ -56,12 +56,37 @@ class TorrentClient { method: "POST", body: JSON.stringify({ 'method': 'torrent-get', - 'arguments': { "fields": ["id", "name", "status", "rateDownload", "rateUpload", "totalSize", "percentDone", "files", "peers", "trackers"] } + 'arguments': { "fields": ["id", "name", "status", "rateDownload", "rateUpload", "totalSize", "percentDone", "files", "peers", "trackers", "trackerStats"] } }), headers: { 'Content-Type': 'application/json' } }); return res.json(); } + async stopTorrent(ids = []) { + const res = await fetch(this.getEndpoint(), { + method: "POST", + body: JSON.stringify({ + 'method': 'torrent-stop', + 'arguments': ids.length ? { ids } : {}, + 'tag': 666 + }), + headers: { 'Content-Type': 'application/json' } + }); + return res.json(); +} + +async startTorrent(ids = []) { + const res = await fetch(this.getEndpoint(), { + method: "POST", + body: JSON.stringify({ + 'method': 'torrent-start', + 'arguments': ids.length ? { ids } : {}, + 'tag': 666 + }), + headers: { 'Content-Type': 'application/json' } + }); + return res.json(); +} } //window.tjs = new TorrentClient(); diff --git a/contrib/webconsole/torrent_client.html b/contrib/webconsole/torrent_client.html index 8b3a645e..01f33732 100644 --- a/contrib/webconsole/torrent_client.html +++ b/contrib/webconsole/torrent_client.html @@ -4,7 +4,13 @@

_

+ + @@ -18,12 +24,44 @@

Trackers (0):

+

trackerStats:

+