diff --git a/.gitignore b/.gitignore index d0391f6a..26095a5e 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ riderModule.iml lighthouse.config.json gitBranch.txt gitVersion.txt +gitRemotes.txt ProjectLighthouse/.vscode/tasks.json ProjectLighthouse/.vscode/launch.json logs/Startup.log diff --git a/ProjectLighthouse/Helpers/VersionHelper.cs b/ProjectLighthouse/Helpers/VersionHelper.cs index 13bae320..6ba19acc 100644 --- a/ProjectLighthouse/Helpers/VersionHelper.cs +++ b/ProjectLighthouse/Helpers/VersionHelper.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Linq; using Kettu; using LBPUnion.ProjectLighthouse.Logging; using LBPUnion.ProjectLighthouse.Types.Settings; @@ -14,6 +15,17 @@ namespace LBPUnion.ProjectLighthouse.Helpers { CommitHash = readManifestFile("gitVersion.txt"); Branch = readManifestFile("gitBranch.txt"); + + string remotesFile = readManifestFile("gitRemotes.txt"); + + string[] lines = remotesFile.Split('\n'); + + // line[0] line[1] line[2] + // origin git@github.com:LBPUnion/project-lighthouse.git (fetch) + + // linq is a serious and painful catastrophe but its useful so i'm gonna keep using it + Remotes = lines.Select(line => line.Split("\t")[1]).ToArray(); + CanCheckForUpdates = true; } catch @@ -54,6 +66,7 @@ namespace LBPUnion.ProjectLighthouse.Helpers public static string FullVersion => $"{ServerStatics.ServerName} {Branch}@{CommitHash} {Build}"; public static bool IsDirty => CommitHash.EndsWith("-dirty"); public static bool CanCheckForUpdates { get; set; } + public static string[] Remotes { get; set; } public const string Build = #if DEBUG diff --git a/ProjectLighthouse/Pages/Debug/VersionInfoPage.cshtml b/ProjectLighthouse/Pages/Debug/VersionInfoPage.cshtml new file mode 100644 index 00000000..dce46680 --- /dev/null +++ b/ProjectLighthouse/Pages/Debug/VersionInfoPage.cshtml @@ -0,0 +1,24 @@ +@page "/debug/version" +@using LBPUnion.ProjectLighthouse.Helpers +@model LBPUnion.ProjectLighthouse.Pages.Debug.VersionInfoPage + +@{ + Layout = "Layouts/BaseLayout"; + Model.Title = "Debug - Version Information"; + Model.Description = VersionHelper.FullVersion; +} + +

Build specific information

+

FullVersion: @VersionHelper.FullVersion

+
+

Branch: @VersionHelper.Branch

+

Build: @VersionHelper.Build

+

CommitHash: @VersionHelper.CommitHash

+

IsDirty: @VersionHelper.IsDirty

+

CanCheckForUpdates: @VersionHelper.CanCheckForUpdates

+ +

Remotes

+@foreach (string remote in VersionHelper.Remotes) +{ +

@remote

+} \ No newline at end of file diff --git a/ProjectLighthouse/Pages/Debug/VersionInfoPage.cshtml.cs b/ProjectLighthouse/Pages/Debug/VersionInfoPage.cshtml.cs new file mode 100644 index 00000000..97b865b9 --- /dev/null +++ b/ProjectLighthouse/Pages/Debug/VersionInfoPage.cshtml.cs @@ -0,0 +1,12 @@ +using JetBrains.Annotations; +using LBPUnion.ProjectLighthouse.Pages.Layouts; +using Microsoft.AspNetCore.Mvc; + +namespace LBPUnion.ProjectLighthouse.Pages.Debug; + +public class VersionInfoPage : BaseLayout +{ + public VersionInfoPage([NotNull] Database database) : base(database) + {} + public IActionResult OnGet() => this.Page(); +} \ No newline at end of file diff --git a/ProjectLighthouse/ProjectLighthouse.csproj b/ProjectLighthouse/ProjectLighthouse.csproj index ffc2f979..19de509a 100644 --- a/ProjectLighthouse/ProjectLighthouse.csproj +++ b/ProjectLighthouse/ProjectLighthouse.csproj @@ -31,11 +31,13 @@ Always + +