@page "/status"
@using SPTarkov.Server.Core.Helpers
@using SPTarkov.Server.Core.Models.Spt.Config
@using SPTarkov.Server.Core.Servers
@using SPTarkov.Server.Core.Services
@using SPTarkov.Server.Core.Utils
@using SPTarkov.Server.Web.Components.Layout
@inject ConfigServer ConfigServer
@inject TimeUtil TimeUtil
@inject ProfileActivityService ProfileActivityService
@inject ProfileHelper ProfileHelper
@layout BaseMudBlazorLayout
Server health
SPT Version: @_sptVersion
Mods @(_modsEnabled ? "ENABLED" : "DISABLED")
Debug @(_debugEnabled ? "ENABLED" : "DISABLED")
Time started: @_startTime
Uptime: @_uptimeSeconds seconds
Total profile count: @_totalProfileCount
@foreach (var profile in _activeProfiles)
{
@profile
}
@code
{
private string _sptVersion = string.Empty;
private bool _debugEnabled = false;
private bool _modsEnabled = false;
private DateTime _startTime = DateTime.Now;
private long _uptimeSeconds = 0;
private readonly List _activeProfiles = [];
private int _totalProfileCount = 0;
protected override void OnInitialized()
{
base.OnInitialized();
var coreConfig = ConfigServer.GetConfig();
_sptVersion = ProgramStatics.SPT_VERSION().ToString();
_debugEnabled = ProgramStatics.DEBUG();
_modsEnabled = ProgramStatics.MODS();
_startTime = TimeUtil.GetDateTimeFromTimeStamp(coreConfig.ServerStartTime.Value).ToLocalTime();
_uptimeSeconds = DateTimeOffset.Now.ToUnixTimeSeconds() - coreConfig.ServerStartTime.Value;
var activeProfileIds = ProfileActivityService.GetActiveProfileIdsWithinMinutes(30);
if (activeProfileIds.Count == 0)
{
_activeProfiles.Add("None");
}
else
{
foreach (var activeProfileId in activeProfileIds)
{
_activeProfiles.Add($"{activeProfileId} ({ProfileHelper.GetPmcProfile(activeProfileId).Info.Nickname})");
}
}
_totalProfileCount = ProfileHelper.GetProfiles().Count;
}
private readonly MudTheme _theme = new()
{
PaletteDark = new PaletteDark
{
Primary = Colors.Blue.Default,
Secondary = Colors.Orange.Default,
Warning = Colors.Amber.Default,
Info = Colors.Blue.Lighten1,
Success = Colors.Green.Default,
Background = "rgba(0,0,0,0.9)",
Surface = "rgba(255,255,255,0.05)",
AppbarBackground = "rgba(0,0,0,0.8)",
TextPrimary = "#FFFFFF"
}
};
}