diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/LoginController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/LoginController.cs index 270aa145..7b7ba8f4 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/LoginController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/LoginController.cs @@ -130,7 +130,7 @@ public class LoginController : ControllerBase new LoginResult { AuthTicket = "MM_AUTH=" + token.UserToken, - LbpEnvVer = ServerStatics.ServerName, + ServerBrand = VersionHelper.FullVersion, }.Serialize() ); } diff --git a/ProjectLighthouse.Servers.Website/Pages/LandingPage.cshtml b/ProjectLighthouse.Servers.Website/Pages/LandingPage.cshtml index 5c6e49c3..df663f1a 100644 --- a/ProjectLighthouse.Servers.Website/Pages/LandingPage.cshtml +++ b/ProjectLighthouse.Servers.Website/Pages/LandingPage.cshtml @@ -8,7 +8,7 @@ Layout = "Layouts/BaseLayout"; Model.ShowTitleInPage = false; } -

Welcome to Project Lighthouse!

+

Welcome to @ServerConfiguration.Instance.Customization.ServerName!

@if (Model.User != null) { diff --git a/ProjectLighthouse.Tests.GameApiTests/Tests/AuthenticationTests.cs b/ProjectLighthouse.Tests.GameApiTests/Tests/AuthenticationTests.cs index 1fe89c3e..acfbfb6b 100644 --- a/ProjectLighthouse.Tests.GameApiTests/Tests/AuthenticationTests.cs +++ b/ProjectLighthouse.Tests.GameApiTests/Tests/AuthenticationTests.cs @@ -2,6 +2,7 @@ using System.Net; using System.Net.Http; using System.Threading.Tasks; using LBPUnion.ProjectLighthouse.Configuration; +using LBPUnion.ProjectLighthouse.Helpers; using LBPUnion.ProjectLighthouse.PlayerData; using LBPUnion.ProjectLighthouse.Tests; using Xunit; @@ -25,7 +26,7 @@ public class AuthenticationTests : LighthouseServerTest Assert.True(response.IsSuccessStatusCode); string responseContent = await response.Content.ReadAsStringAsync(); Assert.Contains("MM_AUTH=", responseContent); - Assert.Contains(ServerStatics.ServerName, responseContent); + Assert.Contains(VersionHelper.FullVersion, responseContent); } [DatabaseFact] @@ -35,10 +36,10 @@ public class AuthenticationTests : LighthouseServerTest Assert.NotNull(loginResult); Assert.NotNull(loginResult.AuthTicket); - Assert.NotNull(loginResult.LbpEnvVer); + Assert.NotNull(loginResult.ServerBrand); Assert.Contains("MM_AUTH=", loginResult.AuthTicket); - Assert.Equal(ServerStatics.ServerName, loginResult.LbpEnvVer); + Assert.Equal(VersionHelper.FullVersion, loginResult.ServerBrand); } [DatabaseFact] diff --git a/ProjectLighthouse/Configuration/ConfigurationCategories/CustomizationConfiguration.cs b/ProjectLighthouse/Configuration/ConfigurationCategories/CustomizationConfiguration.cs new file mode 100644 index 00000000..027c1753 --- /dev/null +++ b/ProjectLighthouse/Configuration/ConfigurationCategories/CustomizationConfiguration.cs @@ -0,0 +1,6 @@ +namespace LBPUnion.ProjectLighthouse.Configuration.ConfigurationCategories; + +public class CustomizationConfiguration +{ + public string ServerName { get; set; } = "Project Lighthouse"; +} \ No newline at end of file diff --git a/ProjectLighthouse/Configuration/ServerConfiguration.cs b/ProjectLighthouse/Configuration/ServerConfiguration.cs index ddf8113b..53cb1c3a 100644 --- a/ProjectLighthouse/Configuration/ServerConfiguration.cs +++ b/ProjectLighthouse/Configuration/ServerConfiguration.cs @@ -163,6 +163,9 @@ public class ServerConfiguration #endregion + // TODO: Find a way to properly remove config options + // YamlDotNet hates that and it's fucking annoying. + // This seriously sucks. /rant [Obsolete("Obsolete. Use the Website/GameApi/Api listen URLS instead.")] public string ListenUrl { get; set; } = "http://localhost:10060"; @@ -193,5 +196,5 @@ public class ServerConfiguration public MailConfiguration Mail { get; set; } = new(); public UserGeneratedContentLimitConfiguration UserGeneratedContentLimits { get; set; } = new(); public WebsiteConfiguration WebsiteConfiguration { get; set; } = new(); - + public CustomizationConfiguration Customization { get; set; } = new(); } \ No newline at end of file diff --git a/ProjectLighthouse/Configuration/ServerStatics.cs b/ProjectLighthouse/Configuration/ServerStatics.cs index 787967b9..f432b5ce 100644 --- a/ProjectLighthouse/Configuration/ServerStatics.cs +++ b/ProjectLighthouse/Configuration/ServerStatics.cs @@ -8,8 +8,6 @@ namespace LBPUnion.ProjectLighthouse.Configuration; public static class ServerStatics { - public const string ServerName = "ProjectLighthouse"; - public const int PageSize = 20; public static bool DbConnected { diff --git a/ProjectLighthouse/Helpers/VersionHelper.cs b/ProjectLighthouse/Helpers/VersionHelper.cs index 3642c5fe..1c926104 100644 --- a/ProjectLighthouse/Helpers/VersionHelper.cs +++ b/ProjectLighthouse/Helpers/VersionHelper.cs @@ -31,8 +31,8 @@ public static class VersionHelper { Logger.Error ( - "Project Lighthouse was built incorrectly. Please make sure git is available when building. " + - "Because of this, you will not be notified of updates.", + "Project Lighthouse was built incorrectly. Please make sure git is available when building.", +// "Because of this, you will not be notified of updates.", LogArea.Startup ); CommitHash = "invalid"; @@ -54,14 +54,14 @@ public static class VersionHelper public static string CommitHash { get; set; } public static string Branch { get; set; } - public static string FullVersion => $"{ServerStatics.ServerName} {Branch}@{CommitHash} {Build}"; + public static string FullVersion => $"{ServerConfiguration.Instance.Customization.ServerName} {Branch}@{CommitHash} {Build}"; public static bool IsDirty => CommitHash.EndsWith("-dirty") || CommitsOutOfDate != 1 || CommitHash == "invalid" || Branch == "invalid"; public static int CommitsOutOfDate { get; set; } public static bool CanCheckForUpdates { get; set; } public static string[] Remotes { get; set; } public const string Build = - #if DEBUG + #if DEBUG "Debug"; #elif RELEASE "Release"; diff --git a/ProjectLighthouse/PlayerData/LoginResult.cs b/ProjectLighthouse/PlayerData/LoginResult.cs index f577f175..09842ac3 100644 --- a/ProjectLighthouse/PlayerData/LoginResult.cs +++ b/ProjectLighthouse/PlayerData/LoginResult.cs @@ -15,9 +15,12 @@ public class LoginResult public string AuthTicket { get; set; } [XmlElement("lbpEnvVer")] - public string LbpEnvVer { get; set; } + public string ServerBrand { get; set; } public string Serialize() => LbpSerializer.Elements - (new KeyValuePair("authTicket", this.AuthTicket), new KeyValuePair("lbpEnvVer", this.LbpEnvVer)); + ( + new KeyValuePair("authTicket", this.AuthTicket), + new KeyValuePair("lbpEnvVer", this.ServerBrand) + ); } \ No newline at end of file