@ -1084,34 +1084,34 @@
@@ -1084,34 +1084,34 @@
'use strict';
// Downloads tab
var WatchedFoldersTable = new HtmlTable($("watched_folders_tab"));
this. WatchedFoldersTable = new HtmlTable($("watched_folders_tab"));
var updateTempDirEnabled = function() {
var isTempDirEnabled = $('temppath_checkbox').getProperty('checked');
this. updateTempDirEnabled = function() {
const isTempDirEnabled = $('temppath_checkbox').getProperty('checked');
$('temppath_text').setProperty('disabled', !isTempDirEnabled);
};
var addWatchFolder = function() {
var new_folder = $('new_watch_folder_txt').getProperty('value').trim();
this. addWatchFolder = function() {
const new_folder = $('new_watch_folder_txt').getProperty('value').trim();
if (new_folder.length < = 0) return;
var new_other = $('new_watch_folder_other_txt').getProperty('value').trim();
const new_other = $('new_watch_folder_other_txt').getProperty('value').trim();
if (new_other.length < = 0) return;
var new_select = $('new_watch_folder_select').getProperty('value').trim();
const new_select = $('new_watch_folder_select').getProperty('value').trim();
var i = $('watched_folders_tab').getChildren('tbody')[0].getChildren('tr').length;
const i = $('watched_folders_tab').getChildren('tbody')[0].getChildren('tr').length;
pushWatchFolder(i, new_folder, new_select, new_other);
// Clear fields
$('new_watch_folder_txt').setProperty('value', '');
var elt = $('new_watch_folder_select');
const elt = $('new_watch_folder_select');
elt.setProperty('value', 'watch_folder');
var text = elt.options[elt.selectedIndex].innerHTML;
const text = elt.options[elt.selectedIndex].innerHTML;
$('new_watch_folder_other_txt').setProperty('value', text);
};
var changeWatchFolderSelect = function(item) {
this. changeWatchFolderSelect = function(item) {
if (item.value == "other") {
item.nextElementSibling.hidden = false;
item.nextElementSibling.value = 'QBT_TR(Type folder here)QBT_TR[CONTEXT=HttpServer]';
@ -1119,15 +1119,15 @@
@@ -1119,15 +1119,15 @@
}
else {
item.nextElementSibling.hidden = true;
var text = item.options[item.selectedIndex].innerHTML;
const text = item.options[item.selectedIndex].innerHTML;
item.nextElementSibling.value = text;
}
};
var pushWatchFolder = function(pos, folder, sel, other) {
var myinput = "< input id = 'text_watch_" + pos + "' type = 'text' value = '" + folder + "' > ";
var disableInput = (sel != "other");
var mycb = "< div class = 'select-watched-folder-editable' > "
this. pushWatchFolder = function(pos, folder, sel, other) {
const myinput = "< input id = 'text_watch_" + pos + "' type = 'text' value = '" + folder + "' > ";
const disableInput = (sel != "other");
const mycb = "< div class = 'select-watched-folder-editable' > "
+ "< select id = 'cb_watch_" + pos + "' onchange = 'changeWatchFolderSelect(this)' > "
+ "< option value = 'watch_folder' > QBT_TR(Monitored folder)QBT_TR[CONTEXT=ScanFoldersModel]< / option > "
+ "< option value = 'default_folder' > QBT_TR(Default save location)QBT_TR[CONTEXT=ScanFoldersModel]< / option > "
@ -1138,20 +1138,20 @@
@@ -1138,20 +1138,20 @@
WatchedFoldersTable.push([myinput, mycb]);
$('cb_watch_' + pos).setProperty('value', sel);
if (disableInput) {
var elt = $('cb_watch_' + pos);
const elt = $('cb_watch_' + pos);
other = elt.options[elt.selectedIndex].innerHTML;
}
$('cb_watch_txt_' + pos).setProperty('value', other);
};
var getWatchedFolders = function() {
var nb_folders = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length;
var folders = new Hash();
for (var i = 0; i < nb_folders ; + + i ) {
var fpath = $('text_watch_' + i).getProperty('value').trim();
this. getWatchedFolders = function() {
const nb_folders = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length;
const folders = new Hash();
for (let i = 0; i < nb_folders ; + + i ) {
const fpath = $('text_watch_' + i).getProperty('value').trim();
if (fpath.length > 0) {
var other;
var sel = $('cb_watch_' + i).getProperty('value').trim();
let other;
const sel = $('cb_watch_' + i).getProperty('value').trim();
if (sel == "other") {
other = $('cb_watch_txt_' + i).getProperty('value').trim();
}
@ -1164,18 +1164,18 @@
@@ -1164,18 +1164,18 @@
return folders;
};
var updateExportDirEnabled = function() {
var isExportDirEnabled = $('exportdir_checkbox').getProperty('checked');
this. updateExportDirEnabled = function() {
const isExportDirEnabled = $('exportdir_checkbox').getProperty('checked');
$('exportdir_text').setProperty('disabled', !isExportDirEnabled);
};
var updateExportDirFinEnabled = function() {
var isExportDirFinEnabled = $('exportdirfin_checkbox').getProperty('checked');
this. updateExportDirFinEnabled = function() {
const isExportDirFinEnabled = $('exportdirfin_checkbox').getProperty('checked');
$('exportdirfin_text').setProperty('disabled', !isExportDirFinEnabled);
};
var updateMailNotification = function() {
var isMailNotificationEnabled = $('mail_notification_checkbox').getProperty('checked');
this. updateMailNotification = function() {
const isMailNotificationEnabled = $('mail_notification_checkbox').getProperty('checked');
$('src_email_txt').setProperty('disabled', !isMailNotificationEnabled);
$('dest_email_txt').setProperty('disabled', !isMailNotificationEnabled);
$('smtp_server_txt').setProperty('disabled', !isMailNotificationEnabled);
@ -1188,47 +1188,47 @@
@@ -1188,47 +1188,47 @@
}
};
var updateMailAuthSettings = function() {
var isMailAuthEnabled = $('mail_auth_checkbox').getProperty('checked');
this. updateMailAuthSettings = function() {
const isMailAuthEnabled = $('mail_auth_checkbox').getProperty('checked');
$('mail_username_text').setProperty('disabled', !isMailAuthEnabled);
$('mail_password_text').setProperty('disabled', !isMailAuthEnabled);
};
var updateAutoRun = function() {
var isAutoRunEnabled = $('autorun_checkbox').getProperty('checked');
this. updateAutoRun = function() {
const isAutoRunEnabled = $('autorun_checkbox').getProperty('checked');
$('autorunProg_txt').setProperty('disabled', !isAutoRunEnabled);
};
// Connection tab
var updateMaxConnecEnabled = function() {
var isMaxConnecEnabled = $('max_connec_checkbox').getProperty('checked');
this. updateMaxConnecEnabled = function() {
const isMaxConnecEnabled = $('max_connec_checkbox').getProperty('checked');
$('max_connec_value').setProperty('disabled', !isMaxConnecEnabled);
};
var updateMaxConnecPerTorrentEnabled = function() {
var isMaxConnecPerTorrentEnabled = $('max_connec_per_torrent_checkbox').getProperty('checked');
this. updateMaxConnecPerTorrentEnabled = function() {
const isMaxConnecPerTorrentEnabled = $('max_connec_per_torrent_checkbox').getProperty('checked');
$('max_connec_per_torrent_value').setProperty('disabled', !isMaxConnecPerTorrentEnabled);
};
var updateMaxUploadsEnabled = function() {
var isMaxUploadsEnabled = $('max_uploads_checkbox').getProperty('checked');
this. updateMaxUploadsEnabled = function() {
const isMaxUploadsEnabled = $('max_uploads_checkbox').getProperty('checked');
$('max_uploads_value').setProperty('disabled', !isMaxUploadsEnabled);
};
var updateMaxUploadsPerTorrentEnabled = function() {
var isMaxUploadsPerTorrentEnabled = $('max_uploads_per_torrent_checkbox').getProperty('checked');
this. updateMaxUploadsPerTorrentEnabled = function() {
const isMaxUploadsPerTorrentEnabled = $('max_uploads_per_torrent_checkbox').getProperty('checked');
$('max_uploads_per_torrent_value').setProperty('disabled', !isMaxUploadsPerTorrentEnabled);
};
var updatePeerProxySettings = function() {
var isPeerProxyTypeSelected = $('peer_proxy_type_select').getProperty('value') != "none";
this. updatePeerProxySettings = function() {
const isPeerProxyTypeSelected = $('peer_proxy_type_select').getProperty('value') != "none";
$('peer_proxy_host_text').setProperty('disabled', !isPeerProxyTypeSelected);
$('peer_proxy_port_value').setProperty('disabled', !isPeerProxyTypeSelected);
$('use_peer_proxy_checkbox').setProperty('disabled', !isPeerProxyTypeSelected);
$('proxy_only_for_torrents_checkbox').setProperty('disabled', !isPeerProxyTypeSelected);
if (isPeerProxyTypeSelected) {
var isPeerProxyTypeSocks5 = $('peer_proxy_type_select').getProperty('value') == "socks5";
const isPeerProxyTypeSocks5 = $('peer_proxy_type_select').getProperty('value') == "socks5";
$('peer_proxy_auth_checkbox').setProperty('disabled', !isPeerProxyTypeSocks5);
if (!isPeerProxyTypeSocks5) {
@ -1243,22 +1243,22 @@
@@ -1243,22 +1243,22 @@
}
};
var updatePeerProxyAuthSettings = function() {
var isPeerProxyAuthEnabled = $('peer_proxy_auth_checkbox').getProperty('checked');
this. updatePeerProxyAuthSettings = function() {
const isPeerProxyAuthEnabled = $('peer_proxy_auth_checkbox').getProperty('checked');
$('peer_proxy_username_text').setProperty('disabled', !isPeerProxyAuthEnabled);
$('peer_proxy_password_text').setProperty('disabled', !isPeerProxyAuthEnabled);
};
var updateFilterSettings = function() {
var isIPFilterEnabled = $('ipfilter_enabled_checkbox').getProperty('checked');
this. updateFilterSettings = function() {
const isIPFilterEnabled = $('ipfilter_enabled_checkbox').getProperty('checked');
$('ipfilter_text').setProperty('disabled', !isIPFilterEnabled);
$('ipfilter_trackers_checkbox').setProperty('disabled', !isIPFilterEnabled);
$('banned_IPs_textarea').setProperty('disabled', !isIPFilterEnabled);
};
// Speed tab
var updateSchedulingEnabled = function() {
var isLimitSchedulingEnabled = $('limit_sheduling_checkbox').getProperty('checked');
this. updateSchedulingEnabled = function() {
const isLimitSchedulingEnabled = $('limit_sheduling_checkbox').getProperty('checked');
$('schedule_from_hour').setProperty('disabled', !isLimitSchedulingEnabled);
$('schedule_from_min').setProperty('disabled', !isLimitSchedulingEnabled);
$('schedule_to_hour').setProperty('disabled', !isLimitSchedulingEnabled);
@ -1267,8 +1267,8 @@
@@ -1267,8 +1267,8 @@
};
// Bittorrent tab
var updateQueueingSystem = function() {
var isQueueingEnabled = $('queueing_checkbox').getProperty('checked');
this. updateQueueingSystem = function() {
const isQueueingEnabled = $('queueing_checkbox').getProperty('checked');
$('max_active_dl_value').setProperty('disabled', !isQueueingEnabled);
$('max_active_up_value').setProperty('disabled', !isQueueingEnabled);
$('max_active_to_value').setProperty('disabled', !isQueueingEnabled);
@ -1276,59 +1276,59 @@
@@ -1276,59 +1276,59 @@
updateSlowTorrentsSettings();
};
var updateSlowTorrentsSettings = function() {
var isDontCountSlowTorrentsEnabled = (!$('dont_count_slow_torrents_checkbox').getProperty('disabled')) & & $('dont_count_slow_torrents_checkbox').getProperty('checked');
this. updateSlowTorrentsSettings = function() {
const isDontCountSlowTorrentsEnabled = (!$('dont_count_slow_torrents_checkbox').getProperty('disabled')) & & $('dont_count_slow_torrents_checkbox').getProperty('checked');
$('dl_rate_threshold').setProperty('disabled', !isDontCountSlowTorrentsEnabled);
$('ul_rate_threshold').setProperty('disabled', !isDontCountSlowTorrentsEnabled);
$('torrent_inactive_timer').setProperty('disabled', !isDontCountSlowTorrentsEnabled);
};
var updateMaxRatioTimeEnabled = function() {
var isMaxRatioEnabled = $('max_ratio_checkbox').getProperty('checked');
this. updateMaxRatioTimeEnabled = function() {
const isMaxRatioEnabled = $('max_ratio_checkbox').getProperty('checked');
$('max_ratio_value').setProperty('disabled', !isMaxRatioEnabled);
var isMaxSeedingTimeEnabled = $('max_seeding_time_checkbox').getProperty('checked');
const isMaxSeedingTimeEnabled = $('max_seeding_time_checkbox').getProperty('checked');
$('max_seeding_time_value').setProperty('disabled', !isMaxSeedingTimeEnabled);
$('max_ratio_act').setProperty('disabled', !(isMaxRatioEnabled || isMaxSeedingTimeEnabled));
};
var updateAddTrackersEnabled = function() {
var isAddTrackersEnabled = $('add_trackers_checkbox').getProperty('checked');
this. updateAddTrackersEnabled = function() {
const isAddTrackersEnabled = $('add_trackers_checkbox').getProperty('checked');
$('add_trackers_textarea').setProperty('disabled', !isAddTrackersEnabled);
};
// Web UI tab
var updateHttpsSettings = function() {
var isUseHttpsEnabled = $('use_https_checkbox').getProperty('checked');
this. updateHttpsSettings = function() {
const isUseHttpsEnabled = $('use_https_checkbox').getProperty('checked');
$('ssl_cert_text').setProperty('disabled', !isUseHttpsEnabled);
$('ssl_key_text').setProperty('disabled', !isUseHttpsEnabled);
};
var updateBypasssAuthSettings = function() {
var isBypassAuthSubnetWhitelistEnabled = $('bypass_auth_subnet_whitelist_checkbox').getProperty('checked');
this. updateBypasssAuthSettings = function() {
const isBypassAuthSubnetWhitelistEnabled = $('bypass_auth_subnet_whitelist_checkbox').getProperty('checked');
$('bypass_auth_subnet_whitelist_textarea').setProperty('disabled', !isBypassAuthSubnetWhitelistEnabled);
};
var updateAlternativeWebUISettings = function() {
var isUseAlternativeWebUIEnabled = $('use_alt_webui_checkbox').getProperty('checked');
this. updateAlternativeWebUISettings = function() {
const isUseAlternativeWebUIEnabled = $('use_alt_webui_checkbox').getProperty('checked');
$('webui_files_location_textarea').setProperty('disabled', !isUseAlternativeWebUIEnabled);
};
var updateHostHeaderValidationSettings = function() {
var isHostHeaderValidationEnabled = $('host_header_validation_checkbox').getProperty('checked');
this. updateHostHeaderValidationSettings = function() {
const isHostHeaderValidationEnabled = $('host_header_validation_checkbox').getProperty('checked');
$('webui_domain_textarea').setProperty('disabled', !isHostHeaderValidationEnabled);
};
var updateDynDnsSettings = function() {
var isDynDnsEnabled = $('use_dyndns_checkbox').getProperty('checked');
this. updateDynDnsSettings = function() {
const isDynDnsEnabled = $('use_dyndns_checkbox').getProperty('checked');
$('dyndns_select').setProperty('disabled', !isDynDnsEnabled);
$('dyndns_domain_text').setProperty('disabled', !isDynDnsEnabled);
$('dyndns_username_text').setProperty('disabled', !isDynDnsEnabled);
$('dyndns_password_text').setProperty('disabled', !isDynDnsEnabled);
};
var registerDynDns = function() {
this. registerDynDns = function() {
if ($('dyndns_select').getProperty('value').toInt() == 1) {
window.open("http://www.no-ip.com/services/managed_dns/free_dynamic_dns.html", "NO-IP Registration");
}
@ -1337,22 +1337,22 @@
@@ -1337,22 +1337,22 @@
}
};
var generateRandomPort = function() {
var min = 1024;
var max = 65535;
var port = Math.floor(Math.random() * (max - min + 1) + min);
this. generateRandomPort = function() {
const min = 1024;
const max = 65535;
const port = Math.floor(Math.random() * (max - min + 1) + min);
$('port_value').setProperty('value', port);
};
var time_padding = function(val) {
var ret = val.toString();
this. time_padding = function(val) {
let ret = val.toString();
if (ret.length == 1)
ret = '0' + ret;
return ret;
};
// Advanced Tab
var updateNetworkInterfaces = function(default_iface) {
this. updateNetworkInterfaces = function(default_iface) {
const url = 'api/v2/app/networkInterfaceList';
$('networkInterface').empty();
new Request.JSON({
@ -1374,7 +1374,7 @@
@@ -1374,7 +1374,7 @@
}).send();
};
var updateInterfaceAddresses = function(iface, default_addr) {
this. updateInterfaceAddresses = function(iface, default_addr) {
const url = 'api/v2/app/networkInterfaceAddressList';
$('optionalIPAddressToBind').empty();
new Request.JSON({
@ -1399,8 +1399,8 @@
@@ -1399,8 +1399,8 @@
}).send();
}
var loadPreferences = function() {
var url = 'api/v2/app/preferences';
this. loadPreferences = function() {
const url = 'api/v2/app/preferences';
new Request.JSON({
url: url,
method: 'get',
@ -1448,10 +1448,10 @@
@@ -1448,10 +1448,10 @@
updateExportDirFinEnabled();
// Automatically add torrents from
var i = 0;
for (var folder in pref.scan_dirs) {
var sel;
var other = "";
let i = 0;
for (const folder in pref.scan_dirs) {
let sel;
let other = "";
if (typeof pref.scan_dirs[folder] == "string") {
other = pref.scan_dirs[folder];
sel = "other";
@ -1486,7 +1486,7 @@
@@ -1486,7 +1486,7 @@
$('random_port_checkbox').setProperty('checked', pref.random_port);
// Connections Limits
var max_connec = pref.max_connec.toInt();
const max_connec = pref.max_connec.toInt();
if (max_connec < = 0) {
$('max_connec_checkbox').setProperty('checked', false);
$('max_connec_value').setProperty('value', 500);
@ -1496,7 +1496,7 @@
@@ -1496,7 +1496,7 @@
$('max_connec_value').setProperty('value', max_connec);
}
updateMaxConnecEnabled();
var max_connec_per_torrent = pref.max_connec_per_torrent.toInt();
const max_connec_per_torrent = pref.max_connec_per_torrent.toInt();
if (max_connec_per_torrent < = 0) {
$('max_connec_per_torrent_checkbox').setProperty('checked', false);
$('max_connec_per_torrent_value').setProperty('value', 100);
@ -1506,7 +1506,7 @@
@@ -1506,7 +1506,7 @@
$('max_connec_per_torrent_value').setProperty('value', max_connec_per_torrent);
}
updateMaxConnecPerTorrentEnabled();
var max_uploads = pref.max_uploads.toInt();
const max_uploads = pref.max_uploads.toInt();
if (max_uploads < = 0) {
$('max_uploads_checkbox').setProperty('checked', false);
$('max_uploads_value').setProperty('value', 8);
@ -1516,7 +1516,7 @@
@@ -1516,7 +1516,7 @@
$('max_uploads_value').setProperty('value', max_uploads);
}
updateMaxUploadsEnabled();
var max_uploads_per_torrent = pref.max_uploads_per_torrent.toInt();
const max_uploads_per_torrent = pref.max_uploads_per_torrent.toInt();
if (max_uploads_per_torrent < = 0) {
$('max_uploads_per_torrent_checkbox').setProperty('checked', false);
$('max_uploads_per_torrent_value').setProperty('value', 4);
@ -1587,7 +1587,7 @@
@@ -1587,7 +1587,7 @@
$('dht_checkbox').setProperty('checked', pref.dht);
$('pex_checkbox').setProperty('checked', pref.pex);
$('lsd_checkbox').setProperty('checked', pref.lsd);
var encryption = pref.encryption.toInt();
const encryption = pref.encryption.toInt();
$('encryption_select').getChildren('option')[encryption].setAttribute('selected', '');
$('anonymous_mode_checkbox').setProperty('checked', pref.anonymous_mode);
@ -1608,14 +1608,12 @@
@@ -1608,14 +1608,12 @@
$('max_ratio_value').setProperty('value', pref.max_ratio);
else
$('max_ratio_value').setProperty('value', 1);
var max_ratio_act = pref.max_ratio_act.toInt();
$('max_ratio_act').getChildren('option')[max_ratio_act].setAttribute('selected', '');
$('max_seeding_time_checkbox').setProperty('checked', pref.max_seeding_time_enabled);
if (pref.max_seeding_time_enabled)
$('max_seeding_time_value').setProperty('value', pref.max_seeding_time.toInt());
else
$('max_seeding_time_value').setProperty('value', 1440);
var max_ratio_act = pref.max_ratio_act.toInt();
const max_ratio_act = pref.max_ratio_act.toInt();
$('max_ratio_act').getChildren('option')[max_ratio_act].setAttribute('selected', '');
updateMaxRatioTimeEnabled();
@ -1703,8 +1701,8 @@
@@ -1703,8 +1701,8 @@
}).send();
};
var applyPreferences = function() {
var settings = new Hash();
this. applyPreferences = function() {
const settings = new Hash();
// Validate form data
// Downloads tab
// When adding a torrent
@ -1751,7 +1749,7 @@
@@ -1751,7 +1749,7 @@
// Connection tab
// Listening Port
var listen_port = $('port_value').getProperty('value').toInt();
const listen_port = $('port_value').getProperty('value').toInt();
if (isNaN(listen_port) || listen_port < 1 | | listen_port > 65535) {
alert("QBT_TR(The port used for incoming connections must be between 1 and 65535.)QBT_TR[CONTEXT=HttpServer]");
return;
@ -1761,7 +1759,7 @@
@@ -1761,7 +1759,7 @@
settings.set('random_port', $('random_port_checkbox').getProperty('checked'));
// Connections Limits
var max_connec = -1;
let max_connec = -1;
if ($('max_connec_checkbox').getProperty('checked')) {
max_connec = $('max_connec_value').getProperty('value').toInt();
if (isNaN(max_connec) || max_connec < = 0) {
@ -1770,7 +1768,7 @@
@@ -1770,7 +1768,7 @@
}
}
settings.set('max_connec', max_connec);
var max_connec_per_torrent = -1;
let max_connec_per_torrent = -1;
if ($('max_connec_per_torrent_checkbox').getProperty('checked')) {
max_connec_per_torrent = $('max_connec_per_torrent_value').getProperty('value').toInt();
if (isNaN(max_connec_per_torrent) || max_connec_per_torrent < = 0) {
@ -1779,7 +1777,7 @@
@@ -1779,7 +1777,7 @@
}
}
settings.set('max_connec_per_torrent', max_connec_per_torrent);
var max_uploads = -1;
let max_uploads = -1;
if ($('max_uploads_checkbox').getProperty('checked')) {
max_uploads = $('max_uploads_value').getProperty('value').toInt();
if (isNaN(max_uploads) || max_uploads < = 0) {
@ -1788,7 +1786,7 @@
@@ -1788,7 +1786,7 @@
}
}
settings.set('max_uploads', max_uploads);
var max_uploads_per_torrent = -1;
let max_uploads_per_torrent = -1;
if ($('max_uploads_per_torrent_checkbox').getProperty('checked')) {
max_uploads_per_torrent = $('max_uploads_per_torrent_value').getProperty('value').toInt();
if (isNaN(max_uploads_per_torrent) || max_uploads_per_torrent < = 0) {
@ -1799,9 +1797,9 @@
@@ -1799,9 +1797,9 @@
settings.set('max_uploads_per_torrent', max_uploads_per_torrent);
// Proxy Server
var proxy_type_str = $('peer_proxy_type_select').getProperty('value');
var proxy_type = 0;
var proxy_auth_enabled = false;
const proxy_type_str = $('peer_proxy_type_select').getProperty('value');
let proxy_type = 0;
let proxy_auth_enabled = false;
if (proxy_type_str == "socks5") {
if ($('peer_proxy_auth_checkbox').getProperty('checked')) {
proxy_type = 4;
@ -1844,14 +1842,14 @@
@@ -1844,14 +1842,14 @@
// Speed tab
// Global Rate Limits
var up_limit = $('up_limit_value').getProperty('value').toInt() * 1024;
const up_limit = $('up_limit_value').getProperty('value').toInt() * 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.set('up_limit', up_limit);
var dl_limit = $('dl_limit_value').getProperty('value').toInt() * 1024;
const dl_limit = $('dl_limit_value').getProperty('value').toInt() * 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;
@ -1859,14 +1857,14 @@
@@ -1859,14 +1857,14 @@
settings.set('dl_limit', dl_limit);
// Alternative Global Rate Limits
var alt_up_limit = $('alt_up_limit_value').getProperty('value').toInt() * 1024;
const alt_up_limit = $('alt_up_limit_value').getProperty('value').toInt() * 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.set('alt_up_limit', alt_up_limit);
var alt_dl_limit = $('alt_dl_limit_value').getProperty('value').toInt() * 1024;
const alt_dl_limit = $('alt_dl_limit_value').getProperty('value').toInt() * 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;
@ -1879,7 +1877,7 @@
@@ -1879,7 +1877,7 @@
settings.set('limit_lan_peers', $('limit_lan_peers_checkbox').getProperty('checked'));
// Scheduler
var scheduling_enabled = $('limit_sheduling_checkbox').getProperty('checked');
const scheduling_enabled = $('limit_sheduling_checkbox').getProperty('checked');
settings.set('scheduler_enabled', scheduling_enabled);
if (scheduling_enabled) {
settings.set('schedule_from_hour', $('schedule_from_hour').getProperty('value').toInt());
@ -1900,38 +1898,38 @@
@@ -1900,38 +1898,38 @@
// Torrent Queueing
settings.set('queueing_enabled', $('queueing_checkbox').getProperty('checked'));
if ($('queueing_checkbox').getProperty('checked')) {
var max_active_downloads = $('max_active_dl_value').getProperty('value').toInt();
const max_active_downloads = $('max_active_dl_value').getProperty('value').toInt();
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.set('max_active_downloads', max_active_downloads);
var max_active_uploads = $('max_active_up_value').getProperty('value').toInt();
const max_active_uploads = $('max_active_up_value').getProperty('value').toInt();
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.set('max_active_uploads', max_active_uploads);
var max_active_torrents = $('max_active_to_value').getProperty('value').toInt();
const max_active_torrents = $('max_active_to_value').getProperty('value').toInt();
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.set('max_active_torrents', max_active_torrents);
settings.set('dont_count_slow_torrents', $('dont_count_slow_torrents_checkbox').getProperty('checked'));
var dl_rate_threshold = $('dl_rate_threshold').getProperty('value').toInt();
const dl_rate_threshold = $('dl_rate_threshold').getProperty('value').toInt();
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.set('slow_torrent_dl_rate_threshold', dl_rate_threshold);
var ul_rate_threshold = $('ul_rate_threshold').getProperty('value').toInt();
const ul_rate_threshold = $('ul_rate_threshold').getProperty('value').toInt();
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.set('slow_torrent_ul_rate_threshold', ul_rate_threshold);
var torrent_inactive_timer = $('torrent_inactive_timer').getProperty('value').toInt();
const torrent_inactive_timer = $('torrent_inactive_timer').getProperty('value').toInt();
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;
@ -1940,7 +1938,7 @@
@@ -1940,7 +1938,7 @@
}
// Share Ratio Limiting
var max_ratio = -1;
let max_ratio = -1;
if ($('max_ratio_checkbox').getProperty('checked')) {
max_ratio = $('max_ratio_value').getProperty('value');
if (isNaN(max_ratio) || max_ratio < 0 | | max_ratio > 9998) {
@ -1952,7 +1950,7 @@
@@ -1952,7 +1950,7 @@
settings.set('max_ratio', max_ratio);
settings.set('max_ratio_act', $('max_ratio_act').getProperty('value').toInt());
var max_seeding_time = -1;
let max_seeding_time = -1;
if ($('max_seeding_time_checkbox').getProperty('checked')) {
max_seeding_time = $('max_seeding_time_value').getProperty('value').toInt();
if (isNaN(max_seeding_time) || max_seeding_time < 0 | | max_seeding_time > 525600) {
@ -1974,8 +1972,8 @@
@@ -1974,8 +1972,8 @@
// HTTP Server
settings.set('web_ui_domain_list', $('webui_domain_textarea').getProperty('value'));
var web_ui_address = $('webui_address_value').getProperty('value').toString();
var web_ui_port = $('webui_port_value').getProperty('value').toInt();
const web_ui_address = $('webui_address_value').getProperty('value').toString();
const web_ui_port = $('webui_port_value').getProperty('value').toInt();
if (isNaN(web_ui_port) || web_ui_port < 1 | | web_ui_port > 65535) {
alert("QBT_TR(The port used for the Web UI must be between 1 and 65535.)QBT_TR[CONTEXT=HttpServer]");
return;
@ -1988,12 +1986,12 @@
@@ -1988,12 +1986,12 @@
settings.set('web_ui_https_key_path', $('ssl_key_text').getProperty('value'));
// Authentication
var web_ui_username = $('webui_username_text').getProperty('value');
const web_ui_username = $('webui_username_text').getProperty('value');
if (web_ui_username.length < 3 ) {
alert("QBT_TR(The Web UI username must be at least 3 characters long.)QBT_TR[CONTEXT=OptionsDialog]");
return;
}
var web_ui_password = $('webui_password_text').getProperty('value');
const web_ui_password = $('webui_password_text').getProperty('value');
if ((0 < web_ui_password.length ) & & ( web_ui_password . length < 6 ) ) {
alert("QBT_TR(The Web UI password must be at least 6 characters long.)QBT_TR[CONTEXT=OptionsDialog]");
return;
@ -2008,8 +2006,8 @@
@@ -2008,8 +2006,8 @@
settings.set('web_ui_session_timeout', $('webUISessionTimeoutInput').getProperty('value'));
// Use alternative Web UI
var alternative_webui_enabled = $('use_alt_webui_checkbox').getProperty('checked');
var webui_files_location_textarea = $('webui_files_location_textarea').getProperty('value');
const alternative_webui_enabled = $('use_alt_webui_checkbox').getProperty('checked');
const webui_files_location_textarea = $('webui_files_location_textarea').getProperty('value');
if (alternative_webui_enabled & & (webui_files_location_textarea.trim() === "")) {
alert("QBT_TR(The alternative Web UI files location cannot be blank.)QBT_TR[CONTEXT=OptionsDialog]");
return;
@ -2064,7 +2062,7 @@
@@ -2064,7 +2062,7 @@
settings.set('announce_ip', $('announceIP').getProperty('value'));
// Send it to qBT
var json_str = JSON.encode(settings);
const json_str = JSON.encode(settings);
new Request({
url: 'api/v2/app/setPreferences',