From e7af295b5e67f8250e20b2fb13086f63cb69a498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sat, 11 Jul 2020 20:18:06 +0200 Subject: [PATCH] Allow news per mod. --- OpenRA.Mods.Common/WebServices.cs | 1 + OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/WebServices.cs b/OpenRA.Mods.Common/WebServices.cs index ef93ad3d62..cbbf3bcea9 100644 --- a/OpenRA.Mods.Common/WebServices.cs +++ b/OpenRA.Mods.Common/WebServices.cs @@ -23,6 +23,7 @@ namespace OpenRA.Mods.Common public readonly string ServerAdvertise = "https://master.openra.net/ping"; public readonly string MapRepository = "https://resource.openra.net/map/"; public readonly string GameNews = "https://master.openra.net/gamenews"; + public readonly string GameNewsFileName = "news.yaml"; public readonly string VersionCheck = "https://master.openra.net/versioncheck"; public ModVersionStatus ModVersionStatus { get; private set; } diff --git a/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs index d84a9be625..a653f71efc 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs @@ -230,7 +230,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { Action onSysInfoComplete = () => { - LoadAndDisplayNews(webServices.GameNews, newsBG); + LoadAndDisplayNews(webServices, newsBG); SwitchMenu(MenuType.Main); }; @@ -260,11 +260,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic DiscordService.UpdateStatus(DiscordState.InMenu); } - void LoadAndDisplayNews(string newsURL, Widget newsBG) + void LoadAndDisplayNews(WebServices webServices, Widget newsBG) { if (newsBG != null && Game.Settings.Game.FetchNews) { - var cacheFile = Platform.ResolvePath(Platform.SupportDirPrefix, "news.yaml"); + var cacheFile = Platform.ResolvePath(Platform.SupportDirPrefix, webServices.GameNewsFileName); var currentNews = ParseNews(cacheFile); if (currentNews != null) DisplayNews(currentNews); @@ -275,7 +275,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (!fetchedNews) { // Send the mod and engine version to support version-filtered news (update prompts) - newsURL += "?version={0}&mod={1}&modversion={2}".F( + var newsURL = "{0}?version={1}&mod={2}&modversion={3}".F( + webServices.GameNews, Uri.EscapeUriString(Game.EngineVersion), Uri.EscapeUriString(Game.ModData.Manifest.Id), Uri.EscapeUriString(Game.ModData.Manifest.Metadata.Version));