Merge branch 'v2' into v2_UpgradeMoonCore
This commit is contained in:
@@ -7,6 +7,12 @@ namespace Moonlight.Core.Services;
|
||||
[Singleton]
|
||||
public class MoonlightService
|
||||
{
|
||||
public readonly string BuildChannel;
|
||||
public readonly string BuildCommitHash;
|
||||
public readonly string BuildName;
|
||||
public readonly string BuildVersion;
|
||||
public readonly bool IsDockerRun;
|
||||
|
||||
public WebApplication Application { get; set; } // Do NOT modify using a plugin
|
||||
|
||||
private readonly DateTime StartTimestamp = DateTime.UtcNow;
|
||||
@@ -19,6 +25,37 @@ public class MoonlightService
|
||||
Logger = logger;
|
||||
}
|
||||
|
||||
public MoonlightService()
|
||||
{
|
||||
//TODO: Maybe extract to a method to make this a bit cleaner
|
||||
|
||||
if (File.Exists("version"))
|
||||
{
|
||||
var line = File.ReadAllText("version");
|
||||
line = line.Trim();
|
||||
|
||||
var parts = line.Split(";");
|
||||
|
||||
if (parts.Length >= 5)
|
||||
{
|
||||
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
|
||||
}
|
||||
|
||||
public async Task Restart()
|
||||
{
|
||||
Logger.LogInformation("Restarting moonlight");
|
||||
|
||||
Reference in New Issue
Block a user