mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-12 18:24:58 +08:00
Add "Use alternative Web UI" option
This commit is contained in:
parent
c237accf82
commit
2ebc6a056e
@ -217,6 +217,9 @@ void AppController::preferencesAction()
|
||||
for (const Utils::Net::Subnet &subnet : asConst(pref->getWebUiAuthSubnetWhitelist()))
|
||||
authSubnetWhitelistStringList << Utils::Net::subnetToString(subnet);
|
||||
data["bypass_auth_subnet_whitelist"] = authSubnetWhitelistStringList.join("\n");
|
||||
// Use alternative Web UI
|
||||
data["alternative_webui_enabled"] = pref->isAltWebUiEnabled();
|
||||
data["alternative_webui_path"] = pref->getWebUiRootFolder();
|
||||
// Security
|
||||
data["web_ui_clickjacking_protection_enabled"] = pref->isWebUiClickjackingProtectionEnabled();
|
||||
data["web_ui_csrf_protection_enabled"] = pref->isWebUiCSRFProtectionEnabled();
|
||||
@ -518,6 +521,11 @@ void AppController::setPreferencesAction()
|
||||
// recognize new lines and commas as delimiters
|
||||
pref->setWebUiAuthSubnetWhitelist(m["bypass_auth_subnet_whitelist"].toString().split(QRegularExpression("\n|,"), QString::SkipEmptyParts));
|
||||
}
|
||||
// Use alternative Web UI
|
||||
if ((it = m.find(QLatin1String("alternative_webui_enabled"))) != m.constEnd())
|
||||
pref->setAltWebUiEnabled(it.value().toBool());
|
||||
if ((it = m.find(QLatin1String("alternative_webui_path"))) != m.constEnd())
|
||||
pref->setWebUiRootFolder(it.value().toString());
|
||||
// Security
|
||||
if (m.contains("web_ui_clickjacking_protection_enabled"))
|
||||
pref->setWebUiClickjackingProtectionEnabled(m["web_ui_clickjacking_protection_enabled"].toBool());
|
||||
|
@ -705,6 +705,15 @@
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="settings">
|
||||
<legend><input type="checkbox" id="use_alt_webui_checkbox" onclick="updateAlternativeWebUISettings();" />
|
||||
<label for="use_alt_webui_checkbox">QBT_TR(Use alternative Web UI)QBT_TR[CONTEXT=OptionsDialog]</label></legend>
|
||||
<div class="formRow">
|
||||
<label for="webui_files_location_textarea">QBT_TR(Files location:)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||
<input type="text" id="webui_files_location_textarea" />
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="settings">
|
||||
<legend>QBT_TR(Security)QBT_TR[CONTEXT=OptionsDialog]</legend>
|
||||
<div class="formRow">
|
||||
@ -1005,6 +1014,11 @@
|
||||
$('bypass_auth_subnet_whitelist_textarea').setProperty('disabled', !isBypassAuthSubnetWhitelistEnabled);
|
||||
};
|
||||
|
||||
updateAlternativeWebUISettings = function() {
|
||||
var isUseAlternativeWebUIEnabled = $('use_alt_webui_checkbox').getProperty('checked');
|
||||
$('webui_files_location_textarea').setProperty('disabled', !isUseAlternativeWebUIEnabled);
|
||||
};
|
||||
|
||||
updateHostHeaderValidationSettings = function() {
|
||||
var isHostHeaderValidationEnabled = $('host_header_validation_checkbox').getProperty('checked');
|
||||
$('webui_domain_textarea').setProperty('disabled', !isHostHeaderValidationEnabled);
|
||||
@ -1286,6 +1300,11 @@
|
||||
$('bypass_auth_subnet_whitelist_textarea').setProperty('value', pref.bypass_auth_subnet_whitelist);
|
||||
updateBypasssAuthSettings();
|
||||
|
||||
// Use alternative Web UI
|
||||
$('use_alt_webui_checkbox').setProperty('checked', pref.alternative_webui_enabled);
|
||||
$('webui_files_location_textarea').setProperty('value', pref.alternative_webui_path);
|
||||
updateAlternativeWebUISettings();
|
||||
|
||||
// Security
|
||||
$('clickjacking_protection_checkbox').setProperty('checked', pref.web_ui_clickjacking_protection_enabled);
|
||||
$('csrf_protection_checkbox').setProperty('checked', pref.web_ui_csrf_protection_enabled);
|
||||
@ -1590,6 +1609,10 @@
|
||||
settings.set('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'));
|
||||
|
||||
// Use alternative Web UI
|
||||
settings.set('alternative_webui_enabled', $('use_alt_webui_checkbox').getProperty('checked'));
|
||||
settings.set('alternative_webui_path', $('webui_files_location_textarea').getProperty('value'));
|
||||
|
||||
settings.set('web_ui_clickjacking_protection_enabled', $('clickjacking_protection_checkbox').getProperty('checked'));
|
||||
settings.set('web_ui_csrf_protection_enabled', $('csrf_protection_checkbox').getProperty('checked'));
|
||||
settings.set('web_ui_host_header_validation_enabled', $('host_header_validation_checkbox').getProperty('checked'));
|
||||
|
Loading…
Reference in New Issue
Block a user