mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-21 05:43:32 -07:00
WebUI: Support editing tracker tier
This commit is contained in:
parent
e5ea799d3f
commit
3acddf7dc1
2 changed files with 21 additions and 5 deletions
|
@ -26,9 +26,11 @@
|
||||||
|
|
||||||
const searchParams = new URLSearchParams(window.location.search);
|
const searchParams = new URLSearchParams(window.location.search);
|
||||||
const currentUrl = searchParams.get("url");
|
const currentUrl = searchParams.get("url");
|
||||||
if (currentUrl === null)
|
const currentTier = searchParams.get("tier");
|
||||||
|
if ((currentUrl === null) || (currentTier === null))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
document.getElementById("trackerTier").value = currentTier;
|
||||||
document.getElementById("trackerUrl").value = currentUrl;
|
document.getElementById("trackerUrl").value = currentUrl;
|
||||||
document.getElementById("trackerUrl").focus();
|
document.getElementById("trackerUrl").focus();
|
||||||
|
|
||||||
|
@ -41,7 +43,8 @@
|
||||||
body: new URLSearchParams({
|
body: new URLSearchParams({
|
||||||
hash: searchParams.get("hash"),
|
hash: searchParams.get("hash"),
|
||||||
url: currentUrl,
|
url: currentUrl,
|
||||||
newUrl: document.getElementById("trackerUrl").value
|
newUrl: document.getElementById("trackerUrl").value,
|
||||||
|
tier: document.getElementById("trackerTier").value
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
@ -63,6 +66,11 @@
|
||||||
<input type="text" id="trackerUrl" style="width: 90%;">
|
<input type="text" id="trackerUrl" style="width: 90%;">
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
|
<label for="trackerTier">QBT_TR(Tier:)QBT_TR[CONTEXT=TrackerListWidget]</label>
|
||||||
|
<div style="text-align: center; padding-top: 10px;">
|
||||||
|
<input type="number" id="trackerTier" style="width: 90%; max-width: 100px;" min="0" max="255">
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
<input type="button" value="QBT_TR(Edit)QBT_TR[CONTEXT=HttpServer]" id="editTrackerButton">
|
<input type="button" value="QBT_TR(Edit)QBT_TR[CONTEXT=HttpServer]" id="editTrackerButton">
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -255,13 +255,21 @@ window.qBittorrent.PropTrackers ??= (() => {
|
||||||
if (current_hash.length === 0)
|
if (current_hash.length === 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const trackerUrl = encodeURIComponent(torrentTrackersTable.selectedRowsIds()[0]);
|
const tracker = torrentTrackersTable.getRow(torrentTrackersTable.getSelectedRowId());
|
||||||
|
const contentURL = new URL("edittracker.html", window.location);
|
||||||
|
contentURL.search = new URLSearchParams({
|
||||||
|
v: "${CACHEID}",
|
||||||
|
hash: current_hash,
|
||||||
|
url: tracker.full_data.url,
|
||||||
|
tier: tracker.full_data.tier
|
||||||
|
});
|
||||||
|
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: "trackersPage",
|
id: "trackersPage",
|
||||||
icon: "images/qbittorrent-tray.svg",
|
icon: "images/qbittorrent-tray.svg",
|
||||||
title: "QBT_TR(Tracker editing)QBT_TR[CONTEXT=TrackerListWidget]",
|
title: "QBT_TR(Tracker editing)QBT_TR[CONTEXT=TrackerListWidget]",
|
||||||
loadMethod: "iframe",
|
loadMethod: "iframe",
|
||||||
contentURL: `edittracker.html?v=${CACHEID}&hash=${current_hash}&url=${trackerUrl}`,
|
contentURL: contentURL.toString(),
|
||||||
scrollbars: true,
|
scrollbars: true,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -269,7 +277,7 @@ window.qBittorrent.PropTrackers ??= (() => {
|
||||||
paddingVertical: 0,
|
paddingVertical: 0,
|
||||||
paddingHorizontal: 0,
|
paddingHorizontal: 0,
|
||||||
width: window.qBittorrent.Dialog.limitWidthToViewport(500),
|
width: window.qBittorrent.Dialog.limitWidthToViewport(500),
|
||||||
height: 150,
|
height: 200,
|
||||||
onCloseComplete: () => {
|
onCloseComplete: () => {
|
||||||
updateData();
|
updateData();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue