Added diagnose frontend and backend implementation
This commit is contained in:
33
Moonlight.Api/Implementations/UpdateDiagnoseProvider.cs
Normal file
33
Moonlight.Api/Implementations/UpdateDiagnoseProvider.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Moonlight.Api.Interfaces;
|
||||
using Moonlight.Api.Models;
|
||||
using Moonlight.Api.Services;
|
||||
|
||||
namespace Moonlight.Api.Implementations;
|
||||
|
||||
public sealed class UpdateDiagnoseProvider : IDiagnoseProvider
|
||||
{
|
||||
private readonly ApplicationService ApplicationService;
|
||||
|
||||
public UpdateDiagnoseProvider(ApplicationService applicationService)
|
||||
{
|
||||
ApplicationService = applicationService;
|
||||
}
|
||||
|
||||
public Task<DiagnoseResult[]> DiagnoseAsync()
|
||||
{
|
||||
if (ApplicationService.IsUpToDate)
|
||||
return Task.FromResult<DiagnoseResult[]>([]);
|
||||
|
||||
return Task.FromResult<DiagnoseResult[]>([
|
||||
new DiagnoseResult(
|
||||
DiagnoseLevel.Warning,
|
||||
"Instance is not up-to-date",
|
||||
["Moonlight", "Update Check"],
|
||||
"Update your moonlight instance to receive bug fixes, new features and security patches. Update button can be found in the overview",
|
||||
null,
|
||||
"/admin",
|
||||
null
|
||||
)
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user