mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-26 19:20:32 +00:00
WebUI: use native function to convert to numbers
Also replace `parseInt()` since `Number()` behavior is more intuitive. PR #21831.
This commit is contained in:
parent
ede08f3845
commit
f73f31619d
@ -178,8 +178,8 @@
|
||||
$("downloadForm").addEventListener("submit", () => {
|
||||
$("startTorrentHidden").value = $("startTorrent").checked ? "false" : "true";
|
||||
|
||||
$("dlLimitHidden").value = $("dlLimitText").value.toInt() * 1024;
|
||||
$("upLimitHidden").value = $("upLimitText").value.toInt() * 1024;
|
||||
$("dlLimitHidden").value = Number($("dlLimitText").value) * 1024;
|
||||
$("upLimitHidden").value = Number($("upLimitText").value) * 1024;
|
||||
|
||||
$("download_spinner").style.display = "block";
|
||||
submitted = true;
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
const hashes = new URI().getData("hashes").split("|");
|
||||
const setDlLimit = () => {
|
||||
const limit = $("dllimitUpdatevalue").value.toInt() * 1024;
|
||||
const limit = Number($("dllimitUpdatevalue").value) * 1024;
|
||||
if (hashes[0] === "global") {
|
||||
new Request({
|
||||
url: "api/v2/transfer/setDownloadLimit",
|
||||
|
@ -25,7 +25,7 @@
|
||||
menu: "multiRenameFilesMenu",
|
||||
actions: {
|
||||
ToggleSelection: (element, ref) => {
|
||||
const rowId = parseInt(element.getAttribute("data-row-id"), 10);
|
||||
const rowId = Number(element.getAttribute("data-row-id"));
|
||||
const row = bulkRenameFilesTable.getNode(rowId);
|
||||
const checkState = (row.checked === 1) ? 0 : 1;
|
||||
bulkRenameFilesTable.toggleNodeTreeCheckbox(rowId, checkState);
|
||||
@ -117,7 +117,7 @@
|
||||
$("include_folders").checked = fileRenamer.includeFolders;
|
||||
|
||||
const multirename_fileEnumerationStart = LocalPreferences.get("multirename_fileEnumerationStart", 0);
|
||||
fileRenamer.fileEnumerationStart = parseInt(multirename_fileEnumerationStart, 10);
|
||||
fileRenamer.fileEnumerationStart = Number(multirename_fileEnumerationStart);
|
||||
$("file_counter").value = fileRenamer.fileEnumerationStart;
|
||||
|
||||
const multirename_replaceAll = LocalPreferences.get("multirename_replaceAll", false);
|
||||
|
@ -184,7 +184,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
const onStart = function(el, event) {
|
||||
if (this.canResize) {
|
||||
this.currentHeaderAction = "resize";
|
||||
this.startWidth = parseInt(this.resizeTh.style.width, 10);
|
||||
this.startWidth = Number(this.resizeTh.style.width);
|
||||
}
|
||||
else {
|
||||
this.currentHeaderAction = "drag";
|
||||
@ -3259,7 +3259,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
this.columns["type"].updateTd = function(td, row) {
|
||||
// Type of the message: Log::NORMAL: 1, Log::INFO: 2, Log::WARNING: 4, Log::CRITICAL: 8
|
||||
let logLevel, addClass;
|
||||
switch (this.getRowValue(row).toInt()) {
|
||||
switch (Number(this.getRowValue(row))) {
|
||||
case 1:
|
||||
logLevel = "QBT_TR(Normal)QBT_TR[CONTEXT=ExecutionLogWidget]";
|
||||
addClass = "logNormal";
|
||||
|
@ -1011,7 +1011,7 @@ const initializeWindows = () => {
|
||||
};
|
||||
|
||||
deleteTrackerFN = (trackerHash) => {
|
||||
const trackerHashInt = Number.parseInt(trackerHash, 10);
|
||||
const trackerHashInt = Number(trackerHash);
|
||||
if ((trackerHashInt === TRACKERS_ALL) || (trackerHashInt === TRACKERS_TRACKERLESS))
|
||||
return;
|
||||
|
||||
|
@ -127,7 +127,7 @@ window.qBittorrent.ProgressBar ??= (() => {
|
||||
this.vals.dark.textContent = displayedValue;
|
||||
this.vals.light.textContent = displayedValue;
|
||||
|
||||
const r = parseInt((this.vals.width * (value / 100)), 10);
|
||||
const r = Number(this.vals.width * (value / 100));
|
||||
this.vals.dark.style.clipPath = `inset(0 calc(100% - ${r}px) 0 0)`;
|
||||
this.vals.light.style.clipPath = `inset(0 0 0 ${r}px)`;
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||
|
||||
const updatePriorityCombo = (id, selectedPriority) => {
|
||||
const combobox = $("comboPrio" + id);
|
||||
if (parseInt(combobox.value, 10) !== selectedPriority)
|
||||
if (Number(combobox.value) !== selectedPriority)
|
||||
selectComboboxPriority(combobox, selectedPriority);
|
||||
};
|
||||
|
||||
@ -205,7 +205,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||
const options = combobox.options;
|
||||
for (let i = 0; i < options.length; ++i) {
|
||||
const option = options[i];
|
||||
if (parseInt(option.value, 10) === priority)
|
||||
if (Number(option.value) === priority)
|
||||
option.selected = true;
|
||||
else
|
||||
option.selected = false;
|
||||
|
@ -39,7 +39,7 @@ MochaUI.extend({
|
||||
data: {},
|
||||
onSuccess: (data) => {
|
||||
if (data) {
|
||||
const tmp = data.toInt();
|
||||
const tmp = Number(data);
|
||||
if (tmp > 0) {
|
||||
maximum = tmp / 1024.0;
|
||||
}
|
||||
@ -143,7 +143,7 @@ MochaUI.extend({
|
||||
data: {},
|
||||
onSuccess: (data) => {
|
||||
if (data) {
|
||||
const tmp = data.toInt();
|
||||
const tmp = Number(data);
|
||||
if (tmp > 0) {
|
||||
maximum = tmp / 1024.0;
|
||||
}
|
||||
|
@ -40,11 +40,11 @@
|
||||
|
||||
const values = {
|
||||
ratioLimit: window.qBittorrent.Misc.friendlyFloat(origValues[0], 2),
|
||||
seedingTimeLimit: parseInt(origValues[1], 10),
|
||||
inactiveSeedingTimeLimit: parseInt(origValues[2], 10),
|
||||
seedingTimeLimit: Number(origValues[1]),
|
||||
inactiveSeedingTimeLimit: Number(origValues[2]),
|
||||
maxRatio: window.qBittorrent.Misc.friendlyFloat(origValues[3], 2),
|
||||
maxSeedingTime: parseInt(origValues[4], 10),
|
||||
maxInactiveSeedingTime: parseInt(origValues[5], 10)
|
||||
maxSeedingTime: Number(origValues[4]),
|
||||
maxInactiveSeedingTime: Number(origValues[5])
|
||||
};
|
||||
|
||||
// select default when orig values not passed. using double equals to compare string and int
|
||||
|
@ -163,8 +163,8 @@
|
||||
$("uploadForm").addEventListener("submit", () => {
|
||||
$("startTorrentHidden").value = $("startTorrent").checked ? "false" : "true";
|
||||
|
||||
$("dlLimitHidden").value = $("dlLimitText").value.toInt() * 1024;
|
||||
$("upLimitHidden").value = $("upLimitText").value.toInt() * 1024;
|
||||
$("dlLimitHidden").value = Number($("dlLimitText").value) * 1024;
|
||||
$("upLimitHidden").value = Number($("upLimitText").value) * 1024;
|
||||
|
||||
$("upload_spinner").style.display = "block";
|
||||
submitted = true;
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
const hashes = new URI().getData("hashes").split("|");
|
||||
const setUpLimit = () => {
|
||||
const limit = $("uplimitUpdatevalue").value.toInt() * 1024;
|
||||
const limit = Number($("uplimitUpdatevalue").value) * 1024;
|
||||
if (hashes[0] === "global") {
|
||||
new Request({
|
||||
url: "api/v2/transfer/setUploadLimit",
|
||||
|
@ -397,7 +397,7 @@
|
||||
};
|
||||
}
|
||||
tableInfo[curTab].instance.updateRowData(row);
|
||||
tableInfo[curTab].last_id = Math.max(response[i].id.toInt(), tableInfo[curTab].last_id);
|
||||
tableInfo[curTab].last_id = Math.max(Number(response[i].id), tableInfo[curTab].last_id);
|
||||
}
|
||||
|
||||
tableInfo[curTab].instance.updateTable();
|
||||
|
@ -1751,13 +1751,14 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
|
||||
// Behavior tab
|
||||
const numberInputLimiter = (input) => {
|
||||
const min = input.getAttribute("min");
|
||||
const max = input.getAttribute("max");
|
||||
const inputNumber = Number(input.value);
|
||||
|
||||
if (min && (input.value.toInt() < min.toInt()))
|
||||
const min = input.getAttribute("min");
|
||||
if (min && (inputNumber < Number(min)))
|
||||
input.value = min;
|
||||
|
||||
if (max && (input.value.toInt() > max.toInt()))
|
||||
const max = input.getAttribute("max");
|
||||
if (max && (inputNumber > Number(max)))
|
||||
input.value = max;
|
||||
};
|
||||
|
||||
@ -2055,7 +2056,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
};
|
||||
|
||||
const registerDynDns = () => {
|
||||
if ($("dyndns_select").value.toInt() === 1)
|
||||
if (Number($("dyndns_select").value) === 1)
|
||||
window.open("http://www.no-ip.com/services/managed_dns/free_dynamic_dns.html", "NO-IP Registration");
|
||||
else
|
||||
window.open("https://www.dyndns.com/account/services/hosts/add.html", "DynDNS Registration");
|
||||
@ -2291,11 +2292,11 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
|
||||
// Connection tab
|
||||
// Listening Port
|
||||
$("port_value").value = pref.listen_port.toInt();
|
||||
$("port_value").value = Number(pref.listen_port);
|
||||
$("upnp_checkbox").checked = pref.upnp;
|
||||
|
||||
// Connections Limits
|
||||
const max_connec = pref.max_connec.toInt();
|
||||
const max_connec = Number(pref.max_connec);
|
||||
if (max_connec <= 0) {
|
||||
$("max_connec_checkbox").checked = false;
|
||||
$("max_connec_value").value = 500;
|
||||
@ -2305,7 +2306,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
$("max_connec_value").value = max_connec;
|
||||
}
|
||||
updateMaxConnecEnabled();
|
||||
const max_connec_per_torrent = pref.max_connec_per_torrent.toInt();
|
||||
const max_connec_per_torrent = Number(pref.max_connec_per_torrent);
|
||||
if (max_connec_per_torrent <= 0) {
|
||||
$("max_connec_per_torrent_checkbox").checked = false;
|
||||
$("max_connec_per_torrent_value").value = 100;
|
||||
@ -2315,7 +2316,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
$("max_connec_per_torrent_value").value = max_connec_per_torrent;
|
||||
}
|
||||
updateMaxConnecPerTorrentEnabled();
|
||||
const max_uploads = pref.max_uploads.toInt();
|
||||
const max_uploads = Number(pref.max_uploads);
|
||||
if (max_uploads <= 0) {
|
||||
$("max_uploads_checkbox").checked = false;
|
||||
$("max_uploads_value").value = 8;
|
||||
@ -2325,7 +2326,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
$("max_uploads_value").value = max_uploads;
|
||||
}
|
||||
updateMaxUploadsEnabled();
|
||||
const max_uploads_per_torrent = pref.max_uploads_per_torrent.toInt();
|
||||
const max_uploads_per_torrent = Number(pref.max_uploads_per_torrent);
|
||||
if (max_uploads_per_torrent <= 0) {
|
||||
$("max_uploads_per_torrent_checkbox").checked = false;
|
||||
$("max_uploads_per_torrent_value").value = 4;
|
||||
@ -2366,11 +2367,11 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
|
||||
// Speed tab
|
||||
// Global Rate Limits
|
||||
$("up_limit_value").value = (pref.up_limit.toInt() / 1024);
|
||||
$("dl_limit_value").value = (pref.dl_limit.toInt() / 1024);
|
||||
$("up_limit_value").value = (Number(pref.up_limit) / 1024);
|
||||
$("dl_limit_value").value = (Number(pref.dl_limit) / 1024);
|
||||
// Alternative Global Rate Limits
|
||||
$("alt_up_limit_value").value = (pref.alt_up_limit.toInt() / 1024);
|
||||
$("alt_dl_limit_value").value = (pref.alt_dl_limit.toInt() / 1024);
|
||||
$("alt_up_limit_value").value = (Number(pref.alt_up_limit) / 1024);
|
||||
$("alt_dl_limit_value").value = (Number(pref.alt_dl_limit) / 1024);
|
||||
|
||||
$("enable_protocol_combobox").value = pref.bittorrent_protocol;
|
||||
$("limit_utp_rate_checkbox").checked = pref.limit_utp_rate;
|
||||
@ -2391,7 +2392,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
$("dht_checkbox").checked = pref.dht;
|
||||
$("pex_checkbox").checked = pref.pex;
|
||||
$("lsd_checkbox").checked = pref.lsd;
|
||||
const encryption = pref.encryption.toInt();
|
||||
const encryption = Number(pref.encryption);
|
||||
$("encryption_select").getChildren("option")[encryption].selected = true;
|
||||
$("anonymous_mode_checkbox").checked = pref.anonymous_mode;
|
||||
|
||||
@ -2399,24 +2400,24 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
|
||||
// Torrent Queueing
|
||||
$("queueing_checkbox").checked = pref.queueing_enabled;
|
||||
$("max_active_dl_value").value = pref.max_active_downloads.toInt();
|
||||
$("max_active_up_value").value = pref.max_active_uploads.toInt();
|
||||
$("max_active_to_value").value = pref.max_active_torrents.toInt();
|
||||
$("max_active_dl_value").value = Number(pref.max_active_downloads);
|
||||
$("max_active_up_value").value = Number(pref.max_active_uploads);
|
||||
$("max_active_to_value").value = Number(pref.max_active_torrents);
|
||||
$("dont_count_slow_torrents_checkbox").checked = pref.dont_count_slow_torrents;
|
||||
$("dl_rate_threshold").value = pref.slow_torrent_dl_rate_threshold.toInt();
|
||||
$("ul_rate_threshold").value = pref.slow_torrent_ul_rate_threshold.toInt();
|
||||
$("torrent_inactive_timer").value = pref.slow_torrent_inactive_timer.toInt();
|
||||
$("dl_rate_threshold").value = Number(pref.slow_torrent_dl_rate_threshold);
|
||||
$("ul_rate_threshold").value = Number(pref.slow_torrent_ul_rate_threshold);
|
||||
$("torrent_inactive_timer").value = Number(pref.slow_torrent_inactive_timer);
|
||||
updateQueueingSystem();
|
||||
|
||||
// Share Limiting
|
||||
$("max_ratio_checkbox").checked = pref.max_ratio_enabled;
|
||||
$("max_ratio_value").value = (pref.max_ratio_enabled ? pref.max_ratio : 1);
|
||||
$("max_seeding_time_checkbox").checked = pref.max_seeding_time_enabled;
|
||||
$("max_seeding_time_value").value = (pref.max_seeding_time_enabled ? pref.max_seeding_time.toInt() : 1440);
|
||||
$("max_seeding_time_value").value = (pref.max_seeding_time_enabled ? Number(pref.max_seeding_time) : 1440);
|
||||
$("max_inactive_seeding_time_checkbox").checked = pref.max_inactive_seeding_time_enabled;
|
||||
$("max_inactive_seeding_time_value").value = (pref.max_inactive_seeding_time_enabled ? pref.max_inactive_seeding_time.toInt() : 1440);
|
||||
$("max_inactive_seeding_time_value").value = (pref.max_inactive_seeding_time_enabled ? Number(pref.max_inactive_seeding_time) : 1440);
|
||||
let maxRatioAct = 0;
|
||||
switch (pref.max_ratio_act.toInt()) {
|
||||
switch (Number(pref.max_ratio_act)) {
|
||||
case 0: // Stop
|
||||
default:
|
||||
maxRatioAct = 0;
|
||||
@ -2465,9 +2466,9 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
$("bypass_auth_subnet_whitelist_checkbox").checked = pref.bypass_auth_subnet_whitelist_enabled;
|
||||
$("bypass_auth_subnet_whitelist_textarea").value = pref.bypass_auth_subnet_whitelist;
|
||||
updateBypasssAuthSettings();
|
||||
$("webUIMaxAuthFailCountInput").value = pref.web_ui_max_auth_fail_count.toInt();
|
||||
$("webUIBanDurationInput").value = pref.web_ui_ban_duration.toInt();
|
||||
$("webUISessionTimeoutInput").value = pref.web_ui_session_timeout.toInt();
|
||||
$("webUIMaxAuthFailCountInput").value = Number(pref.web_ui_max_auth_fail_count);
|
||||
$("webUIBanDurationInput").value = Number(pref.web_ui_ban_duration);
|
||||
$("webUISessionTimeoutInput").value = Number(pref.web_ui_session_timeout);
|
||||
|
||||
// Use alternative WebUI
|
||||
$("use_alt_webui_checkbox").checked = pref.alternative_webui_enabled;
|
||||
@ -2662,7 +2663,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
|
||||
// Connection tab
|
||||
// Listening Port
|
||||
const listen_port = $("port_value").value.toInt();
|
||||
const listen_port = Number($("port_value").value);
|
||||
if (isNaN(listen_port) || (listen_port < 0) || (listen_port > 65535)) {
|
||||
alert("QBT_TR(The port used for incoming connections must be between 0 and 65535.)QBT_TR[CONTEXT=HttpServer]");
|
||||
return;
|
||||
@ -2673,7 +2674,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
// Connections Limits
|
||||
let max_connec = -1;
|
||||
if ($("max_connec_checkbox").checked) {
|
||||
max_connec = $("max_connec_value").value.toInt();
|
||||
max_connec = Number($("max_connec_value").value);
|
||||
if (isNaN(max_connec) || (max_connec <= 0)) {
|
||||
alert("QBT_TR(Maximum number of connections limit must be greater than 0 or disabled.)QBT_TR[CONTEXT=HttpServer]");
|
||||
return;
|
||||
@ -2682,7 +2683,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
settings["max_connec"] = max_connec;
|
||||
let max_connec_per_torrent = -1;
|
||||
if ($("max_connec_per_torrent_checkbox").checked) {
|
||||
max_connec_per_torrent = $("max_connec_per_torrent_value").value.toInt();
|
||||
max_connec_per_torrent = Number($("max_connec_per_torrent_value").value);
|
||||
if (isNaN(max_connec_per_torrent) || (max_connec_per_torrent <= 0)) {
|
||||
alert("QBT_TR(Maximum number of connections per torrent limit must be greater than 0 or disabled.)QBT_TR[CONTEXT=HttpServer]");
|
||||
return;
|
||||
@ -2691,7 +2692,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
settings["max_connec_per_torrent"] = max_connec_per_torrent;
|
||||
let max_uploads = -1;
|
||||
if ($("max_uploads_checkbox").checked) {
|
||||
max_uploads = $("max_uploads_value").value.toInt();
|
||||
max_uploads = Number($("max_uploads_value").value);
|
||||
if (isNaN(max_uploads) || (max_uploads <= 0)) {
|
||||
alert("QBT_TR(Global number of upload slots limit must be greater than 0 or disabled.)QBT_TR[CONTEXT=HttpServer]");
|
||||
return;
|
||||
@ -2700,7 +2701,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
settings["max_uploads"] = max_uploads;
|
||||
let max_uploads_per_torrent = -1;
|
||||
if ($("max_uploads_per_torrent_checkbox").checked) {
|
||||
max_uploads_per_torrent = $("max_uploads_per_torrent_value").value.toInt();
|
||||
max_uploads_per_torrent = Number($("max_uploads_per_torrent_value").value);
|
||||
if (isNaN(max_uploads_per_torrent) || (max_uploads_per_torrent <= 0)) {
|
||||
alert("QBT_TR(Maximum number of upload slots per torrent limit must be greater than 0 or disabled.)QBT_TR[CONTEXT=HttpServer]");
|
||||
return;
|
||||
@ -2711,13 +2712,13 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
// I2P
|
||||
settings["i2p_enabled"] = $("i2pEnabledCheckbox").checked;
|
||||
settings["i2p_address"] = $("i2pAddress").value;
|
||||
settings["i2p_port"] = $("i2pPort").value.toInt();
|
||||
settings["i2p_port"] = Number($("i2pPort").value);
|
||||
settings["i2p_mixed_mode"] = $("i2pMixedMode").checked;
|
||||
|
||||
// Proxy Server
|
||||
settings["proxy_type"] = $("peer_proxy_type_select").value;
|
||||
settings["proxy_ip"] = $("peer_proxy_host_text").value;
|
||||
settings["proxy_port"] = $("peer_proxy_port_value").value.toInt();
|
||||
settings["proxy_port"] = Number($("peer_proxy_port_value").value);
|
||||
settings["proxy_auth_enabled"] = $("peer_proxy_auth_checkbox").checked;
|
||||
settings["proxy_username"] = $("peer_proxy_username_text").value;
|
||||
settings["proxy_password"] = $("peer_proxy_password_text").value;
|
||||
@ -2735,14 +2736,14 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
|
||||
// Speed tab
|
||||
// Global Rate Limits
|
||||
const up_limit = $("up_limit_value").value.toInt() * 1024;
|
||||
const up_limit = Number($("up_limit_value").value) * 1024;
|
||||
if (isNaN(up_limit) || (up_limit < 0)) {
|
||||
alert("QBT_TR(Global upload rate limit must be greater than 0 or disabled.)QBT_TR[CONTEXT=HttpServer]");
|
||||
return;
|
||||
}
|
||||
settings["up_limit"] = up_limit;
|
||||
|
||||
const dl_limit = $("dl_limit_value").value.toInt() * 1024;
|
||||
const dl_limit = Number($("dl_limit_value").value) * 1024;
|
||||
if (isNaN(dl_limit) || (dl_limit < 0)) {
|
||||
alert("QBT_TR(Global download rate limit must be greater than 0 or disabled.)QBT_TR[CONTEXT=HttpServer]");
|
||||
return;
|
||||
@ -2750,14 +2751,14 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
settings["dl_limit"] = dl_limit;
|
||||
|
||||
// Alternative Global Rate Limits
|
||||
const alt_up_limit = $("alt_up_limit_value").value.toInt() * 1024;
|
||||
const alt_up_limit = Number($("alt_up_limit_value").value) * 1024;
|
||||
if (isNaN(alt_up_limit) || (alt_up_limit < 0)) {
|
||||
alert("QBT_TR(Alternative upload rate limit must be greater than 0 or disabled.)QBT_TR[CONTEXT=HttpServer]");
|
||||
return;
|
||||
}
|
||||
settings["alt_up_limit"] = alt_up_limit;
|
||||
|
||||
const alt_dl_limit = $("alt_dl_limit_value").value.toInt() * 1024;
|
||||
const alt_dl_limit = Number($("alt_dl_limit_value").value) * 1024;
|
||||
if (isNaN(alt_dl_limit) || (alt_dl_limit < 0)) {
|
||||
alert("QBT_TR(Alternative download rate limit must be greater than 0 or disabled.)QBT_TR[CONTEXT=HttpServer]");
|
||||
return;
|
||||
@ -2773,11 +2774,11 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
const scheduling_enabled = $("limitSchedulingCheckbox").checked;
|
||||
settings["scheduler_enabled"] = scheduling_enabled;
|
||||
if (scheduling_enabled) {
|
||||
settings["schedule_from_hour"] = $("schedule_from_hour").value.toInt();
|
||||
settings["schedule_from_min"] = $("schedule_from_min").value.toInt();
|
||||
settings["schedule_to_hour"] = $("schedule_to_hour").value.toInt();
|
||||
settings["schedule_to_min"] = $("schedule_to_min").value.toInt();
|
||||
settings["scheduler_days"] = $("schedule_freq_select").value.toInt();
|
||||
settings["schedule_from_hour"] = Number($("schedule_from_hour").value);
|
||||
settings["schedule_from_min"] = Number($("schedule_from_min").value);
|
||||
settings["schedule_to_hour"] = Number($("schedule_to_hour").value);
|
||||
settings["schedule_to_min"] = Number($("schedule_to_min").value);
|
||||
settings["scheduler_days"] = Number($("schedule_freq_select").value);
|
||||
}
|
||||
|
||||
// Bittorrent tab
|
||||
@ -2793,38 +2794,38 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
// Torrent Queueing
|
||||
settings["queueing_enabled"] = $("queueing_checkbox").checked;
|
||||
if ($("queueing_checkbox").checked) {
|
||||
const max_active_downloads = $("max_active_dl_value").value.toInt();
|
||||
const max_active_downloads = Number($("max_active_dl_value").value);
|
||||
if (isNaN(max_active_downloads) || (max_active_downloads < -1)) {
|
||||
alert("QBT_TR(Maximum active downloads must be greater than -1.)QBT_TR[CONTEXT=HttpServer]");
|
||||
return;
|
||||
}
|
||||
settings["max_active_downloads"] = max_active_downloads;
|
||||
const max_active_uploads = $("max_active_up_value").value.toInt();
|
||||
const max_active_uploads = Number($("max_active_up_value").value);
|
||||
if (isNaN(max_active_uploads) || (max_active_uploads < -1)) {
|
||||
alert("QBT_TR(Maximum active uploads must be greater than -1.)QBT_TR[CONTEXT=HttpServer]");
|
||||
return;
|
||||
}
|
||||
settings["max_active_uploads"] = max_active_uploads;
|
||||
const max_active_torrents = $("max_active_to_value").value.toInt();
|
||||
const max_active_torrents = Number($("max_active_to_value").value);
|
||||
if (isNaN(max_active_torrents) || (max_active_torrents < -1)) {
|
||||
alert("QBT_TR(Maximum active torrents must be greater than -1.)QBT_TR[CONTEXT=HttpServer]");
|
||||
return;
|
||||
}
|
||||
settings["max_active_torrents"] = max_active_torrents;
|
||||
settings["dont_count_slow_torrents"] = $("dont_count_slow_torrents_checkbox").checked;
|
||||
const dl_rate_threshold = $("dl_rate_threshold").value.toInt();
|
||||
const dl_rate_threshold = Number($("dl_rate_threshold").value);
|
||||
if (isNaN(dl_rate_threshold) || (dl_rate_threshold < 1)) {
|
||||
alert("QBT_TR(Download rate threshold must be greater than 0.)QBT_TR[CONTEXT=HttpServer]");
|
||||
return;
|
||||
}
|
||||
settings["slow_torrent_dl_rate_threshold"] = dl_rate_threshold;
|
||||
const ul_rate_threshold = $("ul_rate_threshold").value.toInt();
|
||||
const ul_rate_threshold = Number($("ul_rate_threshold").value);
|
||||
if (isNaN(ul_rate_threshold) || (ul_rate_threshold < 1)) {
|
||||
alert("QBT_TR(Upload rate threshold must be greater than 0.)QBT_TR[CONTEXT=HttpServer]");
|
||||
return;
|
||||
}
|
||||
settings["slow_torrent_ul_rate_threshold"] = ul_rate_threshold;
|
||||
const torrent_inactive_timer = $("torrent_inactive_timer").value.toInt();
|
||||
const torrent_inactive_timer = Number($("torrent_inactive_timer").value);
|
||||
if (isNaN(torrent_inactive_timer) || (torrent_inactive_timer < 1)) {
|
||||
alert("QBT_TR(Torrent inactivity timer must be greater than 0.)QBT_TR[CONTEXT=HttpServer]");
|
||||
return;
|
||||
@ -2846,7 +2847,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
|
||||
let max_seeding_time = -1;
|
||||
if ($("max_seeding_time_checkbox").checked) {
|
||||
max_seeding_time = $("max_seeding_time_value").value.toInt();
|
||||
max_seeding_time = Number($("max_seeding_time_value").value);
|
||||
if (isNaN(max_seeding_time) || (max_seeding_time < 0) || (max_seeding_time > 525600)) {
|
||||
alert("QBT_TR(Seeding time limit must be between 0 and 525600 minutes.)QBT_TR[CONTEXT=HttpServer]");
|
||||
return;
|
||||
@ -2854,11 +2855,11 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
}
|
||||
settings["max_seeding_time_enabled"] = $("max_seeding_time_checkbox").checked;
|
||||
settings["max_seeding_time"] = max_seeding_time;
|
||||
settings["max_ratio_act"] = $("max_ratio_act").value.toInt();
|
||||
settings["max_ratio_act"] = Number($("max_ratio_act").value);
|
||||
|
||||
let max_inactive_seeding_time = -1;
|
||||
if ($("max_inactive_seeding_time_checkbox").checked) {
|
||||
max_inactive_seeding_time = $("max_inactive_seeding_time_value").value.toInt();
|
||||
max_inactive_seeding_time = Number($("max_inactive_seeding_time_value").value);
|
||||
if (isNaN(max_inactive_seeding_time) || (max_inactive_seeding_time < 0) || (max_inactive_seeding_time > 525600)) {
|
||||
alert("QBT_TR(Seeding time limit must be between 0 and 525600 minutes.)QBT_TR[CONTEXT=HttpServer]");
|
||||
return;
|
||||
@ -2866,7 +2867,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
}
|
||||
settings["max_inactive_seeding_time_enabled"] = $("max_inactive_seeding_time_checkbox").checked;
|
||||
settings["max_inactive_seeding_time"] = max_inactive_seeding_time;
|
||||
settings["max_ratio_act"] = $("max_ratio_act").value.toInt();
|
||||
settings["max_ratio_act"] = Number($("max_ratio_act").value);
|
||||
|
||||
// Add trackers
|
||||
settings["add_trackers_enabled"] = $("add_trackers_checkbox").checked;
|
||||
@ -2885,7 +2886,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||
// HTTP Server
|
||||
settings["web_ui_domain_list"] = $("webui_domain_textarea").value;
|
||||
const web_ui_address = $("webui_address_value").value.toString();
|
||||
const web_ui_port = $("webui_port_value").value.toInt();
|
||||
const web_ui_port = Number($("webui_port_value").value);
|
||||
if (isNaN(web_ui_port) || (web_ui_port < 1) || (web_ui_port > 65535)) {
|
||||
alert("QBT_TR(The port used for the WebUI must be between 1 and 65535.)QBT_TR[CONTEXT=HttpServer]");
|
||||
return;
|
||||
|
@ -595,7 +595,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||
rulesList[rule].mustNotContain = $("mustNotContainText").value;
|
||||
rulesList[rule].episodeFilter = $("episodeFilterText").value;
|
||||
rulesList[rule].smartFilter = $("useSmartFilter").checked;
|
||||
rulesList[rule].ignoreDays = parseInt($("ignoreDaysValue").value, 10);
|
||||
rulesList[rule].ignoreDays = Number($("ignoreDaysValue").value);
|
||||
rulesList[rule].affectedFeeds = [...rssDownloaderFeedSelectionTable.getRowValues()]
|
||||
.filter((row) => row.full_data.checked)
|
||||
.map((row) => row.full_data.url);
|
||||
|
Loading…
Reference in New Issue
Block a user