Add WebUi\Address config option

This commit is contained in:
Matthew Fioravante
2017-10-12 02:28:31 +00:00
parent bd07cb91bb
commit 8cd243b06b
8 changed files with 63 additions and 40 deletions

View File

@@ -340,6 +340,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
// Web UI tab
connect(m_ui->textServerDomains, &QLineEdit::textChanged, this, &ThisType::enableApplyButton);
connect(m_ui->checkWebUi, &QGroupBox::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->textWebUiAddress, &QLineEdit::textChanged, this, &ThisType::enableApplyButton);
connect(m_ui->spinWebUiPort, qSpinBoxValueChanged, this, &ThisType::enableApplyButton);
connect(m_ui->checkWebUIUPnP, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->checkWebUiHttps, &QGroupBox::toggled, this, &ThisType::enableApplyButton);
@@ -648,7 +649,8 @@ void OptionsDialog::saveOptions()
pref->setWebUiEnabled(isWebUiEnabled());
if (isWebUiEnabled()) {
pref->setServerDomains(m_ui->textServerDomains->text());
pref->setWebUiPort(webUiPort());
pref->setWebUiAddress(m_ui->textWebUiAddress->text());
pref->setWebUiPort(m_ui->spinWebUiPort->value());
pref->setUPnPForWebUIPort(m_ui->checkWebUIUPnP->isChecked());
pref->setWebUiHttpsEnabled(m_ui->checkWebUiHttps->isChecked());
if (m_ui->checkWebUiHttps->isChecked()) {
@@ -1038,6 +1040,7 @@ void OptionsDialog::loadOptions()
// Web UI preferences
m_ui->textServerDomains->setText(pref->getServerDomains());
m_ui->checkWebUi->setChecked(pref->isWebUiEnabled());
m_ui->textWebUiAddress->setText(pref->getWebUiAddress());
m_ui->spinWebUiPort->setValue(pref->getWebUiPort());
m_ui->checkWebUIUPnP->setChecked(pref->useUPnPForWebUIPort());
m_ui->checkWebUiHttps->setChecked(pref->isWebUiHttpsEnabled());
@@ -1505,11 +1508,6 @@ bool OptionsDialog::isWebUiEnabled() const
return m_ui->checkWebUi->isChecked();
}
quint16 OptionsDialog::webUiPort() const
{
return m_ui->spinWebUiPort->value();
}
QString OptionsDialog::webUiUsername() const
{
return m_ui->textWebUiUsername->text();

View File

@@ -168,7 +168,6 @@ private:
int getMaxActiveUploads() const;
int getMaxActiveTorrents() const;
bool isWebUiEnabled() const;
quint16 webUiPort() const;
QString webUiUsername() const;
QString webUiPassword() const;

View File

@@ -2757,30 +2757,24 @@
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<widget class="QLabel" name="labelServerDomains">
<property name="text">
<string>Server domains:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="textServerDomains">
<property name="toolTip">
<string>Whitelist for filtering HTTP Host header values.
In order to defend against DNS rebinding attack,
you should put in domain names used by WebUI server.
Use ';' to split multiple entries. Can use wildcard '*'.</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="lblWebUiAddress">
<property name="text">
<string>IP address:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="textWebUiAddress">
<property name="toolTip">
<string>IP address that the Web UI will bind to.
Specify an IPv4 or IPv6 address. You can specify "0.0.0.0" for any IPv4 address,
"::" for any IPv6 address, or "*" for both IPv4 and IPv6.</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblWebUiPort">
<property name="text">
@@ -2801,18 +2795,27 @@ Use ';' to split multiple entries. Can use wildcard '*'.</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<widget class="QLabel" name="labelServerDomains">
<property name="text">
<string>Server domains:</string>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>21</width>
<height>29</height>
</size>
</widget>
</item>
<item>
<widget class="QLineEdit" name="textServerDomains">
<property name="toolTip">
<string>Whitelist for filtering HTTP Host header values.
In order to defend against DNS rebinding attack,
you should put in domain names used by WebUI server.
Use ';' to split multiple entries. Can use wildcard '*'.</string>
</property>
</spacer>
</widget>
</item>
</layout>
</item>