lbpEnvVer parity (somewhat, GameServer) and player polaroid resolution fix (Website) (#373)

* lbp2 beta tweaks

* tweaks

* oops

* pls work

* PLS

* Update UserCardPartial.cshtml

* news reimplementation testing

trying to fix it for lbp1

* a

* configurable envver

* Make numeric revision numbers only usable on full clones

* little comment to describe what EnvVer is

* remove news (again)

* remove redundancy when dirty

* document envver stuff

* remove numeric versioning for upstream merge

* Revert "remove numeric versioning for upstream merge"

This reverts commit 3e7d8eccbc.

* Revert "Revert "remove numeric versioning for upstream merge""

This reverts commit 7fbe145b80.

* Delete gitIsShallowRepo.txt

* accidentally deleted the wrong line oops

* Update VersionHelper.cs

Co-authored-by: Jayden <jvyden@jvyden.xyz>
This commit is contained in:
Toru the Red Fox 2022-07-27 21:03:44 +01:00 committed by GitHub
parent a734d5f276
commit 6525ebe3cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 44 additions and 31 deletions

1
.gitignore vendored
View file

@ -28,6 +28,7 @@ gitBranch.txt
gitVersion.txt
gitRemotes.txt
gitUnpushed.txt
gitRevCount.txt
logs/*
npTicket*

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

@ -9,7 +9,7 @@
@{
int size = isMobile ? 50 : 100;
}
<div class="cardIcon userCardIcon" style="background-image: url('/gameAssets/@Model.WebsiteAvatarHash'); min-width: @(size)px; width: @(size)px; height: @(size)px">
<div class="cardIcon userCardIcon" style="background-image: url('/gameAssets/@Model.WebsiteAvatarHash'); min-width: @(size)px; width: @(size)px; height: @(size)px; background-position: center center; background-size: auto @(size)px;">
</div>
<div class="cardStats">
@if (showLink)

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

@ -3,4 +3,5 @@ namespace LBPUnion.ProjectLighthouse.Configuration.ConfigurationCategories;
public class CustomizationConfiguration
{
public string ServerName { get; set; } = "Project Lighthouse";
public string EnvironmentName { get; set; } = "project-lighthouse";
}

View file

@ -23,7 +23,7 @@ public class ServerConfiguration
// You can use an ObsoleteAttribute instead. Make sure you set it to error, though.
//
// Thanks for listening~
public const int CurrentConfigVersion = 8;
public const int CurrentConfigVersion = 10;
#region Meta

View file

@ -8,10 +8,13 @@ public static class VersionHelper
{
static VersionHelper()
{
string commitNumber = "invalid";
try
{
CommitHash = ResourceHelper.ReadManifestFile("gitVersion.txt");
Branch = ResourceHelper.ReadManifestFile("gitBranch.txt");
commitNumber = $"{CommitHash}_{Build}";
FullRevision = (Branch == "main") ? $"r{commitNumber}" : $"{Branch}_r{commitNumber}";
string remotesFile = ResourceHelper.ReadManifestFile("gitRemotes.txt");
@ -54,7 +57,15 @@ public static class VersionHelper
public static string CommitHash { get; set; }
public static string Branch { get; set; }
public static string FullVersion => $"Project Lighthouse {Branch}@{CommitHash} {Build} ({ServerConfiguration.Instance.Customization.ServerName})";
/// <summary>
/// The full revision string. States current revision hash and, if not main, the branch.
/// </summary>
public static string FullRevision { get; set; }
/// <summary>
/// The server's branding (environment version) to show to LBP clients. Shows the environment name next to the revision.
/// </summary>
public static string EnvVer => $"{ServerConfiguration.Instance.Customization.EnvironmentName} {FullRevision}";
public static string FullVersion => $"Project Lighthouse {ServerConfiguration.Instance.Customization.EnvironmentName} {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; }

View file

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<TargetFramework>net6.0</TargetFramework>