Merge pull request #18848 from glassez/v4.5

Backport changes to v4.5.x branch
This commit is contained in:
Vladimir Golovnev 2023-04-18 17:43:56 +03:00 committed by GitHub
commit af41a0eece
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 7 deletions

View file

@ -627,6 +627,7 @@ void BitTorrent::DBResumeDataStorage::Worker::store(const TorrentID &id, const L
DB_COLUMN_CATEGORY, DB_COLUMN_CATEGORY,
DB_COLUMN_TAGS, DB_COLUMN_TAGS,
DB_COLUMN_TARGET_SAVE_PATH, DB_COLUMN_TARGET_SAVE_PATH,
DB_COLUMN_DOWNLOAD_PATH,
DB_COLUMN_CONTENT_LAYOUT, DB_COLUMN_CONTENT_LAYOUT,
DB_COLUMN_RATIO_LIMIT, DB_COLUMN_RATIO_LIMIT,
DB_COLUMN_SEEDING_TIME_LIMIT, DB_COLUMN_SEEDING_TIME_LIMIT,

View file

@ -599,11 +599,7 @@ void Preferences::setWebUiPort(const quint16 port)
bool Preferences::useUPnPForWebUIPort() const bool Preferences::useUPnPForWebUIPort() const
{ {
#ifdef DISABLE_GUI
return value(u"Preferences/WebUI/UseUPnP"_qs, true);
#else
return value(u"Preferences/WebUI/UseUPnP"_qs, false); return value(u"Preferences/WebUI/UseUPnP"_qs, false);
#endif
} }
void Preferences::setUPnPForWebUIPort(const bool enabled) void Preferences::setUPnPForWebUIPort(const bool enabled)

View file

@ -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();
})(); })();

View file

@ -958,12 +958,12 @@ 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);
if (!row) if (!row)
return; continue;
const name = row.full_data.name; const name = row.full_data.name;
const url = new URI("api/v2/torrents/export"); const url = new URI("api/v2/torrents/export");
@ -972,10 +972,13 @@ const initializeWindows = function() {
// download response to file // download response to file
const element = document.createElement("a"); const element = document.createElement("a");
element.setAttribute("href", url); element.setAttribute("href", url);
element.setAttribute("download", name + ".torrent"); element.setAttribute("download", (name + ".torrent"));
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);
} }
}; };

View file

@ -158,6 +158,10 @@
if (submitted) if (submitted)
window.parent.closeWindows(); window.parent.closeWindows();
}); });
if (Browser.platform === 'ios') {
$('fileselect').accept = ".torrent";
}
</script> </script>
<div id="upload_spinner" class="mochaSpinner"></div> <div id="upload_spinner" class="mochaSpinner"></div>
</body> </body>