mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-05 23:22:31 -06:00
@@ -87,18 +87,22 @@ window.qBittorrent.PropGeneral ??= (() => {
|
||||
clearTimeout(loadTorrentDataTimer);
|
||||
return;
|
||||
}
|
||||
const url = new URI("api/v2/torrents/properties?hash=" + current_id);
|
||||
new Request.JSON({
|
||||
url: url,
|
||||
method: "get",
|
||||
noCache: true,
|
||||
onFailure: () => {
|
||||
$("error_div").textContent = "QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]";
|
||||
clearTimeout(loadTorrentDataTimer);
|
||||
loadTorrentDataTimer = loadTorrentData.delay(10000);
|
||||
},
|
||||
onSuccess: (data) => {
|
||||
|
||||
fetch(new URI("api/v2/torrents/properties").setData("hash", current_id), {
|
||||
method: "GET",
|
||||
cache: "no-store"
|
||||
})
|
||||
.then(async (response) => {
|
||||
if (!response.ok) {
|
||||
$("error_div").textContent = "QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]";
|
||||
clearTimeout(loadTorrentDataTimer);
|
||||
loadTorrentDataTimer = loadTorrentData.delay(10000);
|
||||
return;
|
||||
}
|
||||
|
||||
$("error_div").textContent = "";
|
||||
|
||||
const data = await response.json();
|
||||
if (data) {
|
||||
// Update Torrent data
|
||||
|
||||
@@ -224,22 +228,23 @@ window.qBittorrent.PropGeneral ??= (() => {
|
||||
}
|
||||
clearTimeout(loadTorrentDataTimer);
|
||||
loadTorrentDataTimer = loadTorrentData.delay(5000);
|
||||
}
|
||||
}).send();
|
||||
});
|
||||
|
||||
fetch(new URI("api/v2/torrents/pieceStates").setData("hash", current_id), {
|
||||
method: "GET",
|
||||
cache: "no-store"
|
||||
})
|
||||
.then(async (response) => {
|
||||
if (!response.ok) {
|
||||
$("error_div").textContent = "QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]";
|
||||
clearTimeout(loadTorrentDataTimer);
|
||||
loadTorrentDataTimer = loadTorrentData.delay(10000);
|
||||
return;
|
||||
}
|
||||
|
||||
const piecesUrl = new URI("api/v2/torrents/pieceStates?hash=" + current_id);
|
||||
new Request.JSON({
|
||||
url: piecesUrl,
|
||||
method: "get",
|
||||
noCache: true,
|
||||
onFailure: () => {
|
||||
$("error_div").textContent = "QBT_TR(qBittorrent client is not reachable)QBT_TR[CONTEXT=HttpServer]";
|
||||
clearTimeout(loadTorrentDataTimer);
|
||||
loadTorrentDataTimer = loadTorrentData.delay(10000);
|
||||
},
|
||||
onSuccess: (data) => {
|
||||
$("error_div").textContent = "";
|
||||
|
||||
const data = await response.json();
|
||||
if (data)
|
||||
piecesBar.setPieces(data);
|
||||
else
|
||||
@@ -247,8 +252,7 @@ window.qBittorrent.PropGeneral ??= (() => {
|
||||
|
||||
clearTimeout(loadTorrentDataTimer);
|
||||
loadTorrentDataTimer = loadTorrentData.delay(5000);
|
||||
}
|
||||
}).send();
|
||||
});
|
||||
};
|
||||
|
||||
const updateData = () => {
|
||||
|
||||
Reference in New Issue
Block a user