mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-14 09:13:08 -07:00
Cache program preferences
So that qbt can just use the data from memory which is vastly faster than waiting for a response over the net.
This commit is contained in:
parent
6d68ab4dae
commit
d06d5b923a
10 changed files with 402 additions and 340 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"env": {
|
"env": {
|
||||||
"browser": true,
|
"browser": true,
|
||||||
"es2021": true
|
"es2022": true
|
||||||
},
|
},
|
||||||
"extends": "eslint:recommended",
|
"extends": "eslint:recommended",
|
||||||
"plugins": [
|
"plugins": [
|
||||||
|
|
|
@ -37,38 +37,25 @@
|
||||||
const isDeletingFiles = (new URI().getData('deleteFiles') === "true");
|
const isDeletingFiles = (new URI().getData('deleteFiles') === "true");
|
||||||
$('deleteFromDiskCB').checked = isDeletingFiles;
|
$('deleteFromDiskCB').checked = isDeletingFiles;
|
||||||
|
|
||||||
let prefDeleteContentFiles = false;
|
const prefCache = window.parent.qBittorrent.Cache.preferences.get();
|
||||||
new Request.JSON({
|
let prefDeleteContentFiles = prefCache.delete_torrent_content_files;
|
||||||
url: 'api/v2/app/preferences',
|
|
||||||
method: 'get',
|
|
||||||
noCache: true,
|
|
||||||
onSuccess: function(pref) {
|
|
||||||
if (!pref)
|
|
||||||
return;
|
|
||||||
|
|
||||||
prefDeleteContentFiles = pref.delete_torrent_content_files;
|
|
||||||
$('deleteFromDiskCB').checked ||= prefDeleteContentFiles;
|
$('deleteFromDiskCB').checked ||= prefDeleteContentFiles;
|
||||||
}
|
|
||||||
}).send();
|
|
||||||
$('deleteFromDiskCB').addEvent('click', function(e) {
|
$('deleteFromDiskCB').addEvent('click', function(e) {
|
||||||
setRememberBtnEnabled($('deleteFromDiskCB').checked !== prefDeleteContentFiles);
|
setRememberBtnEnabled($('deleteFromDiskCB').checked !== prefDeleteContentFiles);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set current "Delete files" choice as the default
|
// Set current "Delete files" choice as the default
|
||||||
$('rememberBtn').addEvent('click', function(e) {
|
$('rememberBtn').addEvent('click', function(e) {
|
||||||
new Request({
|
window.parent.qBittorrent.Cache.preferences.set({
|
||||||
url: 'api/v2/app/setPreferences',
|
|
||||||
method: 'post',
|
|
||||||
data: {
|
data: {
|
||||||
'json': JSON.encode({
|
|
||||||
'delete_torrent_content_files': $('deleteFromDiskCB').checked
|
'delete_torrent_content_files': $('deleteFromDiskCB').checked
|
||||||
})
|
|
||||||
},
|
},
|
||||||
onSuccess: function() {
|
onSuccess: function() {
|
||||||
prefDeleteContentFiles = $('deleteFromDiskCB').checked;
|
prefDeleteContentFiles = $('deleteFromDiskCB').checked;
|
||||||
setRememberBtnEnabled(false);
|
setRememberBtnEnabled(false);
|
||||||
}
|
}
|
||||||
}).send();
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const hashes = new URI().getData('hashes').split('|');
|
const hashes = new URI().getData('hashes').split('|');
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
<script src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
|
||||||
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
|
||||||
<script src="scripts/lib/mocha.min.js"></script>
|
<script src="scripts/lib/mocha.min.js"></script>
|
||||||
<script src="scripts/localpreferences.js"></script>
|
<script src="scripts/cache.js?v=${CACHEID}"></script>
|
||||||
|
<script src="scripts/localpreferences.js?v=${CACHEID}"></script>
|
||||||
<script src="scripts/mocha-init.js?locale=${LANG}&v=${CACHEID}"></script>
|
<script src="scripts/mocha-init.js?locale=${LANG}&v=${CACHEID}"></script>
|
||||||
<script src="scripts/lib/clipboard.min.js"></script>
|
<script src="scripts/lib/clipboard.min.js"></script>
|
||||||
<script src="scripts/filesystem.js?v=${CACHEID}"></script>
|
<script src="scripts/filesystem.js?v=${CACHEID}"></script>
|
||||||
|
|
112
src/webui/www/private/scripts/cache.js
Normal file
112
src/webui/www/private/scripts/cache.js
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
/*
|
||||||
|
* Bittorrent Client using Qt and libtorrent.
|
||||||
|
* Copyright (C) 2024 Mike Tzou (Chocobo1)
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
* In addition, as a special exception, the copyright holders give permission to
|
||||||
|
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
||||||
|
* modified versions of it that use the same license as the "OpenSSL" library),
|
||||||
|
* and distribute the linked executables. You must obey the GNU General Public
|
||||||
|
* License in all respects for all of the code used other than "OpenSSL". If you
|
||||||
|
* modify file(s), you may extend this exception to your version of the file(s),
|
||||||
|
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||||
|
* exception statement from your version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
if (window.qBittorrent === undefined)
|
||||||
|
window.qBittorrent = {};
|
||||||
|
|
||||||
|
window.qBittorrent.Cache = (() => {
|
||||||
|
const exports = () => {
|
||||||
|
return {
|
||||||
|
preferences: new PreferencesCache()
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class PreferencesCache {
|
||||||
|
#m_store = {};
|
||||||
|
|
||||||
|
// obj: {
|
||||||
|
// onFailure: () => {},
|
||||||
|
// onSuccess: () => {}
|
||||||
|
// }
|
||||||
|
init(obj = {}) {
|
||||||
|
new Request.JSON({
|
||||||
|
url: 'api/v2/app/preferences',
|
||||||
|
method: 'get',
|
||||||
|
noCache: true,
|
||||||
|
onFailure: (xhr) => {
|
||||||
|
if (typeof obj.onFailure === 'function')
|
||||||
|
obj.onFailure(xhr);
|
||||||
|
},
|
||||||
|
onSuccess: (responseJSON, responseText) => {
|
||||||
|
if (!responseJSON)
|
||||||
|
return;
|
||||||
|
this.#m_store = structuredClone(responseJSON);
|
||||||
|
|
||||||
|
if (typeof obj.onSuccess === 'function')
|
||||||
|
obj.onSuccess(responseJSON, responseText);
|
||||||
|
}
|
||||||
|
}).send();
|
||||||
|
}
|
||||||
|
|
||||||
|
get() {
|
||||||
|
return structuredClone(this.#m_store);
|
||||||
|
}
|
||||||
|
|
||||||
|
// obj: {
|
||||||
|
// data: {},
|
||||||
|
// onFailure: () => {},
|
||||||
|
// onSuccess: () => {}
|
||||||
|
// }
|
||||||
|
set(obj) {
|
||||||
|
if (typeof obj !== 'object')
|
||||||
|
throw new Error('`obj` is not an object.');
|
||||||
|
if (typeof obj.data !== 'object')
|
||||||
|
throw new Error('`data` is not an object.');
|
||||||
|
|
||||||
|
new Request({
|
||||||
|
url: 'api/v2/app/setPreferences',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
'json': JSON.stringify(obj.data)
|
||||||
|
},
|
||||||
|
onFailure: (xhr) => {
|
||||||
|
if (typeof obj.onFailure === 'function')
|
||||||
|
obj.onFailure(xhr);
|
||||||
|
},
|
||||||
|
onSuccess: (responseText, responseXML) => {
|
||||||
|
for (const key in obj.data) {
|
||||||
|
if (!Object.hasOwn(obj.data, key))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const value = obj.data[key];
|
||||||
|
this.#m_store[key] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof obj.onSuccess === 'function')
|
||||||
|
obj.onSuccess(responseText, responseXML);
|
||||||
|
}
|
||||||
|
}).send();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return exports();
|
||||||
|
})();
|
||||||
|
|
||||||
|
Object.freeze(window.qBittorrent.Cache);
|
|
@ -1576,6 +1576,8 @@ window.addEvent('load', function() {
|
||||||
}
|
}
|
||||||
}).activate();
|
}).activate();
|
||||||
|
|
||||||
|
window.parent.qBittorrent.Cache.preferences.init();
|
||||||
|
|
||||||
// fetch qbt version and store it locally
|
// fetch qbt version and store it locally
|
||||||
new Request({
|
new Request({
|
||||||
url: 'api/v2/app/version',
|
url: 'api/v2/app/version',
|
||||||
|
|
|
@ -59,16 +59,7 @@ window.qBittorrent.Download = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getPreferences = function() {
|
const getPreferences = function() {
|
||||||
new Request.JSON({
|
const pref = window.parent.qBittorrent.Cache.preferences.get();
|
||||||
url: 'api/v2/app/preferences',
|
|
||||||
method: 'get',
|
|
||||||
noCache: true,
|
|
||||||
onFailure: function() {
|
|
||||||
alert("Could not contact qBittorrent");
|
|
||||||
},
|
|
||||||
onSuccess: function(pref) {
|
|
||||||
if (!pref)
|
|
||||||
return;
|
|
||||||
|
|
||||||
defaultSavePath = pref.save_path;
|
defaultSavePath = pref.save_path;
|
||||||
$('savepath').setProperty('value', defaultSavePath);
|
$('savepath').setProperty('value', defaultSavePath);
|
||||||
|
@ -102,8 +93,6 @@ window.qBittorrent.Download = (function() {
|
||||||
else {
|
else {
|
||||||
$('contentLayout').selectedIndex = 0;
|
$('contentLayout').selectedIndex = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}).send();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeCategorySelect = function(item) {
|
const changeCategorySelect = function(item) {
|
||||||
|
|
|
@ -1985,17 +1985,8 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadPreferences = function() {
|
const loadPreferences = function() {
|
||||||
new Request.JSON({
|
window.parent.qBittorrent.Cache.preferences.init({
|
||||||
url: 'api/v2/app/preferences',
|
onSuccess: (pref) => {
|
||||||
method: 'get',
|
|
||||||
noCache: true,
|
|
||||||
onFailure: function() {
|
|
||||||
alert("Could not contact qBittorrent");
|
|
||||||
},
|
|
||||||
onSuccess: function(pref) {
|
|
||||||
if (!pref)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Behavior tab
|
// Behavior tab
|
||||||
$('filelog_checkbox').setProperty('checked', pref.file_log_enabled);
|
$('filelog_checkbox').setProperty('checked', pref.file_log_enabled);
|
||||||
$('filelog_save_path_input').setProperty('value', pref.file_log_path);
|
$('filelog_save_path_input').setProperty('value', pref.file_log_path);
|
||||||
|
@ -2395,75 +2386,75 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
$('i2pInboundLength').setProperty('value', pref.i2p_inbound_length);
|
$('i2pInboundLength').setProperty('value', pref.i2p_inbound_length);
|
||||||
$('i2pOutboundLength').setProperty('value', pref.i2p_outbound_length);
|
$('i2pOutboundLength').setProperty('value', pref.i2p_outbound_length);
|
||||||
}
|
}
|
||||||
}).send();
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const applyPreferences = function() {
|
const applyPreferences = function() {
|
||||||
const settings = new Hash();
|
const settings = {};
|
||||||
// Validate form data
|
// Validate form data
|
||||||
|
|
||||||
// Behavior tab
|
// Behavior tab
|
||||||
settings.set('file_log_enabled', $('filelog_checkbox').getProperty('checked'));
|
settings['file_log_enabled'] = $('filelog_checkbox').getProperty('checked');
|
||||||
settings.set('file_log_path', $('filelog_save_path_input').getProperty('value'));
|
settings['file_log_path'] = $('filelog_save_path_input').getProperty('value');
|
||||||
settings.set('file_log_backup_enabled', $('filelog_backup_checkbox').getProperty('checked'));
|
settings['file_log_backup_enabled'] = $('filelog_backup_checkbox').getProperty('checked');
|
||||||
settings.set('file_log_max_size', Number($('filelog_max_size_input').getProperty('value')));
|
settings['file_log_max_size'] = Number($('filelog_max_size_input').getProperty('value'));
|
||||||
settings.set('file_log_delete_old', $('filelog_delete_old_checkbox').getProperty('checked'));
|
settings['file_log_delete_old'] = $('filelog_delete_old_checkbox').getProperty('checked');
|
||||||
settings.set('file_log_age', Number($('filelog_age_input').getProperty('value')));
|
settings['file_log_age'] = Number($('filelog_age_input').getProperty('value'));
|
||||||
settings.set('file_log_age_type', Number($('filelog_age_type_select').getProperty('value')));
|
settings['file_log_age_type'] = Number($('filelog_age_type_select').getProperty('value'));
|
||||||
|
|
||||||
// Downloads tab
|
// Downloads tab
|
||||||
// When adding a torrent
|
// When adding a torrent
|
||||||
settings.set('torrent_content_layout', $('contentlayout_select').getSelected()[0].getProperty('value'));
|
settings['torrent_content_layout'] = $('contentlayout_select').getSelected()[0].getProperty('value');
|
||||||
settings.set('add_to_top_of_queue', $('addToTopOfQueueCheckbox').getProperty('checked'));
|
settings['add_to_top_of_queue'] = $('addToTopOfQueueCheckbox').getProperty('checked');
|
||||||
settings.set('start_paused_enabled', $('dontstartdownloads_checkbox').getProperty('checked'));
|
settings['start_paused_enabled'] = $('dontstartdownloads_checkbox').getProperty('checked');
|
||||||
settings.set('torrent_stop_condition', $('stopConditionSelect').getSelected()[0].getProperty('value'));
|
settings['torrent_stop_condition'] = $('stopConditionSelect').getSelected()[0].getProperty('value');
|
||||||
settings.set('auto_delete_mode', Number($('deletetorrentfileafter_checkbox').getProperty('checked')));
|
settings['auto_delete_mode'] = Number($('deletetorrentfileafter_checkbox').getProperty('checked'));
|
||||||
|
|
||||||
settings.set('preallocate_all', $('preallocateall_checkbox').getProperty('checked'));
|
settings['preallocate_all'] = $('preallocateall_checkbox').getProperty('checked');
|
||||||
settings.set('incomplete_files_ext', $('appendext_checkbox').getProperty('checked'));
|
settings['incomplete_files_ext'] = $('appendext_checkbox').getProperty('checked');
|
||||||
settings.set('use_unwanted_folder', $('unwantedfolder_checkbox').getProperty('checked'));
|
settings['use_unwanted_folder'] = $('unwantedfolder_checkbox').getProperty('checked');
|
||||||
|
|
||||||
// Saving Management
|
// Saving Management
|
||||||
settings.set('auto_tmm_enabled', ($('default_tmm_combobox').getProperty('value') === 'true'));
|
settings['auto_tmm_enabled'] = ($('default_tmm_combobox').getProperty('value') === 'true');
|
||||||
settings.set('torrent_changed_tmm_enabled', ($('torrent_changed_tmm_combobox').getProperty('value') === 'true'));
|
settings['torrent_changed_tmm_enabled'] = ($('torrent_changed_tmm_combobox').getProperty('value') === 'true');
|
||||||
settings.set('save_path_changed_tmm_enabled', ($('save_path_changed_tmm_combobox').getProperty('value') === 'true'));
|
settings['save_path_changed_tmm_enabled'] = ($('save_path_changed_tmm_combobox').getProperty('value') === 'true');
|
||||||
settings.set('category_changed_tmm_enabled', ($('category_changed_tmm_combobox').getProperty('value') === 'true'));
|
settings['category_changed_tmm_enabled'] = ($('category_changed_tmm_combobox').getProperty('value') === 'true');
|
||||||
settings.set('use_subcategories', $('use_subcategories_checkbox').getProperty('checked'));
|
settings['use_subcategories'] = $('use_subcategories_checkbox').getProperty('checked');
|
||||||
settings.set('save_path', $('savepath_text').getProperty('value'));
|
settings['save_path'] = $('savepath_text').getProperty('value');
|
||||||
settings.set('temp_path_enabled', $('temppath_checkbox').getProperty('checked'));
|
settings['temp_path_enabled'] = $('temppath_checkbox').getProperty('checked');
|
||||||
settings.set('temp_path', $('temppath_text').getProperty('value'));
|
settings['temp_path'] = $('temppath_text').getProperty('value');
|
||||||
if ($('exportdir_checkbox').getProperty('checked'))
|
if ($('exportdir_checkbox').getProperty('checked'))
|
||||||
settings.set('export_dir', $('exportdir_text').getProperty('value'));
|
settings['export_dir'] = $('exportdir_text').getProperty('value');
|
||||||
else
|
else
|
||||||
settings.set('export_dir', '');
|
settings['export_dir'] = '';
|
||||||
if ($('exportdirfin_checkbox').getProperty('checked'))
|
if ($('exportdirfin_checkbox').getProperty('checked'))
|
||||||
settings.set('export_dir_fin', $('exportdirfin_text').getProperty('value'));
|
settings['export_dir_fin'] = $('exportdirfin_text').getProperty('value');
|
||||||
else
|
else
|
||||||
settings.set('export_dir_fin', '');
|
settings['export_dir_fin'] = '';
|
||||||
|
|
||||||
// Automatically add torrents from
|
// Automatically add torrents from
|
||||||
settings.set('scan_dirs', getWatchedFolders());
|
settings['scan_dirs'] = getWatchedFolders();
|
||||||
|
|
||||||
// Excluded file names
|
// Excluded file names
|
||||||
settings.set('excluded_file_names_enabled', $('excludedFileNamesCheckbox').getProperty('checked'));
|
settings['excluded_file_names_enabled'] = $('excludedFileNamesCheckbox').getProperty('checked');
|
||||||
settings.set('excluded_file_names', $('excludedFileNamesTextarea').getProperty('value'));
|
settings['excluded_file_names'] = $('excludedFileNamesTextarea').getProperty('value');
|
||||||
|
|
||||||
// Email notification upon download completion
|
// Email notification upon download completion
|
||||||
settings.set('mail_notification_enabled', $('mail_notification_checkbox').getProperty('checked'));
|
settings['mail_notification_enabled'] = $('mail_notification_checkbox').getProperty('checked');
|
||||||
settings.set('mail_notification_sender', $('src_email_txt').getProperty('value'));
|
settings['mail_notification_sender'] = $('src_email_txt').getProperty('value');
|
||||||
settings.set('mail_notification_email', $('dest_email_txt').getProperty('value'));
|
settings['mail_notification_email'] = $('dest_email_txt').getProperty('value');
|
||||||
settings.set('mail_notification_smtp', $('smtp_server_txt').getProperty('value'));
|
settings['mail_notification_smtp'] = $('smtp_server_txt').getProperty('value');
|
||||||
settings.set('mail_notification_ssl_enabled', $('mail_ssl_checkbox').getProperty('checked'));
|
settings['mail_notification_ssl_enabled'] = $('mail_ssl_checkbox').getProperty('checked');
|
||||||
settings.set('mail_notification_auth_enabled', $('mail_auth_checkbox').getProperty('checked'));
|
settings['mail_notification_auth_enabled'] = $('mail_auth_checkbox').getProperty('checked');
|
||||||
settings.set('mail_notification_username', $('mail_username_text').getProperty('value'));
|
settings['mail_notification_username'] = $('mail_username_text').getProperty('value');
|
||||||
settings.set('mail_notification_password', $('mail_password_text').getProperty('value'));
|
settings['mail_notification_password'] = $('mail_password_text').getProperty('value');
|
||||||
|
|
||||||
// Run an external program on torrent added
|
// Run an external program on torrent added
|
||||||
settings.set('autorun_on_torrent_added_enabled', $('autorunOnTorrentAddedCheckbox').getProperty('checked'));
|
settings['autorun_on_torrent_added_enabled'] = $('autorunOnTorrentAddedCheckbox').getProperty('checked');
|
||||||
settings.set('autorun_on_torrent_added_program', $('autorunOnTorrentAddedProgram').getProperty('value'));
|
settings['autorun_on_torrent_added_program'] = $('autorunOnTorrentAddedProgram').getProperty('value');
|
||||||
// Run an external program on torrent finished
|
// Run an external program on torrent finished
|
||||||
settings.set('autorun_enabled', $('autorun_checkbox').getProperty('checked'));
|
settings['autorun_enabled'] = $('autorun_checkbox').getProperty('checked');
|
||||||
settings.set('autorun_program', $('autorunProg_txt').getProperty('value'));
|
settings['autorun_program'] = $('autorunProg_txt').getProperty('value');
|
||||||
|
|
||||||
// Connection tab
|
// Connection tab
|
||||||
// Listening Port
|
// Listening Port
|
||||||
|
@ -2472,8 +2463,8 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
alert("QBT_TR(The port used for incoming connections must be between 0 and 65535.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(The port used for incoming connections must be between 0 and 65535.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.set('listen_port', listen_port);
|
settings['listen_port'] = listen_port;
|
||||||
settings.set('upnp', $('upnp_checkbox').getProperty('checked'));
|
settings['upnp'] = $('upnp_checkbox').getProperty('checked');
|
||||||
|
|
||||||
// Connections Limits
|
// Connections Limits
|
||||||
let max_connec = -1;
|
let max_connec = -1;
|
||||||
|
@ -2484,7 +2475,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
settings.set('max_connec', max_connec);
|
settings['max_connec'] = max_connec;
|
||||||
let max_connec_per_torrent = -1;
|
let max_connec_per_torrent = -1;
|
||||||
if ($('max_connec_per_torrent_checkbox').getProperty('checked')) {
|
if ($('max_connec_per_torrent_checkbox').getProperty('checked')) {
|
||||||
max_connec_per_torrent = $('max_connec_per_torrent_value').getProperty('value').toInt();
|
max_connec_per_torrent = $('max_connec_per_torrent_value').getProperty('value').toInt();
|
||||||
|
@ -2493,7 +2484,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
settings.set('max_connec_per_torrent', max_connec_per_torrent);
|
settings['max_connec_per_torrent'] = max_connec_per_torrent;
|
||||||
let max_uploads = -1;
|
let max_uploads = -1;
|
||||||
if ($('max_uploads_checkbox').getProperty('checked')) {
|
if ($('max_uploads_checkbox').getProperty('checked')) {
|
||||||
max_uploads = $('max_uploads_value').getProperty('value').toInt();
|
max_uploads = $('max_uploads_value').getProperty('value').toInt();
|
||||||
|
@ -2502,7 +2493,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
settings.set('max_uploads', max_uploads);
|
settings['max_uploads'] = max_uploads;
|
||||||
let max_uploads_per_torrent = -1;
|
let max_uploads_per_torrent = -1;
|
||||||
if ($('max_uploads_per_torrent_checkbox').getProperty('checked')) {
|
if ($('max_uploads_per_torrent_checkbox').getProperty('checked')) {
|
||||||
max_uploads_per_torrent = $('max_uploads_per_torrent_value').getProperty('value').toInt();
|
max_uploads_per_torrent = $('max_uploads_per_torrent_value').getProperty('value').toInt();
|
||||||
|
@ -2511,32 +2502,32 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
settings.set('max_uploads_per_torrent', max_uploads_per_torrent);
|
settings['max_uploads_per_torrent'] = max_uploads_per_torrent;
|
||||||
|
|
||||||
// I2P
|
// I2P
|
||||||
settings.set('i2p_enabled', $('i2pEnabledCheckbox').getProperty('checked'));
|
settings['i2p_enabled'] = $('i2pEnabledCheckbox').getProperty('checked');
|
||||||
settings.set('i2p_address', $('i2pAddress').getProperty('value'));
|
settings['i2p_address'] = $('i2pAddress').getProperty('value');
|
||||||
settings.set('i2p_port', $('i2pPort').getProperty('value').toInt());
|
settings['i2p_port'] = $('i2pPort').getProperty('value').toInt();
|
||||||
settings.set('i2p_mixed_mode', $('i2pMixedMode').getProperty('checked'));
|
settings['i2p_mixed_mode'] = $('i2pMixedMode').getProperty('checked');
|
||||||
|
|
||||||
// Proxy Server
|
// Proxy Server
|
||||||
settings.set('proxy_type', $('peer_proxy_type_select').getProperty('value'));
|
settings['proxy_type'] = $('peer_proxy_type_select').getProperty('value');
|
||||||
settings.set('proxy_ip', $('peer_proxy_host_text').getProperty('value'));
|
settings['proxy_ip'] = $('peer_proxy_host_text').getProperty('value');
|
||||||
settings.set('proxy_port', $('peer_proxy_port_value').getProperty('value').toInt());
|
settings['proxy_port'] = $('peer_proxy_port_value').getProperty('value').toInt();
|
||||||
settings.set('proxy_auth_enabled', $('peer_proxy_auth_checkbox').getProperty('checked'));
|
settings['proxy_auth_enabled'] = $('peer_proxy_auth_checkbox').getProperty('checked');
|
||||||
settings.set('proxy_username', $('peer_proxy_username_text').getProperty('value'));
|
settings['proxy_username'] = $('peer_proxy_username_text').getProperty('value');
|
||||||
settings.set('proxy_password', $('peer_proxy_password_text').getProperty('value'));
|
settings['proxy_password'] = $('peer_proxy_password_text').getProperty('value');
|
||||||
settings.set('proxy_hostname_lookup', $('proxyHostnameLookupCheckbox').getProperty('checked'));
|
settings['proxy_hostname_lookup'] = $('proxyHostnameLookupCheckbox').getProperty('checked');
|
||||||
settings.set('proxy_bittorrent', $('proxy_bittorrent_checkbox').getProperty('checked'));
|
settings['proxy_bittorrent'] = $('proxy_bittorrent_checkbox').getProperty('checked');
|
||||||
settings.set('proxy_peer_connections', $('use_peer_proxy_checkbox').getProperty('checked'));
|
settings['proxy_peer_connections'] = $('use_peer_proxy_checkbox').getProperty('checked');
|
||||||
settings.set('proxy_rss', $('proxy_rss_checkbox').getProperty('checked'));
|
settings['proxy_rss'] = $('proxy_rss_checkbox').getProperty('checked');
|
||||||
settings.set('proxy_misc', $('proxy_misc_checkbox').getProperty('checked'));
|
settings['proxy_misc'] = $('proxy_misc_checkbox').getProperty('checked');
|
||||||
|
|
||||||
// IP Filtering
|
// IP Filtering
|
||||||
settings.set('ip_filter_enabled', $('ipfilter_text_checkbox').getProperty('checked'));
|
settings['ip_filter_enabled'] = $('ipfilter_text_checkbox').getProperty('checked');
|
||||||
settings.set('ip_filter_path', $('ipfilter_text').getProperty('value'));
|
settings['ip_filter_path'] = $('ipfilter_text').getProperty('value');
|
||||||
settings.set('ip_filter_trackers', $('ipfilter_trackers_checkbox').getProperty('checked'));
|
settings['ip_filter_trackers'] = $('ipfilter_trackers_checkbox').getProperty('checked');
|
||||||
settings.set('banned_IPs', $('banned_IPs_textarea').getProperty('value'));
|
settings['banned_IPs'] = $('banned_IPs_textarea').getProperty('value');
|
||||||
|
|
||||||
// Speed tab
|
// Speed tab
|
||||||
// Global Rate Limits
|
// Global Rate Limits
|
||||||
|
@ -2545,14 +2536,14 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
alert("QBT_TR(Global upload rate limit must be greater than 0 or disabled.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Global upload rate limit must be greater than 0 or disabled.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.set('up_limit', up_limit);
|
settings['up_limit'] = up_limit;
|
||||||
|
|
||||||
const 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) {
|
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]");
|
alert("QBT_TR(Global download rate limit must be greater than 0 or disabled.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.set('dl_limit', dl_limit);
|
settings['dl_limit'] = dl_limit;
|
||||||
|
|
||||||
// Alternative Global Rate Limits
|
// Alternative Global Rate Limits
|
||||||
const alt_up_limit = $('alt_up_limit_value').getProperty('value').toInt() * 1024;
|
const alt_up_limit = $('alt_up_limit_value').getProperty('value').toInt() * 1024;
|
||||||
|
@ -2560,81 +2551,81 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
alert("QBT_TR(Alternative upload rate limit must be greater than 0 or disabled.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Alternative upload rate limit must be greater than 0 or disabled.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.set('alt_up_limit', alt_up_limit);
|
settings['alt_up_limit'] = alt_up_limit;
|
||||||
|
|
||||||
const 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) {
|
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]");
|
alert("QBT_TR(Alternative download rate limit must be greater than 0 or disabled.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.set('alt_dl_limit', alt_dl_limit);
|
settings['alt_dl_limit'] = alt_dl_limit;
|
||||||
|
|
||||||
settings.set('bittorrent_protocol', Number($('enable_protocol_combobox').getProperty('value')));
|
settings['bittorrent_protocol'] = Number($('enable_protocol_combobox').getProperty('value'));
|
||||||
settings.set('limit_utp_rate', $('limit_utp_rate_checkbox').getProperty('checked'));
|
settings['limit_utp_rate'] = $('limit_utp_rate_checkbox').getProperty('checked');
|
||||||
settings.set('limit_tcp_overhead', $('limit_tcp_overhead_checkbox').getProperty('checked'));
|
settings['limit_tcp_overhead'] = $('limit_tcp_overhead_checkbox').getProperty('checked');
|
||||||
settings.set('limit_lan_peers', $('limit_lan_peers_checkbox').getProperty('checked'));
|
settings['limit_lan_peers'] = $('limit_lan_peers_checkbox').getProperty('checked');
|
||||||
|
|
||||||
// Scheduler
|
// Scheduler
|
||||||
const scheduling_enabled = $('limitSchedulingCheckbox').getProperty('checked');
|
const scheduling_enabled = $('limitSchedulingCheckbox').getProperty('checked');
|
||||||
settings.set('scheduler_enabled', scheduling_enabled);
|
settings['scheduler_enabled'] = scheduling_enabled;
|
||||||
if (scheduling_enabled) {
|
if (scheduling_enabled) {
|
||||||
settings.set('schedule_from_hour', $('schedule_from_hour').getProperty('value').toInt());
|
settings['schedule_from_hour'] = $('schedule_from_hour').getProperty('value').toInt();
|
||||||
settings.set('schedule_from_min', $('schedule_from_min').getProperty('value').toInt());
|
settings['schedule_from_min'] = $('schedule_from_min').getProperty('value').toInt();
|
||||||
settings.set('schedule_to_hour', $('schedule_to_hour').getProperty('value').toInt());
|
settings['schedule_to_hour'] = $('schedule_to_hour').getProperty('value').toInt();
|
||||||
settings.set('schedule_to_min', $('schedule_to_min').getProperty('value').toInt());
|
settings['schedule_to_min'] = $('schedule_to_min').getProperty('value').toInt();
|
||||||
settings.set('scheduler_days', $('schedule_freq_select').getProperty('value').toInt());
|
settings['scheduler_days'] = $('schedule_freq_select').getProperty('value').toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bittorrent tab
|
// Bittorrent tab
|
||||||
// Privacy
|
// Privacy
|
||||||
settings.set('dht', $('dht_checkbox').getProperty('checked'));
|
settings['dht'] = $('dht_checkbox').getProperty('checked');
|
||||||
settings.set('pex', $('pex_checkbox').getProperty('checked'));
|
settings['pex'] = $('pex_checkbox').getProperty('checked');
|
||||||
settings.set('lsd', $('lsd_checkbox').getProperty('checked'));
|
settings['lsd'] = $('lsd_checkbox').getProperty('checked');
|
||||||
settings.set('encryption', Number($('encryption_select').getSelected()[0].getProperty('value')));
|
settings['encryption'] = Number($('encryption_select').getSelected()[0].getProperty('value'));
|
||||||
settings.set('anonymous_mode', $('anonymous_mode_checkbox').getProperty('checked'));
|
settings['anonymous_mode'] = $('anonymous_mode_checkbox').getProperty('checked');
|
||||||
|
|
||||||
settings.set('max_active_checking_torrents', Number($('maxActiveCheckingTorrents').getProperty('value')));
|
settings['max_active_checking_torrents'] = Number($('maxActiveCheckingTorrents').getProperty('value'));
|
||||||
|
|
||||||
// Torrent Queueing
|
// Torrent Queueing
|
||||||
settings.set('queueing_enabled', $('queueing_checkbox').getProperty('checked'));
|
settings['queueing_enabled'] = $('queueing_checkbox').getProperty('checked');
|
||||||
if ($('queueing_checkbox').getProperty('checked')) {
|
if ($('queueing_checkbox').getProperty('checked')) {
|
||||||
const 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) {
|
if (isNaN(max_active_downloads) || max_active_downloads < -1) {
|
||||||
alert("QBT_TR(Maximum active downloads must be greater than -1.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Maximum active downloads must be greater than -1.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.set('max_active_downloads', max_active_downloads);
|
settings['max_active_downloads'] = max_active_downloads;
|
||||||
const 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) {
|
if (isNaN(max_active_uploads) || max_active_uploads < -1) {
|
||||||
alert("QBT_TR(Maximum active uploads must be greater than -1.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Maximum active uploads must be greater than -1.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.set('max_active_uploads', max_active_uploads);
|
settings['max_active_uploads'] = max_active_uploads;
|
||||||
const 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) {
|
if (isNaN(max_active_torrents) || max_active_torrents < -1) {
|
||||||
alert("QBT_TR(Maximum active torrents must be greater than -1.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Maximum active torrents must be greater than -1.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.set('max_active_torrents', max_active_torrents);
|
settings['max_active_torrents'] = max_active_torrents;
|
||||||
settings.set('dont_count_slow_torrents', $('dont_count_slow_torrents_checkbox').getProperty('checked'));
|
settings['dont_count_slow_torrents'] = $('dont_count_slow_torrents_checkbox').getProperty('checked');
|
||||||
const 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)) {
|
if (isNaN(dl_rate_threshold) || (dl_rate_threshold < 1)) {
|
||||||
alert("QBT_TR(Download rate threshold must be greater than 0.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Download rate threshold must be greater than 0.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.set('slow_torrent_dl_rate_threshold', dl_rate_threshold);
|
settings['slow_torrent_dl_rate_threshold'] = dl_rate_threshold;
|
||||||
const 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)) {
|
if (isNaN(ul_rate_threshold) || (ul_rate_threshold < 1)) {
|
||||||
alert("QBT_TR(Upload rate threshold must be greater than 0.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Upload rate threshold must be greater than 0.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.set('slow_torrent_ul_rate_threshold', ul_rate_threshold);
|
settings['slow_torrent_ul_rate_threshold'] = ul_rate_threshold;
|
||||||
const 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)) {
|
if (isNaN(torrent_inactive_timer) || (torrent_inactive_timer < 1)) {
|
||||||
alert("QBT_TR(Torrent inactivity timer must be greater than 0.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Torrent inactivity timer must be greater than 0.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.set('slow_torrent_inactive_timer', torrent_inactive_timer);
|
settings['slow_torrent_inactive_timer'] = torrent_inactive_timer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Share Ratio Limiting
|
// Share Ratio Limiting
|
||||||
|
@ -2646,8 +2637,8 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
settings.set('max_ratio_enabled', $('max_ratio_checkbox').getProperty('checked'));
|
settings['max_ratio_enabled'] = $('max_ratio_checkbox').getProperty('checked');
|
||||||
settings.set('max_ratio', max_ratio);
|
settings['max_ratio'] = max_ratio;
|
||||||
|
|
||||||
let max_seeding_time = -1;
|
let max_seeding_time = -1;
|
||||||
if ($('max_seeding_time_checkbox').getProperty('checked')) {
|
if ($('max_seeding_time_checkbox').getProperty('checked')) {
|
||||||
|
@ -2657,9 +2648,9 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
settings.set('max_seeding_time_enabled', $('max_seeding_time_checkbox').getProperty('checked'));
|
settings['max_seeding_time_enabled'] = $('max_seeding_time_checkbox').getProperty('checked');
|
||||||
settings.set('max_seeding_time', max_seeding_time);
|
settings['max_seeding_time'] = max_seeding_time;
|
||||||
settings.set('max_ratio_act', $('max_ratio_act').getProperty('value').toInt());
|
settings['max_ratio_act'] = $('max_ratio_act').getProperty('value').toInt();
|
||||||
|
|
||||||
let max_inactive_seeding_time = -1;
|
let max_inactive_seeding_time = -1;
|
||||||
if ($('max_inactive_seeding_time_checkbox').getProperty('checked')) {
|
if ($('max_inactive_seeding_time_checkbox').getProperty('checked')) {
|
||||||
|
@ -2669,52 +2660,52 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
settings.set('max_inactive_seeding_time_enabled', $('max_inactive_seeding_time_checkbox').getProperty('checked'));
|
settings['max_inactive_seeding_time_enabled'] = $('max_inactive_seeding_time_checkbox').getProperty('checked');
|
||||||
settings.set('max_inactive_seeding_time', max_inactive_seeding_time);
|
settings['max_inactive_seeding_time'] = max_inactive_seeding_time;
|
||||||
settings.set('max_ratio_act', $('max_ratio_act').getProperty('value').toInt());
|
settings['max_ratio_act'] = $('max_ratio_act').getProperty('value').toInt();
|
||||||
|
|
||||||
// Add trackers
|
// Add trackers
|
||||||
settings.set('add_trackers_enabled', $('add_trackers_checkbox').getProperty('checked'));
|
settings['add_trackers_enabled'] = $('add_trackers_checkbox').getProperty('checked');
|
||||||
settings.set('add_trackers', $('add_trackers_textarea').getProperty('value'));
|
settings['add_trackers'] = $('add_trackers_textarea').getProperty('value');
|
||||||
|
|
||||||
// RSS Tab
|
// RSS Tab
|
||||||
settings.set('rss_processing_enabled', $('enable_fetching_rss_feeds_checkbox').getProperty('checked'));
|
settings['rss_processing_enabled'] = $('enable_fetching_rss_feeds_checkbox').getProperty('checked');
|
||||||
settings.set('rss_refresh_interval', Number($('feed_refresh_interval').getProperty('value')));
|
settings['rss_refresh_interval'] = Number($('feed_refresh_interval').getProperty('value'));
|
||||||
settings.set('rss_fetch_delay', Number($('feedFetchDelay').getProperty('value')));
|
settings['rss_fetch_delay'] = Number($('feedFetchDelay').getProperty('value'));
|
||||||
settings.set('rss_max_articles_per_feed', Number($('maximum_article_number').getProperty('value')));
|
settings['rss_max_articles_per_feed'] = Number($('maximum_article_number').getProperty('value'));
|
||||||
settings.set('rss_auto_downloading_enabled', $('enable_auto_downloading_rss_torrents_checkbox').getProperty('checked'));
|
settings['rss_auto_downloading_enabled'] = $('enable_auto_downloading_rss_torrents_checkbox').getProperty('checked');
|
||||||
settings.set('rss_download_repack_proper_episodes', $('downlock_repack_proper_episodes').getProperty('checked'));
|
settings['rss_download_repack_proper_episodes'] = $('downlock_repack_proper_episodes').getProperty('checked');
|
||||||
settings.set('rss_smart_episode_filters', $('rss_filter_textarea').getProperty('value'));
|
settings['rss_smart_episode_filters'] = $('rss_filter_textarea').getProperty('value');
|
||||||
|
|
||||||
// Web UI tab
|
// Web UI tab
|
||||||
// Language
|
// Language
|
||||||
settings.set('locale', $('locale_select').getProperty('value'));
|
settings['locale'] = $('locale_select').getProperty('value');
|
||||||
settings.set('performance_warning', $('performanceWarning').getProperty('checked'));
|
settings['performance_warning'] = $('performanceWarning').getProperty('checked');
|
||||||
|
|
||||||
// HTTP Server
|
// HTTP Server
|
||||||
settings.set('web_ui_domain_list', $('webui_domain_textarea').getProperty('value'));
|
settings['web_ui_domain_list'] = $('webui_domain_textarea').getProperty('value');
|
||||||
const web_ui_address = $('webui_address_value').getProperty('value').toString();
|
const web_ui_address = $('webui_address_value').getProperty('value').toString();
|
||||||
const web_ui_port = $('webui_port_value').getProperty('value').toInt();
|
const web_ui_port = $('webui_port_value').getProperty('value').toInt();
|
||||||
if (isNaN(web_ui_port) || web_ui_port < 1 || web_ui_port > 65535) {
|
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]");
|
alert("QBT_TR(The port used for the Web UI must be between 1 and 65535.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.set('web_ui_address', web_ui_address);
|
settings['web_ui_address'] = web_ui_address;
|
||||||
settings.set('web_ui_port', web_ui_port);
|
settings['web_ui_port'] = web_ui_port;
|
||||||
settings.set('web_ui_upnp', $('webui_upnp_checkbox').getProperty('checked'));
|
settings['web_ui_upnp'] = $('webui_upnp_checkbox').getProperty('checked');
|
||||||
|
|
||||||
const useHTTPS = $('use_https_checkbox').getProperty('checked');
|
const useHTTPS = $('use_https_checkbox').getProperty('checked');
|
||||||
settings.set('use_https', useHTTPS);
|
settings['use_https'] = useHTTPS;
|
||||||
|
|
||||||
const httpsCertificate = $('ssl_cert_text').getProperty('value');
|
const httpsCertificate = $('ssl_cert_text').getProperty('value');
|
||||||
settings.set('web_ui_https_cert_path', httpsCertificate);
|
settings['web_ui_https_cert_path'] = httpsCertificate;
|
||||||
if (useHTTPS && (httpsCertificate.length === 0)) {
|
if (useHTTPS && (httpsCertificate.length === 0)) {
|
||||||
alert("QBT_TR(HTTPS certificate should not be empty)QBT_TR[CONTEXT=OptionsDialog]");
|
alert("QBT_TR(HTTPS certificate should not be empty)QBT_TR[CONTEXT=OptionsDialog]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const httpsKey = $('ssl_key_text').getProperty('value');
|
const httpsKey = $('ssl_key_text').getProperty('value');
|
||||||
settings.set('web_ui_https_key_path', httpsKey);
|
settings['web_ui_https_key_path'] = httpsKey;
|
||||||
if (useHTTPS && (httpsKey.length === 0)) {
|
if (useHTTPS && (httpsKey.length === 0)) {
|
||||||
alert("QBT_TR(HTTPS key should not be empty)QBT_TR[CONTEXT=OptionsDialog]");
|
alert("QBT_TR(HTTPS key should not be empty)QBT_TR[CONTEXT=OptionsDialog]");
|
||||||
return;
|
return;
|
||||||
|
@ -2732,15 +2723,15 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.set('web_ui_username', web_ui_username);
|
settings['web_ui_username'] = web_ui_username;
|
||||||
if (web_ui_password.length > 0)
|
if (web_ui_password.length > 0)
|
||||||
settings.set('web_ui_password', web_ui_password);
|
settings['web_ui_password'] = web_ui_password;
|
||||||
settings.set('bypass_local_auth', $('bypass_local_auth_checkbox').getProperty('checked'));
|
settings['bypass_local_auth'] = $('bypass_local_auth_checkbox').getProperty('checked');
|
||||||
settings.set('bypass_auth_subnet_whitelist_enabled', $('bypass_auth_subnet_whitelist_checkbox').getProperty('checked'));
|
settings['bypass_auth_subnet_whitelist_enabled'] = $('bypass_auth_subnet_whitelist_checkbox').getProperty('checked');
|
||||||
settings.set('bypass_auth_subnet_whitelist', $('bypass_auth_subnet_whitelist_textarea').getProperty('value'));
|
settings['bypass_auth_subnet_whitelist'] = $('bypass_auth_subnet_whitelist_textarea').getProperty('value');
|
||||||
settings.set('web_ui_max_auth_fail_count', Number($('webUIMaxAuthFailCountInput').getProperty('value')));
|
settings['web_ui_max_auth_fail_count'] = Number($('webUIMaxAuthFailCountInput').getProperty('value'));
|
||||||
settings.set('web_ui_ban_duration', Number($('webUIBanDurationInput').getProperty('value')));
|
settings['web_ui_ban_duration'] = Number($('webUIBanDurationInput').getProperty('value'));
|
||||||
settings.set('web_ui_session_timeout', Number($('webUISessionTimeoutInput').getProperty('value')));
|
settings['web_ui_session_timeout'] = Number($('webUISessionTimeoutInput').getProperty('value'));
|
||||||
|
|
||||||
// Use alternative Web UI
|
// Use alternative Web UI
|
||||||
const alternative_webui_enabled = $('use_alt_webui_checkbox').getProperty('checked');
|
const alternative_webui_enabled = $('use_alt_webui_checkbox').getProperty('checked');
|
||||||
|
@ -2749,105 +2740,101 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
alert("QBT_TR(The alternative Web UI files location cannot be blank.)QBT_TR[CONTEXT=OptionsDialog]");
|
alert("QBT_TR(The alternative Web UI files location cannot be blank.)QBT_TR[CONTEXT=OptionsDialog]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
settings.set('alternative_webui_enabled', alternative_webui_enabled);
|
settings['alternative_webui_enabled'] = alternative_webui_enabled;
|
||||||
settings.set('alternative_webui_path', webui_files_location_textarea);
|
settings['alternative_webui_path'] = webui_files_location_textarea;
|
||||||
|
|
||||||
// Security
|
// Security
|
||||||
settings.set('web_ui_clickjacking_protection_enabled', $('clickjacking_protection_checkbox').getProperty('checked'));
|
settings['web_ui_clickjacking_protection_enabled'] = $('clickjacking_protection_checkbox').getProperty('checked');
|
||||||
settings.set('web_ui_csrf_protection_enabled', $('csrf_protection_checkbox').getProperty('checked'));
|
settings['web_ui_csrf_protection_enabled'] = $('csrf_protection_checkbox').getProperty('checked');
|
||||||
settings.set('web_ui_secure_cookie_enabled', $('secureCookieCheckbox').getProperty('checked'));
|
settings['web_ui_secure_cookie_enabled'] = $('secureCookieCheckbox').getProperty('checked');
|
||||||
settings.set('web_ui_host_header_validation_enabled', $('host_header_validation_checkbox').getProperty('checked'));
|
settings['web_ui_host_header_validation_enabled'] = $('host_header_validation_checkbox').getProperty('checked');
|
||||||
|
|
||||||
// Custom HTTP headers
|
// Custom HTTP headers
|
||||||
settings.set('web_ui_use_custom_http_headers_enabled', $('webUIUseCustomHTTPHeadersCheckbox').getProperty('checked'));
|
settings['web_ui_use_custom_http_headers_enabled'] = $('webUIUseCustomHTTPHeadersCheckbox').getProperty('checked');
|
||||||
settings.set('web_ui_custom_http_headers', $('webUICustomHTTPHeadersTextarea').getProperty('value'));
|
settings['web_ui_custom_http_headers'] = $('webUICustomHTTPHeadersTextarea').getProperty('value');
|
||||||
|
|
||||||
// Reverse Proxy
|
// Reverse Proxy
|
||||||
settings.set('web_ui_reverse_proxy_enabled', $('webUIReverseProxySupportCheckbox').getProperty('checked'));
|
settings['web_ui_reverse_proxy_enabled'] = $('webUIReverseProxySupportCheckbox').getProperty('checked');
|
||||||
settings.set('web_ui_reverse_proxies_list', $('webUIReverseProxiesListTextarea').getProperty('value'));
|
settings['web_ui_reverse_proxies_list'] = $('webUIReverseProxiesListTextarea').getProperty('value');
|
||||||
|
|
||||||
// Update my dynamic domain name
|
// Update my dynamic domain name
|
||||||
settings.set('dyndns_enabled', $('use_dyndns_checkbox').getProperty('checked'));
|
settings['dyndns_enabled'] = $('use_dyndns_checkbox').getProperty('checked');
|
||||||
settings.set('dyndns_service', Number($('dyndns_select').getProperty('value')));
|
settings['dyndns_service'] = Number($('dyndns_select').getProperty('value'));
|
||||||
settings.set('dyndns_domain', $('dyndns_domain_text').getProperty('value'));
|
settings['dyndns_domain'] = $('dyndns_domain_text').getProperty('value');
|
||||||
settings.set('dyndns_username', $('dyndns_username_text').getProperty('value'));
|
settings['dyndns_username'] = $('dyndns_username_text').getProperty('value');
|
||||||
settings.set('dyndns_password', $('dyndns_password_text').getProperty('value'));
|
settings['dyndns_password'] = $('dyndns_password_text').getProperty('value');
|
||||||
|
|
||||||
// Update advanced settings
|
// Update advanced settings
|
||||||
// qBittorrent section
|
// qBittorrent section
|
||||||
settings.set('resume_data_storage_type', $('resumeDataStorageType').getProperty('value'));
|
settings['resume_data_storage_type'] = $('resumeDataStorageType').getProperty('value');
|
||||||
settings.set('memory_working_set_limit', Number($('memoryWorkingSetLimit').getProperty('value')));
|
settings['memory_working_set_limit'] = Number($('memoryWorkingSetLimit').getProperty('value'));
|
||||||
settings.set('current_network_interface', $('networkInterface').getProperty('value'));
|
settings['current_network_interface'] = $('networkInterface').getProperty('value');
|
||||||
settings.set('current_interface_address', $('optionalIPAddressToBind').getProperty('value'));
|
settings['current_interface_address'] = $('optionalIPAddressToBind').getProperty('value');
|
||||||
settings.set('save_resume_data_interval', Number($('saveResumeDataInterval').getProperty('value')));
|
settings['save_resume_data_interval'] = Number($('saveResumeDataInterval').getProperty('value'));
|
||||||
settings.set('torrent_file_size_limit', ($('torrentFileSizeLimit').getProperty('value') * 1024 * 1024));
|
settings['torrent_file_size_limit'] = ($('torrentFileSizeLimit').getProperty('value') * 1024 * 1024);
|
||||||
settings.set('recheck_completed_torrents', $('recheckTorrentsOnCompletion').getProperty('checked'));
|
settings['recheck_completed_torrents'] = $('recheckTorrentsOnCompletion').getProperty('checked');
|
||||||
settings.set('refresh_interval', Number($('refreshInterval').getProperty('value')));
|
settings['refresh_interval'] = Number($('refreshInterval').getProperty('value'));
|
||||||
settings.set('resolve_peer_countries', $('resolvePeerCountries').getProperty('checked'));
|
settings['resolve_peer_countries'] = $('resolvePeerCountries').getProperty('checked');
|
||||||
settings.set('reannounce_when_address_changed', $('reannounceWhenAddressChanged').getProperty('checked'));
|
settings['reannounce_when_address_changed'] = $('reannounceWhenAddressChanged').getProperty('checked');
|
||||||
|
|
||||||
// libtorrent section
|
// libtorrent section
|
||||||
settings.set('bdecode_depth_limit', Number($('bdecodeDepthLimit').getProperty('value')));
|
settings['bdecode_depth_limit'] = Number($('bdecodeDepthLimit').getProperty('value'));
|
||||||
settings.set('bdecode_token_limit', Number($('bdecodeTokenLimit').getProperty('value')));
|
settings['bdecode_token_limit'] = Number($('bdecodeTokenLimit').getProperty('value'));
|
||||||
settings.set('async_io_threads', Number($('asyncIOThreads').getProperty('value')));
|
settings['async_io_threads'] = Number($('asyncIOThreads').getProperty('value'));
|
||||||
settings.set('hashing_threads', Number($('hashingThreads').getProperty('value')));
|
settings['hashing_threads'] = Number($('hashingThreads').getProperty('value'));
|
||||||
settings.set('file_pool_size', Number($('filePoolSize').getProperty('value')));
|
settings['file_pool_size'] = Number($('filePoolSize').getProperty('value'));
|
||||||
settings.set('checking_memory_use', Number($('outstandMemoryWhenCheckingTorrents').getProperty('value')));
|
settings['checking_memory_use'] = Number($('outstandMemoryWhenCheckingTorrents').getProperty('value'));
|
||||||
settings.set('disk_cache', Number($('diskCache').getProperty('value')));
|
settings['disk_cache'] = Number($('diskCache').getProperty('value'));
|
||||||
settings.set('disk_cache_ttl', Number($('diskCacheExpiryInterval').getProperty('value')));
|
settings['disk_cache_ttl'] = Number($('diskCacheExpiryInterval').getProperty('value'));
|
||||||
settings.set('disk_queue_size', (Number($('diskQueueSize').getProperty('value')) * 1024));
|
settings['disk_queue_size'] = (Number($('diskQueueSize').getProperty('value')) * 1024);
|
||||||
settings.set('disk_io_type', Number($('diskIOType').getProperty('value')));
|
settings['disk_io_type'] = Number($('diskIOType').getProperty('value'));
|
||||||
settings.set('disk_io_read_mode', Number($('diskIOReadMode').getProperty('value')));
|
settings['disk_io_read_mode'] = Number($('diskIOReadMode').getProperty('value'));
|
||||||
settings.set('disk_io_write_mode', Number($('diskIOWriteMode').getProperty('value')));
|
settings['disk_io_write_mode'] = Number($('diskIOWriteMode').getProperty('value'));
|
||||||
settings.set('enable_coalesce_read_write', $('coalesceReadsAndWrites').getProperty('checked'));
|
settings['enable_coalesce_read_write'] = $('coalesceReadsAndWrites').getProperty('checked');
|
||||||
settings.set('enable_piece_extent_affinity', $('pieceExtentAffinity').getProperty('checked'));
|
settings['enable_piece_extent_affinity'] = $('pieceExtentAffinity').getProperty('checked');
|
||||||
settings.set('enable_upload_suggestions', $('sendUploadPieceSuggestions').getProperty('checked'));
|
settings['enable_upload_suggestions'] = $('sendUploadPieceSuggestions').getProperty('checked');
|
||||||
settings.set('send_buffer_watermark', Number($('sendBufferWatermark').getProperty('value')));
|
settings['send_buffer_watermark'] = Number($('sendBufferWatermark').getProperty('value'));
|
||||||
settings.set('send_buffer_low_watermark', Number($('sendBufferLowWatermark').getProperty('value')));
|
settings['send_buffer_low_watermark'] = Number($('sendBufferLowWatermark').getProperty('value'));
|
||||||
settings.set('send_buffer_watermark_factor', Number($('sendBufferWatermarkFactor').getProperty('value')));
|
settings['send_buffer_watermark_factor'] = Number($('sendBufferWatermarkFactor').getProperty('value'));
|
||||||
settings.set('connection_speed', Number($('connectionSpeed').getProperty('value')));
|
settings['connection_speed'] = Number($('connectionSpeed').getProperty('value'));
|
||||||
settings.set('socket_send_buffer_size', ($('socketSendBufferSize').getProperty('value') * 1024));
|
settings['socket_send_buffer_size'] = ($('socketSendBufferSize').getProperty('value') * 1024);
|
||||||
settings.set('socket_receive_buffer_size', ($('socketReceiveBufferSize').getProperty('value') * 1024));
|
settings['socket_receive_buffer_size'] = ($('socketReceiveBufferSize').getProperty('value') * 1024);
|
||||||
settings.set('socket_backlog_size', Number($('socketBacklogSize').getProperty('value')));
|
settings['socket_backlog_size'] = Number($('socketBacklogSize').getProperty('value'));
|
||||||
settings.set('outgoing_ports_min', Number($('outgoingPortsMin').getProperty('value')));
|
settings['outgoing_ports_min'] = Number($('outgoingPortsMin').getProperty('value'));
|
||||||
settings.set('outgoing_ports_max', Number($('outgoingPortsMax').getProperty('value')));
|
settings['outgoing_ports_max'] = Number($('outgoingPortsMax').getProperty('value'));
|
||||||
settings.set('upnp_lease_duration', Number($('UPnPLeaseDuration').getProperty('value')));
|
settings['upnp_lease_duration'] = Number($('UPnPLeaseDuration').getProperty('value'));
|
||||||
settings.set('peer_tos', Number($('peerToS').getProperty('value')));
|
settings['peer_tos'] = Number($('peerToS').getProperty('value'));
|
||||||
settings.set('utp_tcp_mixed_mode', Number($('utpTCPMixedModeAlgorithm').getProperty('value')));
|
settings['utp_tcp_mixed_mode'] = Number($('utpTCPMixedModeAlgorithm').getProperty('value'));
|
||||||
settings.set('idn_support_enabled', $('IDNSupportCheckbox').getProperty('checked'));
|
settings['idn_support_enabled'] = $('IDNSupportCheckbox').getProperty('checked');
|
||||||
settings.set('enable_multi_connections_from_same_ip', $('allowMultipleConnectionsFromTheSameIPAddress').getProperty('checked'));
|
settings['enable_multi_connections_from_same_ip'] = $('allowMultipleConnectionsFromTheSameIPAddress').getProperty('checked');
|
||||||
settings.set('validate_https_tracker_certificate', $('validateHTTPSTrackerCertificate').getProperty('checked'));
|
settings['validate_https_tracker_certificate'] = $('validateHTTPSTrackerCertificate').getProperty('checked');
|
||||||
settings.set('ssrf_mitigation', $('mitigateSSRF').getProperty('checked'));
|
settings['ssrf_mitigation'] = $('mitigateSSRF').getProperty('checked');
|
||||||
settings.set('block_peers_on_privileged_ports', $('blockPeersOnPrivilegedPorts').getProperty('checked'));
|
settings['block_peers_on_privileged_ports'] = $('blockPeersOnPrivilegedPorts').getProperty('checked');
|
||||||
settings.set('enable_embedded_tracker', $('enableEmbeddedTracker').getProperty('checked'));
|
settings['enable_embedded_tracker'] = $('enableEmbeddedTracker').getProperty('checked');
|
||||||
settings.set('embedded_tracker_port', Number($('embeddedTrackerPort').getProperty('value')));
|
settings['embedded_tracker_port'] = Number($('embeddedTrackerPort').getProperty('value'));
|
||||||
settings.set('embedded_tracker_port_forwarding', $('embeddedTrackerPortForwarding').getProperty('checked'));
|
settings['embedded_tracker_port_forwarding'] = $('embeddedTrackerPortForwarding').getProperty('checked');
|
||||||
settings.set('mark_of_the_web', $('markOfTheWeb').getProperty('checked'));
|
settings['mark_of_the_web'] = $('markOfTheWeb').getProperty('checked');
|
||||||
settings.set('python_executable_path', $('pythonExecutablePath').getProperty('value'));
|
settings['python_executable_path'] = $('pythonExecutablePath').getProperty('value');
|
||||||
settings.set('upload_slots_behavior', Number($('uploadSlotsBehavior').getProperty('value')));
|
settings['upload_slots_behavior'] = Number($('uploadSlotsBehavior').getProperty('value'));
|
||||||
settings.set('upload_choking_algorithm', Number($('uploadChokingAlgorithm').getProperty('value')));
|
settings['upload_choking_algorithm'] = Number($('uploadChokingAlgorithm').getProperty('value'));
|
||||||
settings.set('announce_to_all_trackers', $('announceAllTrackers').getProperty('checked'));
|
settings['announce_to_all_trackers'] = $('announceAllTrackers').getProperty('checked');
|
||||||
settings.set('announce_to_all_tiers', $('announceAllTiers').getProperty('checked'));
|
settings['announce_to_all_tiers'] = $('announceAllTiers').getProperty('checked');
|
||||||
settings.set('announce_ip', $('announceIP').getProperty('value'));
|
settings['announce_ip'] = $('announceIP').getProperty('value');
|
||||||
settings.set('max_concurrent_http_announces', Number($('maxConcurrentHTTPAnnounces').getProperty('value')));
|
settings['max_concurrent_http_announces'] = Number($('maxConcurrentHTTPAnnounces').getProperty('value'));
|
||||||
settings.set('stop_tracker_timeout', Number($('stopTrackerTimeout').getProperty('value')));
|
settings['stop_tracker_timeout'] = Number($('stopTrackerTimeout').getProperty('value'));
|
||||||
settings.set('peer_turnover', Number($('peerTurnover').getProperty('value')));
|
settings['peer_turnover'] = Number($('peerTurnover').getProperty('value'));
|
||||||
settings.set('peer_turnover_cutoff', Number($('peerTurnoverCutoff').getProperty('value')));
|
settings['peer_turnover_cutoff'] = Number($('peerTurnoverCutoff').getProperty('value'));
|
||||||
settings.set('peer_turnover_interval', Number($('peerTurnoverInterval').getProperty('value')));
|
settings['peer_turnover_interval'] = Number($('peerTurnoverInterval').getProperty('value'));
|
||||||
settings.set('request_queue_size', Number($('requestQueueSize').getProperty('value')));
|
settings['request_queue_size'] = Number($('requestQueueSize').getProperty('value'));
|
||||||
settings.set('dht_bootstrap_nodes', $('dhtBootstrapNodes').getProperty('value'));
|
settings['dht_bootstrap_nodes'] = $('dhtBootstrapNodes').getProperty('value');
|
||||||
settings.set('i2p_inbound_quantity', Number($('i2pInboundQuantity').getProperty('value')));
|
settings['i2p_inbound_quantity'] = Number($('i2pInboundQuantity').getProperty('value'));
|
||||||
settings.set('i2p_outbound_quantity', Number($('i2pOutboundQuantity').getProperty('value')));
|
settings['i2p_outbound_quantity'] = Number($('i2pOutboundQuantity').getProperty('value'));
|
||||||
settings.set('i2p_inbound_length', Number($('i2pInboundLength').getProperty('value')));
|
settings['i2p_inbound_length'] = Number($('i2pInboundLength').getProperty('value'));
|
||||||
settings.set('i2p_outbound_length', Number($('i2pOutboundLength').getProperty('value')));
|
settings['i2p_outbound_length'] = Number($('i2pOutboundLength').getProperty('value'));
|
||||||
|
|
||||||
// Send it to qBT
|
// Send it to qBT
|
||||||
new Request({
|
window.parent.qBittorrent.Cache.preferences.set({
|
||||||
url: 'api/v2/app/setPreferences',
|
data: settings,
|
||||||
method: 'post',
|
|
||||||
data: {
|
|
||||||
'json': JSON.encode(settings),
|
|
||||||
},
|
|
||||||
onFailure: function() {
|
onFailure: function() {
|
||||||
alert("QBT_TR(Unable to save program preferences, qBittorrent is probably unreachable.)QBT_TR[CONTEXT=HttpServer]");
|
alert("QBT_TR(Unable to save program preferences, qBittorrent is probably unreachable.)QBT_TR[CONTEXT=HttpServer]");
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
|
@ -2857,7 +2844,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
window.parent.location.reload();
|
window.parent.location.reload();
|
||||||
window.parent.qBittorrent.Client.closeWindows();
|
window.parent.qBittorrent.Client.closeWindows();
|
||||||
}
|
}
|
||||||
}).send();
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$('networkInterface').addEvent('change', function() {
|
$('networkInterface').addEvent('change', function() {
|
||||||
|
|
|
@ -189,31 +189,22 @@
|
||||||
let rssArticleTable = new window.qBittorrent.DynamicTable.RssArticleTable();
|
let rssArticleTable = new window.qBittorrent.DynamicTable.RssArticleTable();
|
||||||
|
|
||||||
const init = () => {
|
const init = () => {
|
||||||
new Request.JSON({
|
const pref = window.parent.qBittorrent.Cache.preferences.get();
|
||||||
url: 'api/v2/app/preferences',
|
|
||||||
method: 'get',
|
|
||||||
noCache: true,
|
|
||||||
onFailure: () => {
|
|
||||||
alert('Could not contact qBittorrent');
|
|
||||||
},
|
|
||||||
onSuccess: (pref) => {
|
|
||||||
if (!pref.rss_processing_enabled)
|
if (!pref.rss_processing_enabled)
|
||||||
$('rssFetchingDisabled').removeClass('invisible');
|
$('rssFetchingDisabled').removeClass('invisible');
|
||||||
|
|
||||||
// recalculate heights
|
// recalculate heights
|
||||||
let nonPageHeight = $('rssTopBar').getBoundingClientRect().height
|
const nonPageHeight = $('rssTopBar').getBoundingClientRect().height
|
||||||
+ $('desktopHeader').getBoundingClientRect().height
|
+ $('desktopHeader').getBoundingClientRect().height
|
||||||
+ $('desktopFooterWrapper').getBoundingClientRect().height + 20;
|
+ $('desktopFooterWrapper').getBoundingClientRect().height + 20;
|
||||||
$('rssDetailsView').style.height = 'calc(100vh - ' + nonPageHeight + 'px)';
|
$('rssDetailsView').style.height = 'calc(100vh - ' + nonPageHeight + 'px)';
|
||||||
|
|
||||||
let nonTableHeight = nonPageHeight + $('rssFeedFixedHeaderDiv').getBoundingClientRect().height;
|
const nonTableHeight = nonPageHeight + $('rssFeedFixedHeaderDiv').getBoundingClientRect().height;
|
||||||
|
|
||||||
$('rssFeedTableDiv').style.height = 'calc(100vh - ' + nonTableHeight + 'px)';
|
$('rssFeedTableDiv').style.height = 'calc(100vh - ' + nonTableHeight + 'px)';
|
||||||
$('rssArticleTableDiv').style.height = 'calc(100vh - ' + nonTableHeight + 'px)';
|
$('rssArticleTableDiv').style.height = 'calc(100vh - ' + nonTableHeight + 'px)';
|
||||||
|
|
||||||
$('rssContentView').style.height = 'calc(100% - ' + $('rssTopBar').getBoundingClientRect().height + 'px)';
|
$('rssContentView').style.height = 'calc(100% - ' + $('rssTopBar').getBoundingClientRect().height + 'px)';
|
||||||
}
|
|
||||||
}).send();
|
|
||||||
|
|
||||||
const rssFeedContextMenu = new window.qBittorrent.ContextMenu.RssFeedContextMenu({
|
const rssFeedContextMenu = new window.qBittorrent.ContextMenu.RssFeedContextMenu({
|
||||||
targets: '.rssFeedContextMenuTarget',
|
targets: '.rssFeedContextMenuTarget',
|
||||||
|
|
|
@ -358,19 +358,13 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
let feedList = [];
|
let feedList = [];
|
||||||
|
|
||||||
const initRssDownloader = () => {
|
const initRssDownloader = () => {
|
||||||
new Request.JSON({
|
const pref = window.parent.qBittorrent.Cache.preferences.get();
|
||||||
url: 'api/v2/app/preferences',
|
|
||||||
method: 'get',
|
|
||||||
noCache: true,
|
|
||||||
onFailure: () => {
|
|
||||||
alert('Could not contact qBittorrent');
|
|
||||||
},
|
|
||||||
onSuccess: (pref) => {
|
|
||||||
if (!pref.rss_auto_downloading_enabled)
|
if (!pref.rss_auto_downloading_enabled)
|
||||||
$('rssDownloaderDisabled').removeClass('invisible');
|
$('rssDownloaderDisabled').removeClass('invisible');
|
||||||
|
|
||||||
// recalculate height
|
// recalculate height
|
||||||
let warningHeight = $('rssDownloaderDisabled').getBoundingClientRect().height;
|
const warningHeight = $('rssDownloaderDisabled').getBoundingClientRect().height;
|
||||||
|
|
||||||
$('leftRssDownloaderColumn').style.height = 'calc(100% - ' + warningHeight + 'px)';
|
$('leftRssDownloaderColumn').style.height = 'calc(100% - ' + warningHeight + 'px)';
|
||||||
$('centerRssDownloaderColumn').style.height = 'calc(100% - ' + warningHeight + 'px)';
|
$('centerRssDownloaderColumn').style.height = 'calc(100% - ' + warningHeight + 'px)';
|
||||||
|
@ -379,7 +373,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
$('rulesTable').style.height = 'calc(100% - ' + $('rulesTableDesc').getBoundingClientRect().height + 'px)';
|
$('rulesTable').style.height = 'calc(100% - ' + $('rulesTableDesc').getBoundingClientRect().height + 'px)';
|
||||||
$('rssDownloaderArticlesTable').style.height = 'calc(100% - ' + $('articleTableDesc').getBoundingClientRect().height + 'px)';
|
$('rssDownloaderArticlesTable').style.height = 'calc(100% - ' + $('articleTableDesc').getBoundingClientRect().height + 'px)';
|
||||||
|
|
||||||
let centerRowNotTableHeight = $('saveButton').getBoundingClientRect().height
|
const centerRowNotTableHeight = $('saveButton').getBoundingClientRect().height
|
||||||
+ $('ruleSettings').getBoundingClientRect().height + 15;
|
+ $('ruleSettings').getBoundingClientRect().height + 15;
|
||||||
|
|
||||||
$('rssDownloaderFeeds').style.height = 'calc(100% - ' + centerRowNotTableHeight + 'px)';
|
$('rssDownloaderFeeds').style.height = 'calc(100% - ' + centerRowNotTableHeight + 'px)';
|
||||||
|
@ -392,8 +386,6 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
|
||||||
let outsideTableHeight = ($('rssDownloaderFeedsTable').getBoundingClientRect().top - $('rssDownloaderFeeds').getBoundingClientRect().top) - 10;
|
let outsideTableHeight = ($('rssDownloaderFeedsTable').getBoundingClientRect().top - $('rssDownloaderFeeds').getBoundingClientRect().top) - 10;
|
||||||
$('rssDownloaderFeedsTable').style.height = 'calc(100% - ' + outsideTableHeight + 'px)';
|
$('rssDownloaderFeedsTable').style.height = 'calc(100% - ' + outsideTableHeight + 'px)';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}).send();
|
|
||||||
|
|
||||||
const rssDownloaderRuleContextMenu = new window.qBittorrent.ContextMenu.RssDownloaderRuleContextMenu({
|
const rssDownloaderRuleContextMenu = new window.qBittorrent.ContextMenu.RssDownloaderRuleContextMenu({
|
||||||
targets: '',
|
targets: '',
|
||||||
|
|
|
@ -374,6 +374,7 @@
|
||||||
<file>private/rename_file.html</file>
|
<file>private/rename_file.html</file>
|
||||||
<file>private/rename_files.html</file>
|
<file>private/rename_files.html</file>
|
||||||
<file>private/rename_rule.html</file>
|
<file>private/rename_rule.html</file>
|
||||||
|
<file>private/scripts/cache.js</file>
|
||||||
<file>private/scripts/client.js</file>
|
<file>private/scripts/client.js</file>
|
||||||
<file>private/scripts/contextmenu.js</file>
|
<file>private/scripts/contextmenu.js</file>
|
||||||
<file>private/scripts/download.js</file>
|
<file>private/scripts/download.js</file>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue