diff --git a/src/gui/optionsdialog.cpp b/src/gui/optionsdialog.cpp index 63b185ed3379..9d2138444234 100644 --- a/src/gui/optionsdialog.cpp +++ b/src/gui/optionsdialog.cpp @@ -1310,6 +1310,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(pref->getDynDNSService())); @@ -1351,6 +1352,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); @@ -1397,6 +1399,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(m_ui->comboDNSService->currentIndex())); diff --git a/src/gui/optionsdialog.ui b/src/gui/optionsdialog.ui index b122b429f156..61c9799d9d6a 100644 --- a/src/gui/optionsdialog.ui +++ b/src/gui/optionsdialog.ui @@ -3807,6 +3807,24 @@ Use ';' to split multiple entries. Can use wildcard '*'. + + + + + + URL base path: + + + + + + + Specify the URL path qBittorent will be made accessible at (e.g. '/qbittorrent/'). + + + + + diff --git a/src/webui/api/appcontroller.cpp b/src/webui/api/appcontroller.cpp index 14517be7d030..84fa27640ca3 100644 --- a/src/webui/api/appcontroller.cpp +++ b/src/webui/api/appcontroller.cpp @@ -341,6 +341,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(pref->getDynDNSService()); @@ -921,6 +922,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()); diff --git a/src/webui/www/private/views/preferences.html b/src/webui/www/private/views/preferences.html index e9bb537e98da..4521a38730d6 100644 --- a/src/webui/www/private/views/preferences.html +++ b/src/webui/www/private/views/preferences.html @@ -1053,6 +1053,10 @@ +
+ + +
@@ -2039,6 +2043,7 @@ const updateWebUIReverseProxySettings = () => { const isEnabled = $("webUIReverseProxySupportCheckbox").checked; $("webUIReverseProxiesListTextarea").disabled = !isEnabled; + $("webUIBasePathTextarea").disabled = !isEnabled; }; const updateDynDnsSettings = () => { @@ -2483,6 +2488,7 @@ // 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 @@ -2949,6 +2955,7 @@ // 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;