mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 13:18:06 -06:00
Support removing tracker from all torrents in WebUI/WebAPI
Closes #20661. PR #21056.
This commit is contained in:
committed by
GitHub
parent
d19f7b12d9
commit
d2b2afad23
@@ -644,6 +644,12 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
trackerFilterList.appendChild(createLink(TRACKERS_ALL, "QBT_TR(All (%1))QBT_TR[CONTEXT=TrackerFiltersList]", torrentsCount));
|
||||
trackerFilterList.appendChild(createLink(TRACKERS_TRACKERLESS, "QBT_TR(Trackerless (%1))QBT_TR[CONTEXT=TrackerFiltersList]", trackerlessTorrentsCount));
|
||||
|
||||
// Remove unused trackers
|
||||
for (const [key, { trackerTorrentMap }] of trackerList) {
|
||||
if (trackerTorrentMap.size === 0)
|
||||
trackerList.delete(key);
|
||||
}
|
||||
|
||||
// Sort trackers by hostname
|
||||
const sortedList = [];
|
||||
trackerList.forEach(({ host, trackerTorrentMap }, hash) => {
|
||||
|
||||
@@ -36,6 +36,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||
TorrentsTableContextMenu: TorrentsTableContextMenu,
|
||||
CategoriesFilterContextMenu: CategoriesFilterContextMenu,
|
||||
TagsFilterContextMenu: TagsFilterContextMenu,
|
||||
TrackersFilterContextMenu: TrackersFilterContextMenu,
|
||||
SearchPluginsTableContextMenu: SearchPluginsTableContextMenu,
|
||||
RssFeedContextMenu: RssFeedContextMenu,
|
||||
RssArticleContextMenu: RssArticleContextMenu,
|
||||
@@ -604,6 +605,17 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||
}
|
||||
});
|
||||
|
||||
const TrackersFilterContextMenu = new Class({
|
||||
Extends: ContextMenu,
|
||||
updateMenuItems: function() {
|
||||
const id = Number(this.options.element.id);
|
||||
if ((id !== TRACKERS_ALL) && (id !== TRACKERS_TRACKERLESS))
|
||||
this.showItem("deleteTracker");
|
||||
else
|
||||
this.hideItem("deleteTracker");
|
||||
}
|
||||
});
|
||||
|
||||
const SearchPluginsTableContextMenu = new Class({
|
||||
Extends: ContextMenu,
|
||||
|
||||
|
||||
@@ -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 = [];
|
||||
|
||||
Reference in New Issue
Block a user