New v2 project structure

This commit is contained in:
Marcel Baumgartner
2024-03-18 09:31:33 +01:00
parent e20415a5bd
commit 0a807605ad
727 changed files with 51204 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
using MoonCore.Attributes;
using MoonCore.Helpers;
using Moonlight.Core.Events;
namespace Moonlight.Core.Services;
[Singleton]
public class MoonlightService
{
public WebApplication Application { get; set; } // Do NOT modify using a plugin
private readonly DateTime StartTimestamp = DateTime.UtcNow;
public async Task Restart()
{
Logger.Info("Restarting moonlight");
// Notify all users that this instance will restart
await CoreEvents.OnMoonlightRestart.Invoke();
await Task.Delay(TimeSpan.FromSeconds(3));
// Stop moonlight so the docker restart policy can restart it
await Application.StopAsync();
}
public Task<TimeSpan> GetUptime()
{
return Task.FromResult(DateTime.UtcNow - StartTimestamp);
}
}