Enable websocket port overwrite in advertiser
*Advertises port 80 if the AO Server is behind a reverse proxy, like cloudflare tunnels.
This commit is contained in:
parent
bbd55263df
commit
d39f93926f
@ -73,6 +73,9 @@ ms_ip=https://servers.aceattorneyonline.com/servers
|
||||
; Optional hostname of your server. Can either be an IP or a DNS name. Disables automatic IP detection of ms3.
|
||||
hostname=
|
||||
|
||||
; Wether or not the server overwrites the advertised webao port to port 80 in order to utilise Cloudflare tunnels.
|
||||
cloudflare_enabled=false
|
||||
|
||||
[Dice]
|
||||
; The maximum number of sides dice can be rolled with.
|
||||
max_value=100
|
||||
|
@ -449,6 +449,12 @@ class ConfigManager
|
||||
*/
|
||||
static QString advertiserHostname();
|
||||
|
||||
/**
|
||||
* @brief Returns a dummy port instead of the real port
|
||||
* @return
|
||||
*/
|
||||
static bool advertiserCloudflareMode();
|
||||
|
||||
/**
|
||||
* @brief Returns the uptime of the server in miliseconds.
|
||||
*/
|
||||
|
@ -29,7 +29,14 @@ Advertiser::Advertiser()
|
||||
m_hostname = ConfigManager::advertiserHostname();
|
||||
m_description = ConfigManager::serverDescription();
|
||||
m_port = ConfigManager::serverPort();
|
||||
|
||||
// Cheap workaround to correctly advertise when Cloudflare tunnel is used.
|
||||
if (ConfigManager::advertiserCloudflareMode()) {
|
||||
m_ws_port = 80;
|
||||
}
|
||||
else {
|
||||
m_ws_port = ConfigManager::webaoPort();
|
||||
}
|
||||
m_masterserver = ConfigManager::advertiserIP();
|
||||
m_debug = ConfigManager::advertiserDebug();
|
||||
}
|
||||
|
@ -610,6 +610,11 @@ QString ConfigManager::advertiserHostname()
|
||||
return m_settings->value("Advertiser/hostname", "").toString();
|
||||
}
|
||||
|
||||
bool ConfigManager::advertiserCloudflareMode()
|
||||
{
|
||||
return m_settings->value("Advertiser/cloudflare_enabled", "false").toBool();
|
||||
}
|
||||
|
||||
qint64 ConfigManager::uptime()
|
||||
{
|
||||
return m_uptimeTimer->elapsed();
|
||||
|
Loading…
Reference in New Issue
Block a user