From d63e0ad78fea6f2ad99e47e15a5d7214283d7cb3 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sat, 15 Apr 2023 14:51:27 +0800 Subject: [PATCH 1/2] Work around Chrome download limit Closes #18775. --- src/webui/www/private/scripts/misc.js | 7 +++++++ src/webui/www/private/scripts/mocha-init.js | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/webui/www/private/scripts/misc.js b/src/webui/www/private/scripts/misc.js index 0c5685f0c..618d6fec1 100644 --- a/src/webui/www/private/scripts/misc.js +++ b/src/webui/www/private/scripts/misc.js @@ -44,6 +44,7 @@ window.qBittorrent.Misc = (function() { safeTrim: safeTrim, toFixedPointString: toFixedPointString, containsAllTerms: containsAllTerms, + sleep: sleep, MAX_ETA: 8640000 }; }; @@ -218,6 +219,12 @@ window.qBittorrent.Misc = (function() { }); }; + const sleep = (ms) => { + return new Promise((resolve) => { + setTimeout(resolve, ms); + }); + }; + return exports(); })(); diff --git a/src/webui/www/private/scripts/mocha-init.js b/src/webui/www/private/scripts/mocha-init.js index ef4856823..44eb4d22d 100644 --- a/src/webui/www/private/scripts/mocha-init.js +++ b/src/webui/www/private/scripts/mocha-init.js @@ -1004,7 +1004,7 @@ const initializeWindows = function() { return torrentsTable.selectedRowsIds().join("\n"); }; - exportTorrentFN = function() { + exportTorrentFN = async function() { const hashes = torrentsTable.selectedRowsIds(); for (const hash of hashes) { const row = torrentsTable.rows.get(hash); @@ -1022,6 +1022,9 @@ const initializeWindows = function() { document.body.appendChild(element); element.click(); document.body.removeChild(element); + + // https://stackoverflow.com/questions/53560991/automatic-file-downloads-limited-to-10-files-on-chrome-browser + await window.qBittorrent.Misc.sleep(200); } }; From 9ea48539b45bdc18c2fee31037ef7eac49c86cb1 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sat, 15 Apr 2023 14:53:13 +0800 Subject: [PATCH 2/2] Inline variable declared in header --- src/base/logger.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/logger.h b/src/base/logger.h index ec27446e8..429335e36 100644 --- a/src/base/logger.h +++ b/src/base/logger.h @@ -35,7 +35,7 @@ #include #include -const int MAX_LOG_MESSAGES = 20000; +inline const int MAX_LOG_MESSAGES = 20000; namespace Log {