Improved version detecting
This commit is contained in:
@@ -19,35 +19,31 @@ public class MoonlightService
|
||||
|
||||
public MoonlightService()
|
||||
{
|
||||
//TODO: Maybe extract to a method
|
||||
//TODO: Maybe extract to a method to make this a bit cleaner
|
||||
|
||||
if (!File.Exists("version"))
|
||||
if (File.Exists("version"))
|
||||
{
|
||||
BuildChannel = "N/A";
|
||||
BuildCommitHash = "N/A";
|
||||
BuildName = "N/A";
|
||||
BuildVersion = "N/A";
|
||||
IsDockerRun = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var line = File.ReadAllText("version");
|
||||
line = line.Trim();
|
||||
|
||||
var parts = line.Split(";");
|
||||
|
||||
if (parts.Length < 5)
|
||||
if (parts.Length >= 5)
|
||||
{
|
||||
BuildChannel = "N/A";
|
||||
BuildCommitHash = "N/A";
|
||||
BuildName = "N/A";
|
||||
BuildVersion = "N/A";
|
||||
IsDockerRun = false;
|
||||
}
|
||||
|
||||
BuildChannel = parts[0];
|
||||
BuildCommitHash = parts[1];
|
||||
BuildName = parts[2];
|
||||
BuildVersion = parts[3];
|
||||
IsDockerRun = parts[4] == "docker";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
BuildChannel = "N/A";
|
||||
BuildCommitHash = "N/A";
|
||||
BuildName = "N/A";
|
||||
BuildVersion = "N/A";
|
||||
IsDockerRun = false;
|
||||
|
||||
//TODO: Add log call
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
</div>
|
||||
<div class="col-md-3 col-12">
|
||||
@{
|
||||
var commitText = $"{MoonlightService.BuildCommitHash} (up-to-date)";
|
||||
var commitText = $"{MoonlightService.BuildCommitHash}"; // TODO: Add update check (possible during startup, with error handling etc)
|
||||
}
|
||||
|
||||
<StatCard Value="@commitText" Description="Commit" Icon="bxl-git"/>
|
||||
|
||||
Reference in New Issue
Block a user