mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-07 12:28:39 +00:00
Add VersionInfoPage
This commit is contained in:
parent
2ace4dc101
commit
75d4c25f59
5 changed files with 52 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -21,6 +21,7 @@ riderModule.iml
|
||||||
lighthouse.config.json
|
lighthouse.config.json
|
||||||
gitBranch.txt
|
gitBranch.txt
|
||||||
gitVersion.txt
|
gitVersion.txt
|
||||||
|
gitRemotes.txt
|
||||||
ProjectLighthouse/.vscode/tasks.json
|
ProjectLighthouse/.vscode/tasks.json
|
||||||
ProjectLighthouse/.vscode/launch.json
|
ProjectLighthouse/.vscode/launch.json
|
||||||
logs/Startup.log
|
logs/Startup.log
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using Kettu;
|
using Kettu;
|
||||||
using LBPUnion.ProjectLighthouse.Logging;
|
using LBPUnion.ProjectLighthouse.Logging;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Settings;
|
using LBPUnion.ProjectLighthouse.Types.Settings;
|
||||||
|
@ -14,6 +15,17 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
||||||
{
|
{
|
||||||
CommitHash = readManifestFile("gitVersion.txt");
|
CommitHash = readManifestFile("gitVersion.txt");
|
||||||
Branch = readManifestFile("gitBranch.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;
|
CanCheckForUpdates = true;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
@ -54,6 +66,7 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
||||||
public static string FullVersion => $"{ServerStatics.ServerName} {Branch}@{CommitHash} {Build}";
|
public static string FullVersion => $"{ServerStatics.ServerName} {Branch}@{CommitHash} {Build}";
|
||||||
public static bool IsDirty => CommitHash.EndsWith("-dirty");
|
public static bool IsDirty => CommitHash.EndsWith("-dirty");
|
||||||
public static bool CanCheckForUpdates { get; set; }
|
public static bool CanCheckForUpdates { get; set; }
|
||||||
|
public static string[] Remotes { get; set; }
|
||||||
|
|
||||||
public const string Build =
|
public const string Build =
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
|
24
ProjectLighthouse/Pages/Debug/VersionInfoPage.cshtml
Normal file
24
ProjectLighthouse/Pages/Debug/VersionInfoPage.cshtml
Normal file
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
<h2>Build specific information</h2>
|
||||||
|
<p><b>FullVersion</b>: @VersionHelper.FullVersion</p>
|
||||||
|
<br>
|
||||||
|
<p><b>Branch</b>: @VersionHelper.Branch</p>
|
||||||
|
<p><b>Build</b>: @VersionHelper.Build</p>
|
||||||
|
<p><b>CommitHash</b>: @VersionHelper.CommitHash</p>
|
||||||
|
<p><b>IsDirty</b>: @VersionHelper.IsDirty</p>
|
||||||
|
<p><b>CanCheckForUpdates</b>: @VersionHelper.CanCheckForUpdates</p>
|
||||||
|
|
||||||
|
<h2>Remotes</h2>
|
||||||
|
@foreach (string remote in VersionHelper.Remotes)
|
||||||
|
{
|
||||||
|
<p>@remote</p>
|
||||||
|
}
|
12
ProjectLighthouse/Pages/Debug/VersionInfoPage.cshtml.cs
Normal file
12
ProjectLighthouse/Pages/Debug/VersionInfoPage.cshtml.cs
Normal file
|
@ -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();
|
||||||
|
}
|
|
@ -31,11 +31,13 @@
|
||||||
<EmbeddedResource Include="gitBranch.txt">
|
<EmbeddedResource Include="gitBranch.txt">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<None Remove="gitRemotes.txt"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||||
<Exec Command="git describe --long --always --dirty --exclude=\* --abbrev=8 > "$(ProjectDir)/gitVersion.txt""/>
|
<Exec Command="git describe --long --always --dirty --exclude=\* --abbrev=8 > "$(ProjectDir)/gitVersion.txt""/>
|
||||||
<Exec Command="git branch --show-current > "$(ProjectDir)/gitBranch.txt""/>
|
<Exec Command="git branch --show-current > "$(ProjectDir)/gitBranch.txt""/>
|
||||||
|
<Exec Command="git remote -v > "$(ProjectDir)/gitRemotes.txt""/>
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue