|
|
@ -64,13 +64,13 @@ void WebUI::init() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// http server
|
|
|
|
// http server
|
|
|
|
if (!httpServer_) { |
|
|
|
if (!m_httpServer) { |
|
|
|
webapp_ = new WebApplication(this); |
|
|
|
m_webapp = new WebApplication(this); |
|
|
|
httpServer_ = new Http::Server(webapp_, this); |
|
|
|
m_httpServer = new Http::Server(m_webapp, this); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
if (httpServer_->serverPort() != m_port) |
|
|
|
if (m_httpServer->serverPort() != m_port) |
|
|
|
httpServer_->close(); |
|
|
|
m_httpServer->close(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#ifndef QT_NO_OPENSSL |
|
|
|
#ifndef QT_NO_OPENSSL |
|
|
@ -84,17 +84,17 @@ void WebUI::init() |
|
|
|
const bool areCertsValid = !certs.empty() && std::all_of(certs.begin(), certs.end(), [](QSslCertificate c) { return !c.isNull(); }); |
|
|
|
const bool areCertsValid = !certs.empty() && std::all_of(certs.begin(), certs.end(), [](QSslCertificate c) { return !c.isNull(); }); |
|
|
|
|
|
|
|
|
|
|
|
if (!key.isNull() && areCertsValid) |
|
|
|
if (!key.isNull() && areCertsValid) |
|
|
|
httpServer_->enableHttps(certs, key); |
|
|
|
m_httpServer->enableHttps(certs, key); |
|
|
|
else |
|
|
|
else |
|
|
|
httpServer_->disableHttps(); |
|
|
|
m_httpServer->disableHttps(); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
httpServer_->disableHttps(); |
|
|
|
m_httpServer->disableHttps(); |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
if (!httpServer_->isListening()) { |
|
|
|
if (!m_httpServer->isListening()) { |
|
|
|
bool success = httpServer_->listen(QHostAddress::Any, m_port); |
|
|
|
bool success = m_httpServer->listen(QHostAddress::Any, m_port); |
|
|
|
if (success) |
|
|
|
if (success) |
|
|
|
logger->addMessage(tr("Web UI: Now listening on port %1").arg(m_port)); |
|
|
|
logger->addMessage(tr("Web UI: Now listening on port %1").arg(m_port)); |
|
|
|
else |
|
|
|
else |
|
|
@ -103,26 +103,26 @@ void WebUI::init() |
|
|
|
|
|
|
|
|
|
|
|
// DynDNS
|
|
|
|
// DynDNS
|
|
|
|
if (pref->isDynDNSEnabled()) { |
|
|
|
if (pref->isDynDNSEnabled()) { |
|
|
|
if (!dynDNSUpdater_) |
|
|
|
if (!m_dnsUpdater) |
|
|
|
dynDNSUpdater_ = new Net::DNSUpdater(this); |
|
|
|
m_dnsUpdater = new Net::DNSUpdater(this); |
|
|
|
else |
|
|
|
else |
|
|
|
dynDNSUpdater_->updateCredentials(); |
|
|
|
m_dnsUpdater->updateCredentials(); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
if (dynDNSUpdater_) |
|
|
|
if (m_dnsUpdater) |
|
|
|
delete dynDNSUpdater_; |
|
|
|
delete m_dnsUpdater; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
Net::PortForwarder::instance()->deletePort(oldPort); |
|
|
|
Net::PortForwarder::instance()->deletePort(oldPort); |
|
|
|
|
|
|
|
|
|
|
|
if (httpServer_) |
|
|
|
if (m_httpServer) |
|
|
|
delete httpServer_; |
|
|
|
delete m_httpServer; |
|
|
|
|
|
|
|
|
|
|
|
if (webapp_) |
|
|
|
if (m_webapp) |
|
|
|
delete webapp_; |
|
|
|
delete m_webapp; |
|
|
|
|
|
|
|
|
|
|
|
if (dynDNSUpdater_) |
|
|
|
if (m_dnsUpdater) |
|
|
|
delete dynDNSUpdater_; |
|
|
|
delete m_dnsUpdater; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|