From 3a44b94cc7fffd6d4da9ab132497be1998d6be0d Mon Sep 17 00:00:00 2001 From: ngosang Date: Thu, 9 Jul 2015 10:42:45 +0200 Subject: [PATCH 1/2] [Web UI] New option Web UI port UPNP. Closes #3358 --- src/webui/prefjson.cpp | 3 ++ src/webui/www/public/preferences_content.html | 29 +++++++++++-------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/webui/prefjson.cpp b/src/webui/prefjson.cpp index 50e940f95..f6be45ae4 100644 --- a/src/webui/prefjson.cpp +++ b/src/webui/prefjson.cpp @@ -150,6 +150,7 @@ QByteArray prefjson::getPreferences() data["locale"] = pref->getLocale(); // HTTP Server data["web_ui_port"] = pref->getWebUiPort(); + data["web_ui_upnp"] = pref->useUPnPForWebUIPort(); data["use_https"] = pref->isWebUiHttpsEnabled(); data["ssl_key"] = QString::fromLatin1(pref->getWebUiHttpsKey()); data["ssl_cert"] = QString::fromLatin1(pref->getWebUiHttpsCertificate()); @@ -361,6 +362,8 @@ void prefjson::setPreferences(const QString& json) // HTTP Server if (m.contains("web_ui_port")) pref->setWebUiPort(m["web_ui_port"].toUInt()); + if (m.contains("web_ui_upnp")) + pref->setUPnPForWebUIPort(m["web_ui_upnp"].toBool()); if (m.contains("use_https")) pref->setWebUiHttpsEnabled(m["use_https"].toBool()); #ifndef QT_NO_OPENSSL diff --git a/src/webui/www/public/preferences_content.html b/src/webui/www/public/preferences_content.html index ed35a1fb9..3e09fc1a8 100644 --- a/src/webui/www/public/preferences_content.html +++ b/src/webui/www/public/preferences_content.html @@ -343,18 +343,21 @@
QBT_TR(HTTP Server)QBT_TR
- - -
-
- - -
-
- - -
-
Information about certificates
+ +
+
+ + +
+ + +
+
+ + +
+
Information about certificates
+
@@ -912,6 +915,7 @@ loadPreferences = function() { // HTTP Server $('webui_port_value').setProperty('value', pref.web_ui_port); + $('webui_upnp_checkbox').setProperty('checked', pref.web_ui_upnp); $('use_https_checkbox').setProperty('checked', pref.use_https); $('ssl_key_textarea').setProperty('value', pref.ssl_key); $('ssl_cert_textarea').setProperty('value', pref.ssl_cert); @@ -1168,6 +1172,7 @@ applyPreferences = function() { return; } settings.set('web_ui_port', web_ui_port); + settings.set('web_ui_upnp', $('webui_upnp_checkbox').getProperty('checked')); settings.set('use_https', $('use_https_checkbox').getProperty('checked')); settings.set('ssl_key', $('ssl_key_textarea').getProperty('value')); settings.set('ssl_cert', $('ssl_cert_textarea').getProperty('value')); From ac74f1440829b4272e3fc07aef47d5c7f89d3d1b Mon Sep 17 00:00:00 2001 From: ngosang Date: Sun, 12 Jul 2015 23:08:43 +0200 Subject: [PATCH 2/2] Increase API_VERSION --- src/webui/webapplication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webui/webapplication.cpp b/src/webui/webapplication.cpp index 23530e5b6..a64e68e56 100644 --- a/src/webui/webapplication.cpp +++ b/src/webui/webapplication.cpp @@ -46,7 +46,7 @@ #include "websessiondata.h" #include "webapplication.h" -static const int API_VERSION = 3; +static const int API_VERSION = 4; static const int API_VERSION_MIN = 2; const QString WWW_FOLDER = ":/www/public/";