diff --git a/bin/config_sample/config.ini b/bin/config_sample/config.ini index 4d3472f..20e3b2c 100644 --- a/bin/config_sample/config.ini +++ b/bin/config_sample/config.ini @@ -5,6 +5,9 @@ max_players=100 ; The port to listen for incoming connections on. port=27016 +; The port to advertise for SSL. +secure_port=-1 + ; The server description that will appear on the master server. server_description=This is a placeholder server description. Tell the world of AO who you are here! diff --git a/src/config_manager.cpp b/src/config_manager.cpp index a9bbc76..369cc30 100644 --- a/src/config_manager.cpp +++ b/src/config_manager.cpp @@ -71,17 +71,12 @@ bool ConfigManager::verifyServerConfig() qCritical("port is not a valid port!"); return false; } - bool web_ao = m_settings->value("webao_enable", false).toBool(); - if (!web_ao) { - m_settings->setValue("webao_port", -1); - } - else { - m_settings->value("webao_port", 27017).toInt(&ok); - if (!ok) { - qCritical("webao_port is not a valid port!"); - return false; - } + m_settings->value("secure_port", -1).toInt(&ok); + if (!ok) { + qCritical("secure_port is not a valid port!"); + return false; } + QString l_auth = m_settings->value("auth", "simple").toString().toLower(); if (!(l_auth == "simple" || l_auth == "advanced")) { qCritical("auth is not a valid auth type!"); @@ -327,6 +322,11 @@ int ConfigManager::serverPort() return m_settings->value("Options/port", 27016).toInt(); } +int ConfigManager::securePort() +{ + return m_settings->value("Options/secure_port", -1).toInt(); +} + QString ConfigManager::serverDescription() { return m_settings->value("Options/server_description", "This is my flashy new server!").toString(); diff --git a/src/config_manager.h b/src/config_manager.h index a971552..54584ab 100644 --- a/src/config_manager.h +++ b/src/config_manager.h @@ -143,6 +143,13 @@ class ConfigManager */ static int serverPort(); + /** + * @brief Returns the SSL port to listen for connections on. + * + * @return See short description. + */ + static int securePort(); + /** * @brief Returns the server description. * diff --git a/src/serverpublisher.cpp b/src/serverpublisher.cpp index 4367248..42012e8 100644 --- a/src/serverpublisher.cpp +++ b/src/serverpublisher.cpp @@ -58,6 +58,9 @@ void ServerPublisher::publishServer() if (!ConfigManager::serverDomainName().trimmed().isEmpty()) { serverinfo["ip"] = ConfigManager::serverDomainName(); } + if (ConfigManager::securePort() != -1) { + serverinfo["wss_port"] = ConfigManager::securePort(); + } serverinfo["port"] = 27106; serverinfo["ws_port"] = ConfigManager::advertiseWSProxy() ? WS_REVERSE_PROXY : m_port; serverinfo["players"] = *m_players;