mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-19 06:57:24 -06:00
@@ -58,18 +58,23 @@ window.qBittorrent.PropWebseeds ??= (() => {
|
||||
torrentWebseedsTable.clear();
|
||||
current_hash = new_hash;
|
||||
}
|
||||
new Request.JSON({
|
||||
url: new URI("api/v2/torrents/webseeds").setData("hash", current_hash),
|
||||
method: "get",
|
||||
noCache: true,
|
||||
onComplete: () => {
|
||||
clearTimeout(loadWebSeedsDataTimer);
|
||||
loadWebSeedsDataTimer = loadWebSeedsData.delay(10000);
|
||||
},
|
||||
onSuccess: (webseeds) => {
|
||||
|
||||
const url = new URL("api/v2/torrents/webseeds", window.location);
|
||||
url.search = new URLSearchParams({
|
||||
hash: current_hash
|
||||
});
|
||||
fetch(url, {
|
||||
method: "GET",
|
||||
cache: "no-store"
|
||||
})
|
||||
.then(async (response) => {
|
||||
if (!response.ok)
|
||||
return;
|
||||
|
||||
const selectedWebseeds = torrentWebseedsTable.selectedRowsIds();
|
||||
torrentWebseedsTable.clear();
|
||||
|
||||
const webseeds = await response.json();
|
||||
if (webseeds) {
|
||||
// Update WebSeeds data
|
||||
webseeds.each((webseed) => {
|
||||
@@ -84,8 +89,11 @@ window.qBittorrent.PropWebseeds ??= (() => {
|
||||
|
||||
if (selectedWebseeds.length > 0)
|
||||
torrentWebseedsTable.reselectRows(selectedWebseeds);
|
||||
}
|
||||
}).send();
|
||||
})
|
||||
.finally(() => {
|
||||
clearTimeout(loadWebSeedsDataTimer);
|
||||
loadWebSeedsDataTimer = loadWebSeedsData.delay(10000);
|
||||
});
|
||||
};
|
||||
|
||||
const updateData = () => {
|
||||
@@ -190,18 +198,19 @@ window.qBittorrent.PropWebseeds ??= (() => {
|
||||
if (current_hash.length === 0)
|
||||
return;
|
||||
|
||||
const selectedWebseeds = torrentWebseedsTable.selectedRowsIds();
|
||||
new Request({
|
||||
url: "api/v2/torrents/removeWebSeeds",
|
||||
method: "post",
|
||||
data: {
|
||||
hash: current_hash,
|
||||
urls: selectedWebseeds.map(webseed => encodeURIComponent(webseed)).join("|")
|
||||
},
|
||||
onSuccess: () => {
|
||||
fetch("api/v2/torrents/removeWebSeeds", {
|
||||
method: "POST",
|
||||
body: new URLSearchParams({
|
||||
hash: current_hash,
|
||||
urls: torrentWebseedsTable.selectedRowsIds().map(webseed => encodeURIComponent(webseed)).join("|")
|
||||
})
|
||||
})
|
||||
.then((response) => {
|
||||
if (!response.ok)
|
||||
return;
|
||||
|
||||
updateData();
|
||||
}
|
||||
}).send();
|
||||
});
|
||||
};
|
||||
|
||||
const clear = () => {
|
||||
|
||||
Reference in New Issue
Block a user