This commit is contained in:
Toru the Red Fox 2022-07-23 15:17:21 +01:00
commit 4eb7b536f0
3 changed files with 6 additions and 5 deletions

View file

@ -130,7 +130,7 @@ public class LoginController : ControllerBase
new LoginResult
{
AuthTicket = "MM_AUTH=" + token.UserToken,
ServerBrand = VersionHelper.FullVersion,
ServerBrand = VersionHelper.EnvVer,
}.Serialize()
);
}

View file

@ -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]

View file

@ -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; }