diff --git a/src/webui/www/private/downloadlimit.html b/src/webui/www/private/downloadlimit.html
deleted file mode 100644
index a2155cbb4..000000000
--- a/src/webui/www/private/downloadlimit.html
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
- QBT_TR(Torrent Download Speed Limiting)QBT_TR[CONTEXT=TransferListWidget]
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/webui/www/private/scripts/mocha-init.js b/src/webui/www/private/scripts/mocha-init.js
index 314d84d22..e7473071f 100644
--- a/src/webui/www/private/scripts/mocha-init.js
+++ b/src/webui/www/private/scripts/mocha-init.js
@@ -309,9 +309,10 @@ const initializeWindows = () => {
});
globalUploadLimitFN = () => {
- const contentURL = new URL("uploadlimit.html", window.location);
+ const contentURL = new URL("speedlimit.html", window.location);
contentURL.search = new URLSearchParams({
- hashes: "global"
+ hashes: "global",
+ type: "upload",
});
new MochaUI.Window({
id: "uploadLimitPage",
@@ -334,9 +335,10 @@ const initializeWindows = () => {
if (hashes.length <= 0)
return;
- const contentURL = new URL("uploadlimit.html", window.location);
+ const contentURL = new URL("speedlimit.html", window.location);
contentURL.search = new URLSearchParams({
- hashes: hashes.join("|")
+ hashes: hashes.join("|"),
+ type: "upload",
});
new MochaUI.Window({
id: "uploadLimitPage",
@@ -455,9 +457,10 @@ const initializeWindows = () => {
};
globalDownloadLimitFN = () => {
- const contentURL = new URL("downloadlimit.html", window.location);
+ const contentURL = new URL("speedlimit.html", window.location);
contentURL.search = new URLSearchParams({
- hashes: "global"
+ hashes: "global",
+ type: "download",
});
new MochaUI.Window({
id: "downloadLimitPage",
@@ -498,9 +501,10 @@ const initializeWindows = () => {
if (hashes.length <= 0)
return;
- const contentURL = new URL("downloadlimit.html", window.location);
+ const contentURL = new URL("speedlimit.html", window.location);
contentURL.search = new URLSearchParams({
- hashes: hashes.join("|")
+ hashes: hashes.join("|"),
+ type: "download",
});
new MochaUI.Window({
id: "downloadLimitPage",
diff --git a/src/webui/www/private/scripts/speedslider.js b/src/webui/www/private/scripts/speedslider.js
deleted file mode 100644
index 973fe8c93..000000000
--- a/src/webui/www/private/scripts/speedslider.js
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Bittorrent Client using Qt and libtorrent.
- * Copyright (C) 2019 Thomas Piccirello
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * In addition, as a special exception, the copyright holders give permission to
- * link this program with the OpenSSL project's "OpenSSL" library (or with
- * modified versions of it that use the same license as the "OpenSSL" library),
- * and distribute the linked executables. You must obey the GNU General Public
- * License in all respects for all of the code used other than "OpenSSL". If you
- * modify file(s), you may extend this exception to your version of the file(s),
- * but you are not obligated to do so. If you do not wish to do so, delete this
- * exception statement from your version.
- */
-
-"use strict";
-
-window.qBittorrent ??= {};
-window.qBittorrent.SpeedSlider ??= (() => {
- const exports = () => {
- return {
- setup: setup,
- setLimit: setLimit,
- };
- };
-
- const hashes = new URLSearchParams(window.location.search).get("hashes").split("|");
-
- const setup = (type) => {
- window.addEventListener("keydown", (event) => {
- switch (event.key) {
- case "Enter":
- event.preventDefault();
- document.getElementById("applyButton").click();
- break;
- case "Escape":
- event.preventDefault();
- window.parent.qBittorrent.Client.closeFrameWindow(window);
- break;
- }
- });
-
- const method = type === "upload" ? "uploadLimit" : "downloadLimit";
-
- // Get global upload limit
- fetch(`api/v2/transfer/${method}`, {
- method: "GET",
- cache: "no-store"
- })
- .then(async (response) => {
- if (!response.ok)
- return;
-
- const data = await response.text();
-
- let maximum = 500;
- const tmp = Number(data);
- if (tmp > 0) {
- maximum = tmp / 1024.0;
- }
- else {
- if (hashes[0] === "global")
- maximum = 10000;
- else
- maximum = 1000;
- }
-
- // Get torrents download limit
- // And create slider
- if (hashes[0] === "global") {
- let limit = maximum;
- if (limit < 0)
- limit = 0;
- maximum = 10000;
-
- setupSlider(Math.round(limit), maximum);
- }
- else {
- fetch(`api/v2/torrents/${method}`, {
- method: "POST",
- body: new URLSearchParams({
- hashes: hashes.join("|")
- })
- })
- .then(async (response) => {
- if (!response.ok)
- return;
-
- const data = await response.json();
-
- let limit = data[hashes[0]];
- for (const key in data) {
- if (limit !== data[key]) {
- limit = 0;
- break;
- }
- }
- if (limit < 0)
- limit = 0;
-
- setupSlider(Math.round(limit / 1024), maximum);
- });
- }
- });
- };
-
- const setupSlider = (limit, maximum) => {
- const input = document.getElementById("limitSliderInput");
- input.setAttribute("max", maximum);
- input.setAttribute("min", 0);
- input.value = limit;
- input.addEventListener("input", (event) => {
- const pos = Number(event.target.value);
- if (pos > 0) {
- document.getElementById("limitUpdatevalue").value = pos;
- document.getElementById("limitUnit").style.visibility = "visible";
- }
- else {
- document.getElementById("limitUpdatevalue").value = "∞";
- document.getElementById("limitUnit").style.visibility = "hidden";
- }
- });
- // Set default value
- if (limit === 0) {
- document.getElementById("limitUpdatevalue").value = "∞";
- document.getElementById("limitUnit").style.visibility = "hidden";
- }
- else {
- document.getElementById("limitUpdatevalue").value = limit;
- document.getElementById("limitUnit").style.visibility = "visible";
- }
- };
-
- const setLimit = (type) => {
- const limit = Number(document.getElementById("limitUpdatevalue").value) * 1024;
- const method = type === "upload" ? "setUploadLimit" : "setDownloadLimit";
- if (hashes[0] === "global") {
- fetch(`api/v2/transfer/${method}`, {
- method: "POST",
- body: new URLSearchParams({
- limit: limit
- })
- })
- .then((response) => {
- if (!response.ok)
- return;
-
- window.parent.updateMainData();
- window.parent.qBittorrent.Client.closeFrameWindow(window);
- });
- }
- else {
- fetch(`api/v2/torrents/${method}`, {
- method: "POST",
- body: new URLSearchParams({
- hashes: hashes.join("|"),
- limit: limit
- })
- })
- .then((response) => {
- if (!response.ok)
- return;
-
- window.parent.qBittorrent.Client.closeFrameWindow(window);
- });
- }
- };
-
- return exports();
-})();
-Object.freeze(window.qBittorrent.SpeedSlider);
diff --git a/src/webui/www/private/speedlimit.html b/src/webui/www/private/speedlimit.html
new file mode 100644
index 000000000..277cfd83c
--- /dev/null
+++ b/src/webui/www/private/speedlimit.html
@@ -0,0 +1,174 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/webui/www/private/uploadlimit.html b/src/webui/www/private/uploadlimit.html
deleted file mode 100644
index 6c1c08509..000000000
--- a/src/webui/www/private/uploadlimit.html
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
- QBT_TR(Torrent Upload Speed Limiting)QBT_TR[CONTEXT=TransferListWidget]
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/webui/www/webui.qrc b/src/webui/www/webui.qrc
index 5a99f1459..7d9fc8343 100644
--- a/src/webui/www/webui.qrc
+++ b/src/webui/www/webui.qrc
@@ -16,7 +16,6 @@
private/css/vanillaSelectBox.css
private/css/Window.css
private/download.html
- private/downloadlimit.html
private/editfeedurl.html
private/edittracker.html
private/editwebseed.html
@@ -416,11 +415,10 @@
private/scripts/prop-webseeds.js
private/scripts/rename-files.js
private/scripts/search.js
- private/scripts/speedslider.js
private/setlocation.html
private/shareratio.html
+ private/speedlimit.html
private/upload.html
- private/uploadlimit.html
private/views/about.html
private/views/aboutToolbar.html
private/views/confirmAutoTMM.html