Support removing tracker from all torrents in WebUI/WebAPI

Closes #20661.
PR #21056.
This commit is contained in:
Thomas Piccirello 2024-09-16 02:47:10 -07:00 committed by GitHub
parent d19f7b12d9
commit d2b2afad23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 132 additions and 8 deletions

View file

@ -132,6 +132,7 @@ let deleteTorrentsByTagFN = function() {};
let startTorrentsByTrackerFN = function() {};
let stopTorrentsByTrackerFN = function() {};
let deleteTorrentsByTrackerFN = function() {};
let deleteTrackerFN = function() {};
let copyNameFN = function() {};
let copyInfohashFN = function(policy) {};
let copyMagnetLinkFN = function() {};
@ -1134,6 +1135,33 @@ const initializeWindows = function() {
}
};
deleteTrackerFN = function(trackerHash) {
const trackerHashInt = Number.parseInt(trackerHash, 10);
if ((trackerHashInt === TRACKERS_ALL) || (trackerHashInt === TRACKERS_TRACKERLESS))
return;
const tracker = trackerList.get(trackerHashInt);
const host = tracker.host;
const urls = [...tracker.trackerTorrentMap.keys()];
new MochaUI.Window({
id: "confirmDeletionPage",
title: "QBT_TR(Remove tracker)QBT_TR[CONTEXT=confirmDeletionDlg]",
loadMethod: "iframe",
contentURL: new URI("confirmtrackerdeletion.html").setData("host", host).setData("urls", urls.map(encodeURIComponent).join("|")).toString(),
scrollbars: false,
resizable: true,
maximizable: false,
padding: 10,
width: 424,
height: 100,
onCloseComplete: function() {
updateMainData();
setTrackerFilter(TRACKERS_ALL);
}
});
};
copyNameFN = function() {
const selectedRows = torrentsTable.selectedRowsIds();
const names = [];