Unhardcode server ping/query URLs.

This commit is contained in:
Paul Chote
2017-12-26 14:09:24 +00:00
committed by reaperrr
parent 86a17e9260
commit e7ce9aa263
3 changed files with 5 additions and 4 deletions

View File

@@ -108,11 +108,11 @@ namespace OpenRA.Mods.Common.Server
{ {
try try
{ {
var serverList = server.ModData.Manifest.Get<WebServices>().ServerList; var endpoint = server.ModData.Manifest.Get<WebServices>().ServerAdvertise;
using (var wc = new WebClient()) using (var wc = new WebClient())
{ {
wc.Proxy = null; wc.Proxy = null;
var masterResponseText = wc.UploadString(serverList + "ping", postData); var masterResponseText = wc.UploadString(endpoint, postData);
if (isInitialPing) if (isInitialPing)
{ {

View File

@@ -15,7 +15,8 @@ namespace OpenRA
{ {
public class WebServices : IGlobalModData public class WebServices : IGlobalModData
{ {
public readonly string ServerList = "http://master.openra.net/"; public readonly string ServerList = "http://master.openra.net/games";
public readonly string ServerAdvertise = "http://master.openra.net/ping";
public readonly string MapRepository = "http://resource.openra.net/map/"; public readonly string MapRepository = "http://resource.openra.net/map/";
public readonly string GameNews = "http://master.openra.net/gamenews"; public readonly string GameNews = "http://master.openra.net/gamenews";
} }

View File

@@ -348,7 +348,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
Game.RunAfterTick(() => RefreshServerListInner(games)); Game.RunAfterTick(() => RefreshServerListInner(games));
}; };
var queryURL = services.ServerList + "games?protocol={0}&engine={1}&mod={2}&version={3}".F( var queryURL = services.ServerList + "?protocol={0}&engine={1}&mod={2}&version={3}".F(
GameServer.ProtocolVersion, GameServer.ProtocolVersion,
Uri.EscapeUriString(Game.EngineVersion), Uri.EscapeUriString(Game.EngineVersion),
Uri.EscapeUriString(Game.ModData.Manifest.Id), Uri.EscapeUriString(Game.ModData.Manifest.Id),