mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-22 22:33:34 -07:00
Expose ability to configure WebUI URL base path
This commit is contained in:
parent
07b514b05a
commit
32498a7784
4 changed files with 51 additions and 0 deletions
|
@ -1313,6 +1313,7 @@ void OptionsDialog::loadWebUITabOptions()
|
|||
// Reverse proxy
|
||||
m_ui->groupEnableReverseProxySupport->setChecked(pref->isWebUIReverseProxySupportEnabled());
|
||||
m_ui->textTrustedReverseProxiesList->setText(pref->getWebUITrustedReverseProxiesList());
|
||||
m_ui->textWebUIBasePath->setText(pref->getWebUIBasePath());
|
||||
// DynDNS
|
||||
m_ui->checkDynDNS->setChecked(pref->isDynDNSEnabled());
|
||||
m_ui->comboDNSService->setCurrentIndex(static_cast<int>(pref->getDynDNSService()));
|
||||
|
@ -1354,6 +1355,7 @@ void OptionsDialog::loadWebUITabOptions()
|
|||
|
||||
connect(m_ui->groupEnableReverseProxySupport, &QGroupBox::toggled, this, &ThisType::enableApplyButton);
|
||||
connect(m_ui->textTrustedReverseProxiesList, &QLineEdit::textChanged, this, &ThisType::enableApplyButton);
|
||||
connect(m_ui->textWebUIBasePath, &QLineEdit::textChanged, this, &ThisType::enableApplyButton);
|
||||
|
||||
connect(m_ui->checkDynDNS, &QGroupBox::toggled, this, &ThisType::enableApplyButton);
|
||||
connect(m_ui->comboDNSService, qComboBoxCurrentIndexChanged, this, &ThisType::enableApplyButton);
|
||||
|
@ -1400,6 +1402,17 @@ void OptionsDialog::saveWebUITabOptions() const
|
|||
// Reverse proxy
|
||||
pref->setWebUIReverseProxySupportEnabled(m_ui->groupEnableReverseProxySupport->isChecked());
|
||||
pref->setWebUITrustedReverseProxiesList(m_ui->textTrustedReverseProxiesList->text());
|
||||
|
||||
QString path = m_ui->textWebUIBasePath->text();
|
||||
if (!path.startsWith(u"/"_s))
|
||||
path.prepend(u"/");
|
||||
if (!path.endsWith(u"/"_s))
|
||||
path.append(u"/");
|
||||
QUrl url;
|
||||
url.setPath(path, QUrl::StrictMode);
|
||||
if (url.isValid())
|
||||
pref->setWebUIBasePath(url.path());
|
||||
|
||||
// DynDNS
|
||||
pref->setDynDNSEnabled(m_ui->checkDynDNS->isChecked());
|
||||
pref->setDynDNSService(static_cast<DNS::Service>(m_ui->comboDNSService->currentIndex()));
|
||||
|
|
|
@ -3814,6 +3814,24 @@ Use ';' to split multiple entries. Can use wildcard '*'.</string>
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_132">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblWebUIBasePath">
|
||||
<property name="text">
|
||||
<string>URL base path:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="textWebUIBasePath">
|
||||
<property name="toolTip">
|
||||
<string>Specify the URL path qBittorent will be made accessible at (e.g. '/qbittorrent/').</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelReverseProxyLink">
|
||||
<property name="text">
|
||||
|
|
|
@ -342,6 +342,7 @@ void AppController::preferencesAction()
|
|||
// Reverse proxy
|
||||
data[u"web_ui_reverse_proxy_enabled"_s] = pref->isWebUIReverseProxySupportEnabled();
|
||||
data[u"web_ui_reverse_proxies_list"_s] = pref->getWebUITrustedReverseProxiesList();
|
||||
data[u"web_ui_base_path"_s] = pref->getWebUIBasePath();
|
||||
// Update my dynamic domain name
|
||||
data[u"dyndns_enabled"_s] = pref->isDynDNSEnabled();
|
||||
data[u"dyndns_service"_s] = static_cast<int>(pref->getDynDNSService());
|
||||
|
@ -924,6 +925,18 @@ void AppController::setPreferencesAction()
|
|||
pref->setWebUIReverseProxySupportEnabled(it.value().toBool());
|
||||
if (hasKey(u"web_ui_reverse_proxies_list"_s))
|
||||
pref->setWebUITrustedReverseProxiesList(it.value().toString());
|
||||
if (hasKey(u"web_ui_base_path"_s))
|
||||
{
|
||||
QString path = it.value().toString();
|
||||
if (!path.startsWith(u"/"_s))
|
||||
path.prepend(u"/");
|
||||
if (!path.endsWith(u"/"_s))
|
||||
path.append(u"/");
|
||||
QUrl url;
|
||||
url.setPath(path, QUrl::StrictMode);
|
||||
if (url.isValid())
|
||||
pref->setWebUIBasePath(url.path());
|
||||
}
|
||||
// Update my dynamic domain name
|
||||
if (hasKey(u"dyndns_enabled"_s))
|
||||
pref->setDynDNSEnabled(it.value().toBool());
|
||||
|
|
|
@ -1058,6 +1058,10 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
<label for="webUIReverseProxiesListTextarea">QBT_TR(Trusted proxies list:)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||
<input type="text" id="webUIReverseProxiesListTextarea" title="QBT_TR(Specify reverse proxy IPs (or subnets, e.g. 0.0.0.0/24) in order to use forwarded client address (X-Forwarded-For header). Use ';' to split multiple entries.)QBT_TR[CONTEXT=OptionsDialog]">
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<label for="webUIBasePathTextarea">QBT_TR(URL base path:)QBT_TR[CONTEXT=OptionsDialog]</label>
|
||||
<input type="text" id="webUIBasePathTextarea" title="QBT_TR(Specify the URL path qBittorent will be made accessible at (e.g. '/qbittorrent/').)QBT_TR[CONTEXT=OptionsDialog]">
|
||||
</div>
|
||||
<div class="formRow">
|
||||
<a href="https://github.com/qbittorrent/qBittorrent/wiki#reverse-proxy-setup-for-webui-access" target="_blank">QBT_TR(Reverse proxy setup examples)QBT_TR[CONTEXT=HttpServer]</a>
|
||||
</div>
|
||||
|
@ -2045,6 +2049,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
const updateWebUIReverseProxySettings = () => {
|
||||
const isEnabled = $("webUIReverseProxySupportCheckbox").checked;
|
||||
$("webUIReverseProxiesListTextarea").disabled = !isEnabled;
|
||||
$("webUIBasePathTextarea").disabled = !isEnabled;
|
||||
};
|
||||
|
||||
const updateDynDnsSettings = () => {
|
||||
|
@ -2490,6 +2495,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
// Reverse Proxy
|
||||
$("webUIReverseProxySupportCheckbox").checked = pref.web_ui_reverse_proxy_enabled;
|
||||
$("webUIReverseProxiesListTextarea").value = pref.web_ui_reverse_proxies_list;
|
||||
$("webUIBasePathTextarea").value = pref.web_ui_base_path;
|
||||
updateWebUIReverseProxySettings();
|
||||
|
||||
// Update my dynamic domain name
|
||||
|
@ -2957,6 +2963,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
|||
// Reverse Proxy
|
||||
settings["web_ui_reverse_proxy_enabled"] = $("webUIReverseProxySupportCheckbox").checked;
|
||||
settings["web_ui_reverse_proxies_list"] = $("webUIReverseProxiesListTextarea").value;
|
||||
settings["web_ui_base_path"] = $("webUIBasePathTextarea").value;
|
||||
|
||||
// Update my dynamic domain name
|
||||
settings["dyndns_enabled"] = $("use_dyndns_checkbox").checked;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue