Browse Source

Merge pull request #18853 from Chocobo1/exportTorrent

Work around Chrome download limit
adaptive-webui-19844
Chocobo1 2 years ago committed by GitHub
parent
commit
1fe006d16f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/base/logger.h
  2. 7
      src/webui/www/private/scripts/misc.js
  3. 5
      src/webui/www/private/scripts/mocha-init.js

2
src/base/logger.h

@ -35,7 +35,7 @@
#include <QString> #include <QString>
#include <QtContainerFwd> #include <QtContainerFwd>
const int MAX_LOG_MESSAGES = 20000; inline const int MAX_LOG_MESSAGES = 20000;
namespace Log namespace Log
{ {

7
src/webui/www/private/scripts/misc.js

@ -44,6 +44,7 @@ window.qBittorrent.Misc = (function() {
safeTrim: safeTrim, safeTrim: safeTrim,
toFixedPointString: toFixedPointString, toFixedPointString: toFixedPointString,
containsAllTerms: containsAllTerms, containsAllTerms: containsAllTerms,
sleep: sleep,
MAX_ETA: 8640000 MAX_ETA: 8640000
}; };
}; };
@ -218,6 +219,12 @@ window.qBittorrent.Misc = (function() {
}); });
}; };
const sleep = (ms) => {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
};
return exports(); return exports();
})(); })();

5
src/webui/www/private/scripts/mocha-init.js

@ -1004,7 +1004,7 @@ const initializeWindows = function() {
return torrentsTable.selectedRowsIds().join("\n"); return torrentsTable.selectedRowsIds().join("\n");
}; };
exportTorrentFN = function() { exportTorrentFN = async function() {
const hashes = torrentsTable.selectedRowsIds(); const hashes = torrentsTable.selectedRowsIds();
for (const hash of hashes) { for (const hash of hashes) {
const row = torrentsTable.rows.get(hash); const row = torrentsTable.rows.get(hash);
@ -1022,6 +1022,9 @@ const initializeWindows = function() {
document.body.appendChild(element); document.body.appendChild(element);
element.click(); element.click();
document.body.removeChild(element); 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);
} }
}; };

Loading…
Cancel
Save