mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 04:49:47 -07:00
parent
11991e62f5
commit
c622d50814
28 changed files with 292 additions and 203 deletions
|
@ -22,8 +22,8 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const hash = new URI().getData("hash");
|
const hash = new URLSearchParams(window.location.search).get("hash");
|
||||||
if (!hash)
|
if (hash === null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$("peers").focus();
|
$("peers").focus();
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
fetch("api/v2/torrents/addTrackers", {
|
fetch("api/v2/torrents/addTrackers", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: new URLSearchParams({
|
body: new URLSearchParams({
|
||||||
hash: new URI().getData("hash"),
|
hash: new URLSearchParams(window.location.search).get("hash"),
|
||||||
urls: $("trackersUrls").value
|
urls: $("trackersUrls").value
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
fetch("api/v2/torrents/addWebSeeds", {
|
fetch("api/v2/torrents/addWebSeeds", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: new URLSearchParams({
|
body: new URLSearchParams({
|
||||||
hash: new URI().getData("hash"),
|
hash: new URLSearchParams(window.location.search).get("hash"),
|
||||||
urls: $("urls").value.split("\n").map(w => encodeURIComponent(w.trim())).filter(w => (w.length > 0)).join("|")
|
urls: $("urls").value.split("\n").map(w => encodeURIComponent(w.trim())).filter(w => (w.length > 0)).join("|")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", () => {
|
window.addEventListener("DOMContentLoaded", () => {
|
||||||
const paths = new URI().getData("paths").split("|");
|
|
||||||
$("cancelBtn").focus();
|
$("cancelBtn").focus();
|
||||||
$("cancelBtn").addEventListener("click", (e) => {
|
$("cancelBtn").addEventListener("click", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -25,7 +24,8 @@
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
let completionCount = 0;
|
let completionCount = 0;
|
||||||
paths.forEach((path) => {
|
const paths = new URLSearchParams(window.location.search).get("paths").split("|");
|
||||||
|
for (const path of paths) {
|
||||||
fetch("api/v2/rss/removeItem", {
|
fetch("api/v2/rss/removeItem", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: new URLSearchParams({
|
body: new URLSearchParams({
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
window.parent.qBittorrent.Client.closeFrameWindow(window);
|
window.parent.qBittorrent.Client.closeFrameWindow(window);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", () => {
|
window.addEventListener("DOMContentLoaded", () => {
|
||||||
const rules = new URI().getData("rules").split("|");
|
|
||||||
|
|
||||||
$("cancelBtn").focus();
|
$("cancelBtn").focus();
|
||||||
$("cancelBtn").addEventListener("click", (e) => {
|
$("cancelBtn").addEventListener("click", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -26,7 +24,8 @@
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
let completionCount = 0;
|
let completionCount = 0;
|
||||||
rules.forEach((rule) => {
|
const rules = new URLSearchParams(window.location.search).get("rules").split("|");
|
||||||
|
for (const rule of rules) {
|
||||||
window.parent.qBittorrent.RssDownloader.modifyRuleState(decodeURIComponent(rule), "previouslyMatchedEpisodes", [], () => {
|
window.parent.qBittorrent.RssDownloader.modifyRuleState(decodeURIComponent(rule), "previouslyMatchedEpisodes", [], () => {
|
||||||
++completionCount;
|
++completionCount;
|
||||||
if (completionCount === rules.length) {
|
if (completionCount === rules.length) {
|
||||||
|
@ -34,7 +33,7 @@
|
||||||
window.parent.qBittorrent.Client.closeFrameWindow(window);
|
window.parent.qBittorrent.Client.closeFrameWindow(window);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", () => {
|
window.addEventListener("DOMContentLoaded", () => {
|
||||||
const rules = new URI().getData("rules").split("|");
|
|
||||||
|
|
||||||
$("cancelBtn").focus();
|
$("cancelBtn").focus();
|
||||||
$("cancelBtn").addEventListener("click", (e) => {
|
$("cancelBtn").addEventListener("click", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -26,7 +24,8 @@
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
let completionCount = 0;
|
let completionCount = 0;
|
||||||
rules.forEach((rule) => {
|
const rules = new URLSearchParams(window.location.search).get("rules").split("|");
|
||||||
|
for (const rule of rules) {
|
||||||
fetch("api/v2/rss/removeRule", {
|
fetch("api/v2/rss/removeRule", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: new URLSearchParams({
|
body: new URLSearchParams({
|
||||||
|
@ -43,7 +42,7 @@
|
||||||
window.parent.qBittorrent.Client.closeFrameWindow(window);
|
window.parent.qBittorrent.Client.closeFrameWindow(window);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -13,9 +13,10 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", () => {
|
window.addEventListener("DOMContentLoaded", () => {
|
||||||
const host = new URI().getData("host");
|
const searchParams = new URLSearchParams(window.location.search);
|
||||||
const urls = new URI().getData("urls");
|
const host = searchParams.get("host");
|
||||||
$("confirmDeleteTrackerText").textContent = "QBT_TR(Are you sure you want to remove tracker %1 from all torrents?)QBT_TR[CONTEXT=TrackersFilterWidget]".replace("%1", `"${host}"`);
|
|
||||||
|
$("confirmDeleteTrackerText").textContent = "QBT_TR(Are you sure you want to remove tracker %1 from all torrents?)QBT_TR[CONTEXT=TrackersFilterWidget]".replace("%1", host);
|
||||||
|
|
||||||
$("cancelBtn").focus();
|
$("cancelBtn").focus();
|
||||||
$("cancelBtn").addEventListener("click", (e) => {
|
$("cancelBtn").addEventListener("click", (e) => {
|
||||||
|
@ -29,7 +30,7 @@
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: new URLSearchParams({
|
body: new URLSearchParams({
|
||||||
hash: "*",
|
hash: "*",
|
||||||
urls: urls
|
urls: searchParams.get("urls")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
|
|
@ -163,13 +163,10 @@
|
||||||
<script>
|
<script>
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const encodedUrls = new URI().getData("urls");
|
const encodedUrls = new URLSearchParams(window.location.search).get("urls");
|
||||||
if (encodedUrls) {
|
if (encodedUrls !== null) {
|
||||||
const urls = encodedUrls.split("|").map((url) => {
|
const urls = encodedUrls.split("|").map(decodeURIComponent);
|
||||||
return decodeURIComponent(url);
|
if (urls.length > 0)
|
||||||
});
|
|
||||||
|
|
||||||
if (urls.length)
|
|
||||||
$("urls").value = urls.join("\n");
|
$("urls").value = urls.join("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const hashes = new URI().getData("hashes").split("|");
|
const hashes = new URLSearchParams(window.location.search).get("hashes").split("|");
|
||||||
const setDlLimit = () => {
|
const setDlLimit = () => {
|
||||||
const limit = Number($("dllimitUpdatevalue").value) * 1024;
|
const limit = Number($("dllimitUpdatevalue").value) * 1024;
|
||||||
if (hashes[0] === "global") {
|
if (hashes[0] === "global") {
|
||||||
|
|
|
@ -27,7 +27,8 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const currentUrl = new URI().getData("url");
|
const searchParams = new URLSearchParams(window.location.search);
|
||||||
|
const currentUrl = searchParams.get("url");
|
||||||
|
|
||||||
$("url").value = currentUrl;
|
$("url").value = currentUrl;
|
||||||
$("url").focus();
|
$("url").focus();
|
||||||
|
@ -54,7 +55,7 @@
|
||||||
fetch("api/v2/rss/setFeedURL", {
|
fetch("api/v2/rss/setFeedURL", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: new URLSearchParams({
|
body: new URLSearchParams({
|
||||||
path: new URI().getData("path"),
|
path: searchParams.get("path"),
|
||||||
url: newUrl
|
url: newUrl
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -26,8 +26,9 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const currentUrl = new URI().getData("url");
|
const searchParams = new URLSearchParams(window.location.search);
|
||||||
if (!currentUrl)
|
const currentUrl = searchParams.get("url");
|
||||||
|
if (currentUrl === null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$("trackerUrl").value = currentUrl;
|
$("trackerUrl").value = currentUrl;
|
||||||
|
@ -40,7 +41,7 @@
|
||||||
fetch("api/v2/torrents/editTracker", {
|
fetch("api/v2/torrents/editTracker", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: new URLSearchParams({
|
body: new URLSearchParams({
|
||||||
hash: new URI().getData("hash"),
|
hash: searchParams.get("hash"),
|
||||||
origUrl: currentUrl,
|
origUrl: currentUrl,
|
||||||
newUrl: $("trackerUrl").value
|
newUrl: $("trackerUrl").value
|
||||||
})
|
})
|
||||||
|
|
|
@ -26,7 +26,8 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const origUrl = new URI().getData("url");
|
const searchParams = new URLSearchParams(window.location.search);
|
||||||
|
const origUrl = searchParams.get("url");
|
||||||
$("url").value = decodeURIComponent(origUrl);
|
$("url").value = decodeURIComponent(origUrl);
|
||||||
$("url").focus();
|
$("url").focus();
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@
|
||||||
fetch("api/v2/torrents/editWebSeed", {
|
fetch("api/v2/torrents/editWebSeed", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: new URLSearchParams({
|
body: new URLSearchParams({
|
||||||
hash: new URI().getData("hash"),
|
hash: searchParams.get("hash"),
|
||||||
origUrl: origUrl,
|
origUrl: origUrl,
|
||||||
newUrl: encodeURIComponent($("url").value.trim())
|
newUrl: encodeURIComponent($("url").value.trim())
|
||||||
})
|
})
|
||||||
|
|
|
@ -28,10 +28,11 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const uriAction = window.qBittorrent.Misc.safeTrim(new URI().getData("action"));
|
const searchParams = new URLSearchParams(window.location.search);
|
||||||
const uriHashes = window.qBittorrent.Misc.safeTrim(new URI().getData("hashes"));
|
const uriAction = window.qBittorrent.Misc.safeTrim(searchParams.get("action"));
|
||||||
const uriCategoryName = window.qBittorrent.Misc.safeTrim(new URI().getData("categoryName"));
|
const uriHashes = window.qBittorrent.Misc.safeTrim(searchParams.get("hashes"));
|
||||||
const uriSavePath = window.qBittorrent.Misc.safeTrim(new URI().getData("savePath"));
|
const uriCategoryName = window.qBittorrent.Misc.safeTrim(searchParams.get("categoryName"));
|
||||||
|
const uriSavePath = window.qBittorrent.Misc.safeTrim(searchParams.get("savePath"));
|
||||||
|
|
||||||
if (uriAction === "edit") {
|
if (uriAction === "edit") {
|
||||||
if (!uriCategoryName)
|
if (!uriCategoryName)
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
$("feedURL").focus();
|
$("feedURL").focus();
|
||||||
const path = new URI().getData("path");
|
|
||||||
$("submitButton").addEventListener("click", (e) => {
|
$("submitButton").addEventListener("click", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
@ -42,11 +41,12 @@
|
||||||
|
|
||||||
$("submitButton").disabled = true;
|
$("submitButton").disabled = true;
|
||||||
|
|
||||||
|
const path = new URLSearchParams(window.location.search).get("path");
|
||||||
fetch("api/v2/rss/addFeed", {
|
fetch("api/v2/rss/addFeed", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: new URLSearchParams({
|
body: new URLSearchParams({
|
||||||
url: feedURL,
|
url: feedURL,
|
||||||
path: path ? (path + "\\" + feedURL) : ""
|
path: (((path !== null) && (path.length > 0)) ? `${path}\\${feedURL}` : "")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then(async (response) => {
|
.then(async (response) => {
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
$("folderName").focus();
|
$("folderName").focus();
|
||||||
const path = new URI().getData("path");
|
|
||||||
$("submitButton").addEventListener("click", (e) => {
|
$("submitButton").addEventListener("click", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
@ -43,10 +42,11 @@
|
||||||
|
|
||||||
$("submitButton").disabled = true;
|
$("submitButton").disabled = true;
|
||||||
|
|
||||||
|
const path = new URLSearchParams(window.location.search).get("path");
|
||||||
fetch("api/v2/rss/addFolder", {
|
fetch("api/v2/rss/addFolder", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: new URLSearchParams({
|
body: new URLSearchParams({
|
||||||
path: path ? (path + "\\" + folderName) : folderName
|
path: (((path !== null) && (path.length > 0)) ? `${path}\\${folderName}` : folderName)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then(async (response) => {
|
.then(async (response) => {
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const uriAction = window.qBittorrent.Misc.safeTrim(new URI().getData("action"));
|
const searchParams = new URLSearchParams(window.location.search);
|
||||||
const uriHashes = window.qBittorrent.Misc.safeTrim(new URI().getData("hashes"));
|
const uriAction = window.qBittorrent.Misc.safeTrim(searchParams.get("action"));
|
||||||
|
|
||||||
if (uriAction === "create")
|
if (uriAction === "create")
|
||||||
$("legendText").textContent = "QBT_TR(Tag:)QBT_TR[CONTEXT=TagFilterWidget]";
|
$("legendText").textContent = "QBT_TR(Tag:)QBT_TR[CONTEXT=TagFilterWidget]";
|
||||||
|
@ -52,8 +52,9 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (uriAction) {
|
switch (uriAction) {
|
||||||
case "set":
|
case "set": {
|
||||||
if (uriHashes === "")
|
const uriHashes = window.qBittorrent.Misc.safeTrim(searchParams.get("hashes"));
|
||||||
|
if ((uriHashes === null) || (uriHashes.length <= 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fetch("api/v2/torrents/addTags", {
|
fetch("api/v2/torrents/addTags", {
|
||||||
|
@ -70,6 +71,7 @@
|
||||||
window.parent.qBittorrent.Client.closeFrameWindow(window);
|
window.parent.qBittorrent.Client.closeFrameWindow(window);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case "create":
|
case "create":
|
||||||
if (!verifyTagName(tagName))
|
if (!verifyTagName(tagName))
|
||||||
|
|
|
@ -27,9 +27,10 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const name = new URI().getData("name");
|
const searchParams = new URLSearchParams(window.location.search);
|
||||||
|
const name = searchParams.get("name");
|
||||||
// set text field to current value
|
// set text field to current value
|
||||||
if (name)
|
if (name !== null)
|
||||||
$("rename").value = name;
|
$("rename").value = name;
|
||||||
|
|
||||||
$("rename").focus();
|
$("rename").focus();
|
||||||
|
@ -42,8 +43,8 @@
|
||||||
if ((name === null) || (name === ""))
|
if ((name === null) || (name === ""))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const hash = new URI().getData("hash");
|
const hash = searchParams.get("hash");
|
||||||
if (hash) {
|
if (hash !== null) {
|
||||||
fetch("api/v2/torrents/rename", {
|
fetch("api/v2/torrents/rename", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: new URLSearchParams({
|
body: new URLSearchParams({
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const oldPath = new URI().getData("oldPath");
|
const oldPath = new URLSearchParams(window.location.search).get("oldPath");
|
||||||
|
|
||||||
$("rename").value = oldPath;
|
$("rename").value = oldPath;
|
||||||
$("rename").focus();
|
$("rename").focus();
|
||||||
|
|
|
@ -28,9 +28,10 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const hash = new URI().getData("hash");
|
const searchParams = new URLSearchParams(window.location.search);
|
||||||
const oldPath = new URI().getData("path");
|
const hash = searchParams.get("hash");
|
||||||
const isFolder = ((new URI().getData("isFolder")) === "true");
|
const oldPath = searchParams.get("path");
|
||||||
|
const isFolder = ((searchParams.get("isFolder")) === "true");
|
||||||
|
|
||||||
const oldName = window.qBittorrent.Filesystem.fileName(oldPath);
|
const oldName = window.qBittorrent.Filesystem.fileName(oldPath);
|
||||||
$("rename").value = oldName;
|
$("rename").value = oldName;
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const oldName = new URI().getData("rule");
|
const oldName = new URLSearchParams(window.location.search).get("rule");
|
||||||
|
|
||||||
$("rename").value = oldName;
|
$("rename").value = oldName;
|
||||||
$("rename").focus();
|
$("rename").focus();
|
||||||
|
|
|
@ -1656,7 +1656,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
icon: "images/qbittorrent-tray.svg",
|
icon: "images/qbittorrent-tray.svg",
|
||||||
title: "QBT_TR(Upload local torrent)QBT_TR[CONTEXT=HttpServer]",
|
title: "QBT_TR(Upload local torrent)QBT_TR[CONTEXT=HttpServer]",
|
||||||
loadMethod: "iframe",
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("upload.html").toString(),
|
contentURL: "upload.html",
|
||||||
addClass: "windowFrame", // fixes iframe scrolling on iOS Safari
|
addClass: "windowFrame", // fixes iframe scrolling on iOS Safari
|
||||||
scrollbars: true,
|
scrollbars: true,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -1693,13 +1693,16 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const id = "downloadPage";
|
const id = "downloadPage";
|
||||||
const contentURI = new URI("download.html").setData("urls", urls.map(encodeURIComponent).join("|"));
|
const contentURL = new URL("download.html", window.location);
|
||||||
|
contentURL.search = new URLSearchParams({
|
||||||
|
urls: urls.map(encodeURIComponent).join("|")
|
||||||
|
});
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: id,
|
id: id,
|
||||||
icon: "images/qbittorrent-tray.svg",
|
icon: "images/qbittorrent-tray.svg",
|
||||||
title: "QBT_TR(Download from URLs)QBT_TR[CONTEXT=downloadFromURL]",
|
title: "QBT_TR(Download from URLs)QBT_TR[CONTEXT=downloadFromURL]",
|
||||||
loadMethod: "iframe",
|
loadMethod: "iframe",
|
||||||
contentURL: contentURI.toString(),
|
contentURL: contentURL.toString(),
|
||||||
addClass: "windowFrame", // fixes iframe scrolling on iOS Safari
|
addClass: "windowFrame", // fixes iframe scrolling on iOS Safari
|
||||||
scrollbars: true,
|
scrollbars: true,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
|
|
@ -179,17 +179,20 @@ const initializeWindows = () => {
|
||||||
|
|
||||||
showDownloadPage = (urls) => {
|
showDownloadPage = (urls) => {
|
||||||
const id = "downloadPage";
|
const id = "downloadPage";
|
||||||
const contentUri = new URI("download.html");
|
const contentURL = new URL("download.html", window.location);
|
||||||
|
|
||||||
if (urls && (urls.length > 0))
|
if (urls && (urls.length > 0)) {
|
||||||
contentUri.setData("urls", urls.map(encodeURIComponent).join("|"));
|
contentURL.search = new URLSearchParams({
|
||||||
|
urls: urls.map(encodeURIComponent).join("|")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: id,
|
id: id,
|
||||||
icon: "images/qbittorrent-tray.svg",
|
icon: "images/qbittorrent-tray.svg",
|
||||||
title: "QBT_TR(Download from URLs)QBT_TR[CONTEXT=downloadFromURL]",
|
title: "QBT_TR(Download from URLs)QBT_TR[CONTEXT=downloadFromURL]",
|
||||||
loadMethod: "iframe",
|
loadMethod: "iframe",
|
||||||
contentURL: contentUri.toString(),
|
contentURL: contentURL.toString(),
|
||||||
addClass: "windowFrame", // fixes iframe scrolling on iOS Safari
|
addClass: "windowFrame", // fixes iframe scrolling on iOS Safari
|
||||||
scrollbars: true,
|
scrollbars: true,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -216,7 +219,7 @@ const initializeWindows = () => {
|
||||||
title: "QBT_TR(Options)QBT_TR[CONTEXT=OptionsDialog]",
|
title: "QBT_TR(Options)QBT_TR[CONTEXT=OptionsDialog]",
|
||||||
loadMethod: "xhr",
|
loadMethod: "xhr",
|
||||||
toolbar: true,
|
toolbar: true,
|
||||||
contentURL: new URI("views/preferences.html").toString(),
|
contentURL: "views/preferences.html",
|
||||||
require: {
|
require: {
|
||||||
css: ["css/Tabs.css"]
|
css: ["css/Tabs.css"]
|
||||||
},
|
},
|
||||||
|
@ -242,7 +245,7 @@ const initializeWindows = () => {
|
||||||
id: id,
|
id: id,
|
||||||
title: "QBT_TR(Manage Cookies)QBT_TR[CONTEXT=CookiesDialog]",
|
title: "QBT_TR(Manage Cookies)QBT_TR[CONTEXT=CookiesDialog]",
|
||||||
loadMethod: "xhr",
|
loadMethod: "xhr",
|
||||||
contentURL: new URI("views/cookies.html").toString(),
|
contentURL: "views/cookies.html",
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
paddingVertical: 0,
|
paddingVertical: 0,
|
||||||
paddingHorizontal: 0,
|
paddingHorizontal: 0,
|
||||||
|
@ -264,7 +267,7 @@ const initializeWindows = () => {
|
||||||
icon: "images/qbittorrent-tray.svg",
|
icon: "images/qbittorrent-tray.svg",
|
||||||
title: "QBT_TR(Upload local torrent)QBT_TR[CONTEXT=HttpServer]",
|
title: "QBT_TR(Upload local torrent)QBT_TR[CONTEXT=HttpServer]",
|
||||||
loadMethod: "iframe",
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("upload.html").toString(),
|
contentURL: "upload.html",
|
||||||
addClass: "windowFrame", // fixes iframe scrolling on iOS Safari
|
addClass: "windowFrame", // fixes iframe scrolling on iOS Safari
|
||||||
scrollbars: true,
|
scrollbars: true,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -280,12 +283,16 @@ const initializeWindows = () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
globalUploadLimitFN = () => {
|
globalUploadLimitFN = () => {
|
||||||
|
const contentURL = new URL("uploadlimit.html", window.location);
|
||||||
|
contentURL.search = new URLSearchParams({
|
||||||
|
hashes: "global"
|
||||||
|
});
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: "uploadLimitPage",
|
id: "uploadLimitPage",
|
||||||
icon: "images/qbittorrent-tray.svg",
|
icon: "images/qbittorrent-tray.svg",
|
||||||
title: "QBT_TR(Global Upload Speed Limit)QBT_TR[CONTEXT=MainWindow]",
|
title: "QBT_TR(Global Upload Speed Limit)QBT_TR[CONTEXT=MainWindow]",
|
||||||
loadMethod: "iframe",
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("uploadlimit.html").setData("hashes", "global").toString(),
|
contentURL: contentURL.toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -298,63 +305,73 @@ const initializeWindows = () => {
|
||||||
|
|
||||||
uploadLimitFN = () => {
|
uploadLimitFN = () => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length <= 0)
|
||||||
new MochaUI.Window({
|
return;
|
||||||
id: "uploadLimitPage",
|
|
||||||
icon: "images/qbittorrent-tray.svg",
|
const contentURL = new URL("uploadlimit.html", window.location);
|
||||||
title: "QBT_TR(Torrent Upload Speed Limiting)QBT_TR[CONTEXT=TransferListWidget]",
|
contentURL.search = new URLSearchParams({
|
||||||
loadMethod: "iframe",
|
hashes: hashes.join("|")
|
||||||
contentURL: new URI("uploadlimit.html").setData("hashes", hashes.join("|")).toString(),
|
});
|
||||||
scrollbars: false,
|
new MochaUI.Window({
|
||||||
resizable: false,
|
id: "uploadLimitPage",
|
||||||
maximizable: false,
|
icon: "images/qbittorrent-tray.svg",
|
||||||
paddingVertical: 0,
|
title: "QBT_TR(Torrent Upload Speed Limiting)QBT_TR[CONTEXT=TransferListWidget]",
|
||||||
paddingHorizontal: 0,
|
loadMethod: "iframe",
|
||||||
width: 424,
|
contentURL: contentURL.toString(),
|
||||||
height: 100
|
scrollbars: false,
|
||||||
});
|
resizable: false,
|
||||||
}
|
maximizable: false,
|
||||||
|
paddingVertical: 0,
|
||||||
|
paddingHorizontal: 0,
|
||||||
|
width: 424,
|
||||||
|
height: 100
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
shareRatioFN = () => {
|
shareRatioFN = () => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length <= 0)
|
||||||
let shareRatio = null;
|
return;
|
||||||
let torrentsHaveSameShareRatio = true;
|
|
||||||
|
|
||||||
// check if all selected torrents have same share ratio
|
let shareRatio = null;
|
||||||
for (let i = 0; i < hashes.length; ++i) {
|
let torrentsHaveSameShareRatio = true;
|
||||||
const hash = hashes[i];
|
|
||||||
const row = torrentsTable.getRow(hash).full_data;
|
|
||||||
const origValues = row.ratio_limit + "|" + row.seeding_time_limit + "|" + row.inactive_seeding_time_limit + "|"
|
|
||||||
+ row.max_ratio + "|" + row.max_seeding_time + "|" + row.max_inactive_seeding_time;
|
|
||||||
|
|
||||||
// initialize value
|
// check if all selected torrents have same share ratio
|
||||||
if (shareRatio === null)
|
for (let i = 0; i < hashes.length; ++i) {
|
||||||
shareRatio = origValues;
|
const hash = hashes[i];
|
||||||
|
const row = torrentsTable.getRow(hash).full_data;
|
||||||
|
const origValues = row.ratio_limit + "|" + row.seeding_time_limit + "|" + row.inactive_seeding_time_limit + "|"
|
||||||
|
+ row.max_ratio + "|" + row.max_seeding_time + "|" + row.max_inactive_seeding_time;
|
||||||
|
|
||||||
if (origValues !== shareRatio) {
|
// initialize value
|
||||||
torrentsHaveSameShareRatio = false;
|
if (shareRatio === null)
|
||||||
break;
|
shareRatio = origValues;
|
||||||
}
|
|
||||||
|
if (origValues !== shareRatio) {
|
||||||
|
torrentsHaveSameShareRatio = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if all torrents have same share ratio, display that share ratio. else use the default
|
|
||||||
const orig = torrentsHaveSameShareRatio ? shareRatio : "";
|
|
||||||
new MochaUI.Window({
|
|
||||||
id: "shareRatioPage",
|
|
||||||
icon: "images/qbittorrent-tray.svg",
|
|
||||||
title: "QBT_TR(Torrent Upload/Download Ratio Limiting)QBT_TR[CONTEXT=UpDownRatioDialog]",
|
|
||||||
loadMethod: "iframe",
|
|
||||||
contentURL: new URI("shareratio.html").setData("hashes", hashes.join("|")).setData("orig", orig).toString(),
|
|
||||||
scrollbars: false,
|
|
||||||
maximizable: false,
|
|
||||||
paddingVertical: 0,
|
|
||||||
paddingHorizontal: 0,
|
|
||||||
width: 424,
|
|
||||||
height: 220
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const contentURL = new URL("shareratio.html", window.location);
|
||||||
|
contentURL.search = new URLSearchParams({
|
||||||
|
hashes: hashes.join("|"),
|
||||||
|
// if all torrents have same share ratio, display that share ratio. else use the default
|
||||||
|
orig: torrentsHaveSameShareRatio ? shareRatio : ""
|
||||||
|
});
|
||||||
|
new MochaUI.Window({
|
||||||
|
id: "shareRatioPage",
|
||||||
|
icon: "images/qbittorrent-tray.svg",
|
||||||
|
title: "QBT_TR(Torrent Upload/Download Ratio Limiting)QBT_TR[CONTEXT=UpDownRatioDialog]",
|
||||||
|
loadMethod: "iframe",
|
||||||
|
contentURL: contentURL.toString(),
|
||||||
|
scrollbars: false,
|
||||||
|
maximizable: false,
|
||||||
|
paddingVertical: 0,
|
||||||
|
paddingHorizontal: 0,
|
||||||
|
width: 424,
|
||||||
|
height: 220
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
toggleSequentialDownloadFN = () => {
|
toggleSequentialDownloadFN = () => {
|
||||||
|
@ -412,12 +429,16 @@ const initializeWindows = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
globalDownloadLimitFN = () => {
|
globalDownloadLimitFN = () => {
|
||||||
|
const contentURL = new URL("downloadlimit.html", window.location);
|
||||||
|
contentURL.search = new URLSearchParams({
|
||||||
|
hashes: "global"
|
||||||
|
});
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: "downloadLimitPage",
|
id: "downloadLimitPage",
|
||||||
icon: "images/qbittorrent-tray.svg",
|
icon: "images/qbittorrent-tray.svg",
|
||||||
title: "QBT_TR(Global Download Speed Limit)QBT_TR[CONTEXT=MainWindow]",
|
title: "QBT_TR(Global Download Speed Limit)QBT_TR[CONTEXT=MainWindow]",
|
||||||
loadMethod: "iframe",
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("downloadlimit.html").setData("hashes", "global").toString(),
|
contentURL: contentURL.toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -435,7 +456,7 @@ const initializeWindows = () => {
|
||||||
icon: "images/qbittorrent-tray.svg",
|
icon: "images/qbittorrent-tray.svg",
|
||||||
title: "QBT_TR(Statistics)QBT_TR[CONTEXT=StatsDialog]",
|
title: "QBT_TR(Statistics)QBT_TR[CONTEXT=StatsDialog]",
|
||||||
loadMethod: "xhr",
|
loadMethod: "xhr",
|
||||||
contentURL: new URI("views/statistics.html").toString(),
|
contentURL: "views/statistics.html",
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
padding: 10,
|
padding: 10,
|
||||||
width: loadWindowWidth(id, 285),
|
width: loadWindowWidth(id, 285),
|
||||||
|
@ -448,22 +469,27 @@ const initializeWindows = () => {
|
||||||
|
|
||||||
downloadLimitFN = () => {
|
downloadLimitFN = () => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length <= 0)
|
||||||
new MochaUI.Window({
|
return;
|
||||||
id: "downloadLimitPage",
|
|
||||||
icon: "images/qbittorrent-tray.svg",
|
const contentURL = new URL("downloadlimit.html", window.location);
|
||||||
title: "QBT_TR(Torrent Download Speed Limiting)QBT_TR[CONTEXT=TransferListWidget]",
|
contentURL.search = new URLSearchParams({
|
||||||
loadMethod: "iframe",
|
hashes: hashes.join("|")
|
||||||
contentURL: new URI("downloadlimit.html").setData("hashes", hashes.join("|")).toString(),
|
});
|
||||||
scrollbars: false,
|
new MochaUI.Window({
|
||||||
resizable: false,
|
id: "downloadLimitPage",
|
||||||
maximizable: false,
|
icon: "images/qbittorrent-tray.svg",
|
||||||
paddingVertical: 0,
|
title: "QBT_TR(Torrent Download Speed Limiting)QBT_TR[CONTEXT=TransferListWidget]",
|
||||||
paddingHorizontal: 0,
|
loadMethod: "iframe",
|
||||||
width: 424,
|
contentURL: contentURL.toString(),
|
||||||
height: 100
|
scrollbars: false,
|
||||||
});
|
resizable: false,
|
||||||
}
|
maximizable: false,
|
||||||
|
paddingVertical: 0,
|
||||||
|
paddingHorizontal: 0,
|
||||||
|
width: 424,
|
||||||
|
height: 100
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
deleteSelectedTorrentsFN = (forceDeleteFiles = false) => {
|
deleteSelectedTorrentsFN = (forceDeleteFiles = false) => {
|
||||||
|
@ -625,49 +651,58 @@ const initializeWindows = () => {
|
||||||
|
|
||||||
setLocationFN = () => {
|
setLocationFN = () => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length) {
|
if (hashes.length <= 0)
|
||||||
const hash = hashes[0];
|
return;
|
||||||
const row = torrentsTable.getRow(hash);
|
|
||||||
|
|
||||||
new MochaUI.Window({
|
const contentURL = new URL("setlocation.html", window.location);
|
||||||
id: "setLocationPage",
|
contentURL.search = new URLSearchParams({
|
||||||
icon: "images/qbittorrent-tray.svg",
|
hashes: hashes.join("|"),
|
||||||
title: "QBT_TR(Set location)QBT_TR[CONTEXT=TransferListWidget]",
|
path: encodeURIComponent(torrentsTable.getRow(hashes[0]).full_data.save_path)
|
||||||
loadMethod: "iframe",
|
});
|
||||||
contentURL: new URI("setlocation.html").setData("hashes", hashes.join("|")).setData("path", encodeURIComponent(row.full_data.save_path)).toString(),
|
new MochaUI.Window({
|
||||||
scrollbars: false,
|
id: "setLocationPage",
|
||||||
resizable: true,
|
icon: "images/qbittorrent-tray.svg",
|
||||||
maximizable: false,
|
title: "QBT_TR(Set location)QBT_TR[CONTEXT=TransferListWidget]",
|
||||||
paddingVertical: 0,
|
loadMethod: "iframe",
|
||||||
paddingHorizontal: 0,
|
contentURL: contentURL.toString(),
|
||||||
width: 400,
|
scrollbars: false,
|
||||||
height: 130
|
resizable: true,
|
||||||
});
|
maximizable: false,
|
||||||
}
|
paddingVertical: 0,
|
||||||
|
paddingHorizontal: 0,
|
||||||
|
width: 400,
|
||||||
|
height: 130
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
renameFN = () => {
|
renameFN = () => {
|
||||||
const hashes = torrentsTable.selectedRowsIds();
|
const hashes = torrentsTable.selectedRowsIds();
|
||||||
if (hashes.length === 1) {
|
if (hashes.length !== 1)
|
||||||
const hash = hashes[0];
|
return;
|
||||||
const row = torrentsTable.getRow(hash);
|
|
||||||
if (row) {
|
const row = torrentsTable.getRow(hashes[0]);
|
||||||
new MochaUI.Window({
|
if (!row)
|
||||||
id: "renamePage",
|
return;
|
||||||
icon: "images/qbittorrent-tray.svg",
|
|
||||||
title: "QBT_TR(Rename)QBT_TR[CONTEXT=TransferListWidget]",
|
const contentURL = new URL("rename.html", window.location);
|
||||||
loadMethod: "iframe",
|
contentURL.search = new URLSearchParams({
|
||||||
contentURL: new URI("rename.html").setData("hash", hash).setData("name", row.full_data.name).toString(),
|
hash: hashes[0],
|
||||||
scrollbars: false,
|
name: row.full_data.name
|
||||||
resizable: true,
|
});
|
||||||
maximizable: false,
|
new MochaUI.Window({
|
||||||
paddingVertical: 0,
|
id: "renamePage",
|
||||||
paddingHorizontal: 0,
|
icon: "images/qbittorrent-tray.svg",
|
||||||
width: 400,
|
title: "QBT_TR(Rename)QBT_TR[CONTEXT=TransferListWidget]",
|
||||||
height: 100
|
loadMethod: "iframe",
|
||||||
});
|
contentURL: contentURL.toString(),
|
||||||
}
|
scrollbars: false,
|
||||||
}
|
resizable: true,
|
||||||
|
maximizable: false,
|
||||||
|
paddingVertical: 0,
|
||||||
|
paddingHorizontal: 0,
|
||||||
|
width: 400,
|
||||||
|
height: 100
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
renameFilesFN = () => {
|
renameFilesFN = () => {
|
||||||
|
@ -784,12 +819,17 @@ const initializeWindows = () => {
|
||||||
if (hashes.length <= 0)
|
if (hashes.length <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const contentURL = new URL("newcategory.html", window.location);
|
||||||
|
contentURL.search = new URLSearchParams({
|
||||||
|
action: "set",
|
||||||
|
hashes: hashes.join("|")
|
||||||
|
});
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: "newCategoryPage",
|
id: "newCategoryPage",
|
||||||
icon: "images/qbittorrent-tray.svg",
|
icon: "images/qbittorrent-tray.svg",
|
||||||
title: "QBT_TR(New Category)QBT_TR[CONTEXT=TransferListWidget]",
|
title: "QBT_TR(New Category)QBT_TR[CONTEXT=TransferListWidget]",
|
||||||
loadMethod: "iframe",
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("newcategory.html").setData("action", "set").setData("hashes", hashes.join("|")).toString(),
|
contentURL: contentURL.toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -821,12 +861,16 @@ const initializeWindows = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
createCategoryFN = () => {
|
createCategoryFN = () => {
|
||||||
|
const contentURL = new URL("newcategory.html", window.location);
|
||||||
|
contentURL.search = new URLSearchParams({
|
||||||
|
action: "create"
|
||||||
|
});
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: "newCategoryPage",
|
id: "newCategoryPage",
|
||||||
icon: "images/qbittorrent-tray.svg",
|
icon: "images/qbittorrent-tray.svg",
|
||||||
title: "QBT_TR(New Category)QBT_TR[CONTEXT=CategoryFilterWidget]",
|
title: "QBT_TR(New Category)QBT_TR[CONTEXT=CategoryFilterWidget]",
|
||||||
loadMethod: "iframe",
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("newcategory.html").setData("action", "create").toString(),
|
contentURL: contentURL.toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -838,12 +882,17 @@ const initializeWindows = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
createSubcategoryFN = (category) => {
|
createSubcategoryFN = (category) => {
|
||||||
|
const contentURL = new URL("newcategory.html", window.location);
|
||||||
|
contentURL.search = new URLSearchParams({
|
||||||
|
action: "createSubcategory",
|
||||||
|
categoryName: `${category}/`
|
||||||
|
});
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: "newSubcategoryPage",
|
id: "newSubcategoryPage",
|
||||||
icon: "images/qbittorrent-tray.svg",
|
icon: "images/qbittorrent-tray.svg",
|
||||||
title: "QBT_TR(New Category)QBT_TR[CONTEXT=CategoryFilterWidget]",
|
title: "QBT_TR(New Category)QBT_TR[CONTEXT=CategoryFilterWidget]",
|
||||||
loadMethod: "iframe",
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("newcategory.html").setData("action", "createSubcategory").setData("categoryName", `${category}/`).toString(),
|
contentURL: contentURL.toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -855,12 +904,18 @@ const initializeWindows = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
editCategoryFN = (category) => {
|
editCategoryFN = (category) => {
|
||||||
|
const contentURL = new URL("newcategory.html", window.location);
|
||||||
|
contentURL.search = new URLSearchParams({
|
||||||
|
action: "edit",
|
||||||
|
categoryName: category,
|
||||||
|
savePath: categoryMap.get(category).savePath
|
||||||
|
});
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: "editCategoryPage",
|
id: "editCategoryPage",
|
||||||
icon: "images/qbittorrent-tray.svg",
|
icon: "images/qbittorrent-tray.svg",
|
||||||
title: "QBT_TR(Edit Category)QBT_TR[CONTEXT=TransferListWidget]",
|
title: "QBT_TR(Edit Category)QBT_TR[CONTEXT=TransferListWidget]",
|
||||||
loadMethod: "iframe",
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("newcategory.html").setData("action", "edit").setData("categoryName", category).setData("savePath", categoryMap.get(category).savePath).toString(),
|
contentURL: contentURL.toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -913,12 +968,17 @@ const initializeWindows = () => {
|
||||||
if (hashes.length <= 0)
|
if (hashes.length <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const contentURL = new URL("newtag.html", window.location);
|
||||||
|
contentURL.search = new URLSearchParams({
|
||||||
|
action: "set",
|
||||||
|
hashes: hashes.join("|")
|
||||||
|
});
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: "newTagPage",
|
id: "newTagPage",
|
||||||
icon: "images/qbittorrent-tray.svg",
|
icon: "images/qbittorrent-tray.svg",
|
||||||
title: "QBT_TR(Add tags)QBT_TR[CONTEXT=TransferListWidget]",
|
title: "QBT_TR(Add tags)QBT_TR[CONTEXT=TransferListWidget]",
|
||||||
loadMethod: "iframe",
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("newtag.html").setData("action", "set").setData("hashes", hashes.join("|")).toString(),
|
contentURL: contentURL.toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -956,12 +1016,16 @@ const initializeWindows = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
createTagFN = () => {
|
createTagFN = () => {
|
||||||
|
const contentURL = new URL("newtag.html", window.location);
|
||||||
|
contentURL.search = new URLSearchParams({
|
||||||
|
action: "create"
|
||||||
|
});
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: "newTagPage",
|
id: "newTagPage",
|
||||||
icon: "images/qbittorrent-tray.svg",
|
icon: "images/qbittorrent-tray.svg",
|
||||||
title: "QBT_TR(New Tag)QBT_TR[CONTEXT=TagFilterWidget]",
|
title: "QBT_TR(New Tag)QBT_TR[CONTEXT=TagFilterWidget]",
|
||||||
loadMethod: "iframe",
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("newtag.html").setData("action", "create").toString(),
|
contentURL: contentURL.toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -1002,12 +1066,16 @@ const initializeWindows = () => {
|
||||||
if ((trackerHost === TRACKERS_ALL) || (trackerHost === TRACKERS_TRACKERLESS))
|
if ((trackerHost === TRACKERS_ALL) || (trackerHost === TRACKERS_TRACKERLESS))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const trackerURLs = [...trackerMap.get(trackerHost).keys()].map(encodeURIComponent).join("|");
|
const contentURL = new URL("confirmtrackerdeletion.html", window.location);
|
||||||
|
contentURL.search = new URLSearchParams({
|
||||||
|
host: trackerHost,
|
||||||
|
urls: [...trackerMap.get(trackerHost).keys()].map(encodeURIComponent).join("|")
|
||||||
|
});
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: "confirmDeletionPage",
|
id: "confirmDeletionPage",
|
||||||
title: "QBT_TR(Remove tracker)QBT_TR[CONTEXT=confirmDeletionDlg]",
|
title: "QBT_TR(Remove tracker)QBT_TR[CONTEXT=confirmDeletionDlg]",
|
||||||
loadMethod: "iframe",
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("confirmtrackerdeletion.html").setData("host", trackerHost).setData("urls", trackerURLs).toString(),
|
contentURL: contentURL.toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
@ -1099,7 +1167,10 @@ const initializeWindows = () => {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const name = row.full_data.name;
|
const name = row.full_data.name;
|
||||||
const url = new URI("api/v2/torrents/export").setData("hash", hash).toString();
|
const url = new URL("api/v2/torrents/export", window.location);
|
||||||
|
url.search = new URLSearchParams({
|
||||||
|
hash: hash
|
||||||
|
});
|
||||||
|
|
||||||
// download response to file
|
// download response to file
|
||||||
await window.qBittorrent.Misc.downloadFile(url, `${name}.torrent`, "QBT_TR(Unable to export torrent file)QBT_TR[CONTEXT=MainWindow]");
|
await window.qBittorrent.Misc.downloadFile(url, `${name}.torrent`, "QBT_TR(Unable to export torrent file)QBT_TR[CONTEXT=MainWindow]");
|
||||||
|
@ -1190,7 +1261,7 @@ const initializeWindows = () => {
|
||||||
icon: "images/qbittorrent-tray.svg",
|
icon: "images/qbittorrent-tray.svg",
|
||||||
title: "QBT_TR(About qBittorrent)QBT_TR[CONTEXT=AboutDialog]",
|
title: "QBT_TR(About qBittorrent)QBT_TR[CONTEXT=AboutDialog]",
|
||||||
loadMethod: "xhr",
|
loadMethod: "xhr",
|
||||||
contentURL: new URI("views/about.html").toString(),
|
contentURL: "views/about.html",
|
||||||
require: {
|
require: {
|
||||||
css: ["css/Tabs.css"]
|
css: ["css/Tabs.css"]
|
||||||
},
|
},
|
||||||
|
|
|
@ -56,9 +56,11 @@ window.qBittorrent.PropPeers ??= (() => {
|
||||||
clearTimeout(loadTorrentPeersTimer);
|
clearTimeout(loadTorrentPeersTimer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const url = new URI("api/v2/sync/torrentPeers")
|
const url = new URL("api/v2/sync/torrentPeers", window.location);
|
||||||
.setData("rid", syncTorrentPeersLastResponseId)
|
url.search = new URLSearchParams({
|
||||||
.setData("hash", current_hash);
|
hash: current_hash,
|
||||||
|
rid: syncTorrentPeersLastResponseId,
|
||||||
|
});
|
||||||
fetch(url, {
|
fetch(url, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
cache: "no-store"
|
cache: "no-store"
|
||||||
|
|
|
@ -27,10 +27,11 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const path = new URI().getData("path");
|
const searchParams = new URLSearchParams(window.location.search);
|
||||||
|
const path = searchParams.get("path");
|
||||||
|
|
||||||
// set text field to current value
|
// set text field to current value
|
||||||
if (path)
|
if (path !== null)
|
||||||
$("setLocation").value = decodeURIComponent(path);
|
$("setLocation").value = decodeURIComponent(path);
|
||||||
|
|
||||||
$("setLocation").focus();
|
$("setLocation").focus();
|
||||||
|
@ -48,7 +49,7 @@
|
||||||
fetch("api/v2/torrents/setLocation", {
|
fetch("api/v2/torrents/setLocation", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: new URLSearchParams({
|
body: new URLSearchParams({
|
||||||
hashes: new URI().getData("hashes"),
|
hashes: searchParams.get("hashes"),
|
||||||
location: location
|
location: location
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const hashesList = new URI().getData("hashes").split("|");
|
const searchParams = new URLSearchParams(window.location.search);
|
||||||
const origValues = new URI().getData("orig").split("|");
|
const origValues = searchParams.get("orig").split("|");
|
||||||
|
|
||||||
const values = {
|
const values = {
|
||||||
ratioLimit: window.qBittorrent.Misc.friendlyFloat(origValues[0], 2),
|
ratioLimit: window.qBittorrent.Misc.friendlyFloat(origValues[0], 2),
|
||||||
|
@ -103,7 +103,7 @@
|
||||||
fetch("api/v2/torrents/setShareLimits", {
|
fetch("api/v2/torrents/setShareLimits", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: new URLSearchParams({
|
body: new URLSearchParams({
|
||||||
hashes: hashesList.join("|"),
|
hashes: searchParams.get("hashes"),
|
||||||
ratioLimit: ratioLimitValue,
|
ratioLimit: ratioLimitValue,
|
||||||
seedingTimeLimit: seedingTimeLimitValue,
|
seedingTimeLimit: seedingTimeLimitValue,
|
||||||
inactiveSeedingTimeLimit: inactiveSeedingTimeLimitValue
|
inactiveSeedingTimeLimit: inactiveSeedingTimeLimitValue
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const hashes = new URI().getData("hashes").split("|");
|
const hashes = new URLSearchParams(window.location.search).get("hashes").split("|");
|
||||||
const setUpLimit = () => {
|
const setUpLimit = () => {
|
||||||
const limit = Number($("uplimitUpdatevalue").value) * 1024;
|
const limit = Number($("uplimitUpdatevalue").value) * 1024;
|
||||||
if (hashes[0] === "global") {
|
if (hashes[0] === "global") {
|
||||||
|
|
|
@ -340,20 +340,23 @@
|
||||||
curTab = currentSelectedTab;
|
curTab = currentSelectedTab;
|
||||||
|
|
||||||
let url;
|
let url;
|
||||||
if (curTab === "main") {
|
switch (curTab) {
|
||||||
url = new URI("api/v2/log/main");
|
case "main":
|
||||||
url.setData({
|
url = new URL("api/v2/log/main", window.location);
|
||||||
normal: selectedLogLevels.includes("1"),
|
url.search = new URLSearchParams({
|
||||||
info: selectedLogLevels.includes("2"),
|
normal: selectedLogLevels.includes("1"),
|
||||||
warning: selectedLogLevels.includes("4"),
|
info: selectedLogLevels.includes("2"),
|
||||||
critical: selectedLogLevels.includes("8")
|
warning: selectedLogLevels.includes("4"),
|
||||||
});
|
critical: selectedLogLevels.includes("8")
|
||||||
}
|
});
|
||||||
else {
|
break;
|
||||||
url = new URI("api/v2/log/peers");
|
|
||||||
|
case "peer":
|
||||||
|
url = new URL("api/v2/log/peers", window.location);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
url.setData("last_known_id", tableInfo[curTab].last_id);
|
url.searchParams.set("last_known_id", tableInfo[curTab].last_id);
|
||||||
tableInfo[curTab].progress = true;
|
tableInfo[curTab].progress = true;
|
||||||
|
|
||||||
fetch(url, {
|
fetch(url, {
|
||||||
|
|
|
@ -743,12 +743,17 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const editUrl = (path, url) => {
|
const editUrl = (path, url) => {
|
||||||
|
const contentURL = new URL("editfeedurl.html", window.location);
|
||||||
|
contentURL.search = new URLSearchParams({
|
||||||
|
path: path,
|
||||||
|
url: url
|
||||||
|
});
|
||||||
new MochaUI.Window({
|
new MochaUI.Window({
|
||||||
id: "editFeedURL",
|
id: "editFeedURL",
|
||||||
icon: "images/qbittorrent-tray.svg",
|
icon: "images/qbittorrent-tray.svg",
|
||||||
title: "QBT_TR(Please type a RSS feed URL)QBT_TR[CONTEXT=RSSWidget]",
|
title: "QBT_TR(Please type a RSS feed URL)QBT_TR[CONTEXT=RSSWidget]",
|
||||||
loadMethod: "iframe",
|
loadMethod: "iframe",
|
||||||
contentURL: new URI("editfeedurl.html").setData("path", path).setData("url", url).toString(),
|
contentURL: contentURL.toString(),
|
||||||
scrollbars: false,
|
scrollbars: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue