mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-17 14:08:03 -06:00
@@ -58,19 +58,23 @@ window.qBittorrent.PropTrackers ??= (() => {
|
||||
torrentTrackersTable.clear();
|
||||
current_hash = new_hash;
|
||||
}
|
||||
const url = new URI("api/v2/torrents/trackers?hash=" + current_hash);
|
||||
new Request.JSON({
|
||||
url: url,
|
||||
method: "get",
|
||||
noCache: true,
|
||||
onComplete: () => {
|
||||
clearTimeout(loadTrackersDataTimer);
|
||||
loadTrackersDataTimer = loadTrackersData.delay(10000);
|
||||
},
|
||||
onSuccess: (trackers) => {
|
||||
|
||||
const url = new URL("api/v2/torrents/trackers", window.location);
|
||||
url.search = new URLSearchParams({
|
||||
hash: current_hash
|
||||
});
|
||||
fetch(url, {
|
||||
method: "GET",
|
||||
cache: "no-store"
|
||||
})
|
||||
.then(async (response) => {
|
||||
if (!response.ok)
|
||||
return;
|
||||
|
||||
const selectedTrackers = torrentTrackersTable.selectedRowsIds();
|
||||
torrentTrackersTable.clear();
|
||||
|
||||
const trackers = await response.json();
|
||||
if (trackers) {
|
||||
trackers.each((tracker) => {
|
||||
let status;
|
||||
@@ -113,8 +117,11 @@ window.qBittorrent.PropTrackers ??= (() => {
|
||||
if (selectedTrackers.length > 0)
|
||||
torrentTrackersTable.reselectRows(selectedTrackers);
|
||||
}
|
||||
}
|
||||
}).send();
|
||||
})
|
||||
.finally(() => {
|
||||
clearTimeout(loadTrackersDataTimer);
|
||||
loadTrackersDataTimer = loadTrackersData.delay(10000);
|
||||
});
|
||||
};
|
||||
|
||||
const updateData = () => {
|
||||
@@ -214,18 +221,19 @@ window.qBittorrent.PropTrackers ??= (() => {
|
||||
if (current_hash.length === 0)
|
||||
return;
|
||||
|
||||
const selectedTrackers = torrentTrackersTable.selectedRowsIds();
|
||||
new Request({
|
||||
url: "api/v2/torrents/removeTrackers",
|
||||
method: "post",
|
||||
data: {
|
||||
hash: current_hash,
|
||||
urls: selectedTrackers.map(encodeURIComponent).join("|")
|
||||
},
|
||||
onSuccess: () => {
|
||||
fetch("api/v2/torrents/removeTrackers", {
|
||||
method: "POST",
|
||||
body: new URLSearchParams({
|
||||
hash: current_hash,
|
||||
urls: torrentTrackersTable.selectedRowsIds().map(encodeURIComponent).join("|")
|
||||
})
|
||||
})
|
||||
.then((response) => {
|
||||
if (!response.ok)
|
||||
return;
|
||||
|
||||
updateData();
|
||||
}
|
||||
}).send();
|
||||
});
|
||||
};
|
||||
|
||||
const clear = () => {
|
||||
|
||||
Reference in New Issue
Block a user