From 4eb7b536f0228652623cb91722b9dd9213480ea7 Mon Sep 17 00:00:00 2001 From: Toru the Red Fox Date: Sat, 23 Jul 2022 15:17:21 +0100 Subject: [PATCH] tweaks --- .../Controllers/LoginController.cs | 2 +- .../Tests/AuthenticationTests.cs | 4 ++-- ProjectLighthouse/Helpers/VersionHelper.cs | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/LoginController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/LoginController.cs index 441a1b6a..056a5cfe 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, - ServerBrand = VersionHelper.FullVersion, + ServerBrand = VersionHelper.EnvVer, }.Serialize() ); } diff --git a/ProjectLighthouse.Tests.GameApiTests/Tests/AuthenticationTests.cs b/ProjectLighthouse.Tests.GameApiTests/Tests/AuthenticationTests.cs index acfbfb6b..70fcf8bc 100644 --- a/ProjectLighthouse.Tests.GameApiTests/Tests/AuthenticationTests.cs +++ b/ProjectLighthouse.Tests.GameApiTests/Tests/AuthenticationTests.cs @@ -26,7 +26,7 @@ public class AuthenticationTests : LighthouseServerTest Assert.True(response.IsSuccessStatusCode); string responseContent = await response.Content.ReadAsStringAsync(); Assert.Contains("MM_AUTH=", responseContent); - Assert.Contains(VersionHelper.FullVersion, responseContent); + Assert.Contains(VersionHelper.EnvVer, responseContent); } [DatabaseFact] @@ -39,7 +39,7 @@ public class AuthenticationTests : LighthouseServerTest Assert.NotNull(loginResult.ServerBrand); Assert.Contains("MM_AUTH=", loginResult.AuthTicket); - Assert.Equal(VersionHelper.FullVersion, loginResult.ServerBrand); + Assert.Equal(VersionHelper.EnvVer, loginResult.ServerBrand); } [DatabaseFact] diff --git a/ProjectLighthouse/Helpers/VersionHelper.cs b/ProjectLighthouse/Helpers/VersionHelper.cs index a8c99231..0e331b99 100644 --- a/ProjectLighthouse/Helpers/VersionHelper.cs +++ b/ProjectLighthouse/Helpers/VersionHelper.cs @@ -11,7 +11,7 @@ public static class VersionHelper try { CommitHash = ResourceHelper.ReadManifestFile("gitVersion.txt"); - Branch = ResourceHelper.ReadManifestFile("gitBranch.txt"); + Branch = $"{ResourceHelper.ReadManifestFile("gitBranch.txt")}{((IsDirty) ? "-dirty" : "")}"; string rawRevision = ResourceHelper.ReadManifestFile("gitRevCount.txt"); Revision = (Branch == "main") ? $"r{rawRevision}" : $"{Branch}_r{rawRevision}"; @@ -57,7 +57,8 @@ public static class VersionHelper public static string CommitHash { get; set; } public static string Branch { get; set; } public static string Revision { get; set; } - public static string FullVersion => $"{ServerConfiguration.Instance.Customization.ServerName} {Revision}";//$"Project Lighthouse {Branch}@{CommitHash} {Build} ({ServerConfiguration.Instance.Customization.ServerName})"; + public static string FullVersion => $"Project Lighthouse {Branch}@{CommitHash} {Build} ({ServerConfiguration.Instance.Customization.ServerName} {Revision})"; + public static string EnvVer => $"{ServerConfiguration.Instance.Customization.ServerName} {Revision}"; 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; }