@page "/admin" @using Iceshrimp.Backend.Components.Admin @using Iceshrimp.Backend.Core.Services @using Microsoft.EntityFrameworkCore @inherits AdminComponentBase

This interface is used to adjust parameters of this Iceshrimp.NET instance.

@* - TODO: Remote user management - TODO: More federation stats (e.g. # of activities sent/fetched, some basic queue stats) - TODO: Move queue dashboard to blazor ssr - TODO: Configuration - /admin/config (all loaded config files + their merged content) - TODO: Logs - /admin/logs (ring buffer) - TODO: Policies - /admin/policies (with generic json payload UI for custom policies and nice/smart UI for builtin ones, incl using jsonb_add for e.g. adding instances to a policy) - TODO: Reports - /admin/reports (when implemented) *@

Instance statistics

Total instances @_totalInstances
Active instances @_activeInstances
Total notes @_totalNotes
Local notes @_localNotes
Total notes, past 24h @_totalNotesLastDay
Local notes, past 24h @_localNotesLastDay
@code { [CascadingParameter(Name = "InstanceName")] public required string? InstanceName { get; set; } [Inject] public required CacheService Cache { get; set; } private int _totalInstances; private int _activeInstances; private int _totalNotes; private int _localNotes; private int _totalNotesLastDay; private int _localNotesLastDay; protected override async Task OnInitializedAsync() { _totalInstances = await Cache.FetchValueAsync("stats:totalInstances", TimeSpan.FromHours(1), () => Database.Instances.CountAsync()); _activeInstances = await Cache.FetchValueAsync("stats:activeInstances", TimeSpan.FromHours(1), () => Database.Instances.CountAsync(p => !p.IsNotResponding)); _totalNotes = await Cache.FetchValueAsync("stats:totalNotes", TimeSpan.FromHours(1), () => Database.Notes.CountAsync()); _localNotes = await Cache.FetchValueAsync("stats:localNotes", TimeSpan.FromHours(1), () => Database.Notes.CountAsync(p => p.User.IsLocalUser)); _totalNotesLastDay = await Cache.FetchValueAsync("stats:totalNotesLastDay", TimeSpan.FromHours(1), () => Database.Notes.CountAsync(p => p.CreatedAt > DateTime.UtcNow - TimeSpan.FromDays(1))); _localNotesLastDay = await Cache.FetchValueAsync("stats:localNotesLastDay", TimeSpan.FromHours(1), () => Database.Notes.CountAsync(p => p.CreatedAt > DateTime.UtcNow - TimeSpan.FromDays(1) && p.User.IsLocalUser)); } }