Adding permissions. I hate my life ;)
This commit is contained in:
parent
178ff36e86
commit
74d4ee729d
18 changed files with 698 additions and 706 deletions
|
@ -8,6 +8,104 @@ public static class Permissions
|
|||
Name = "Admin dashboard",
|
||||
Description = "See basic information about growth and status of the moonlight instance"
|
||||
};
|
||||
|
||||
public static Permission SystemDashboard = new()
|
||||
{
|
||||
Index = 1,
|
||||
Name = "System information",
|
||||
Description = "See information about the moonlight instance like the uptime and memory usage"
|
||||
};
|
||||
|
||||
public static Permission SystemSentry = new()
|
||||
{
|
||||
Index = 2,
|
||||
Name = "Settings for Sentry",
|
||||
Description = "See information about the sentry status"
|
||||
};
|
||||
|
||||
public static Permission SystemMalware = new()
|
||||
{
|
||||
Index = 3,
|
||||
Name = "Server malware scanner",
|
||||
Description = "Scan running servers for malware"
|
||||
};
|
||||
|
||||
public static Permission SystemSecurity = new()
|
||||
{
|
||||
Index = 4,
|
||||
Name = "System security settings",
|
||||
Description = "Ban ip addresses and view the security logs"
|
||||
};
|
||||
|
||||
public static Permission SystemResources = new()
|
||||
{
|
||||
Index = 5,
|
||||
Name = "Resources",
|
||||
Description = "Read and write moonlight resources like configuration files"
|
||||
};
|
||||
|
||||
public static Permission DiscordBot = new()
|
||||
{
|
||||
Index = 6,
|
||||
Name = "Discord bot actions",
|
||||
Description = "Setup and remote control the discord bot if enabled"
|
||||
};
|
||||
|
||||
public static Permission NewsMessages = new()
|
||||
{
|
||||
Index = 7,
|
||||
Name = "News messages",
|
||||
Description = "Edit, view and delete messages for the user dashboard"
|
||||
};
|
||||
|
||||
public static Permission SystemConfiguration = new()
|
||||
{
|
||||
Index = 8,
|
||||
Name = "System configuration",
|
||||
Description = "Modify the moonlight configuration though the visual editor"
|
||||
};
|
||||
|
||||
public static Permission SystemMail = new()
|
||||
{
|
||||
Index = 9,
|
||||
Name = "System mail settings",
|
||||
Description = "Modify the mail templates and send test mails"
|
||||
};
|
||||
|
||||
public static Permission ServersOverview = new()
|
||||
{
|
||||
Index = 10,
|
||||
Name = "Servers overview",
|
||||
Description = "View all servers and their owners"
|
||||
};
|
||||
|
||||
public static Permission ServerAdminEdit = new()
|
||||
{
|
||||
Index = 11,
|
||||
Name = "Edit servers",
|
||||
Description = "View all servers and their owners"
|
||||
};
|
||||
|
||||
public static Permission ServerManager = new()
|
||||
{
|
||||
Index = 12,
|
||||
Name = "Server manager",
|
||||
Description = "View all servers are currently running and stop/kill all running servers"
|
||||
};
|
||||
|
||||
public static Permission ServerCleanup = new()
|
||||
{
|
||||
Index = 13,
|
||||
Name = "Server cleanup",
|
||||
Description = "View the stats about the cleanup system"
|
||||
};
|
||||
|
||||
public static Permission Nodes = new()
|
||||
{
|
||||
Index = 14,
|
||||
Name = "Nodes",
|
||||
Description = "View stats about the nodes"
|
||||
};
|
||||
|
||||
public static Permission? FromString(string name)
|
||||
{
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
<_ContentIncludedByDefault Remove="Shared\Views\Admin\Servers\Cleanup\Exceptions\Edit.razor" />
|
||||
<_ContentIncludedByDefault Remove="Shared\Components\News\NewsEditor.razor" />
|
||||
<_ContentIncludedByDefault Remove="Shared\News\Edit.razor" />
|
||||
<_ContentIncludedByDefault Remove="Shared\Views\Admin\AaPanels\Index.razor" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
@page "/admin/aapanels"
|
||||
|
|
@ -17,118 +17,116 @@
|
|||
|
||||
@attribute [PermissionRequired(nameof(Permissions.AdminDashboard))]
|
||||
|
||||
<OnlyAdmin>
|
||||
<LazyLoader Load="Load">
|
||||
<div class="row mb-5">
|
||||
<div class="col-12 col-lg-6 col-xl">
|
||||
<a class="mt-4 card" href="/admin/servers">
|
||||
<div class="card-body">
|
||||
<div class="row align-items-center gx-0">
|
||||
<div class="col">
|
||||
<h6 class="text-uppercase text-muted mb-2">
|
||||
<TL>Servers</TL>
|
||||
</h6>
|
||||
<span class="h2 mb-0">
|
||||
@(ServerCount)
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<span class="h2 text-muted mb-0">
|
||||
<i class="text-primary bx bx-server bx-lg"></i>
|
||||
</span>
|
||||
</div>
|
||||
<LazyLoader Load="Load">
|
||||
<div class="row mb-5">
|
||||
<div class="col-12 col-lg-6 col-xl">
|
||||
<a class="mt-4 card" href="/admin/servers">
|
||||
<div class="card-body">
|
||||
<div class="row align-items-center gx-0">
|
||||
<div class="col">
|
||||
<h6 class="text-uppercase text-muted mb-2">
|
||||
<TL>Servers</TL>
|
||||
</h6>
|
||||
<span class="h2 mb-0">
|
||||
@(ServerCount)
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 col-xl">
|
||||
<a class="mt-4 card" href="/admin/webspaces">
|
||||
<div class="card-body">
|
||||
<div class="row align-items-center gx-0">
|
||||
<div class="col">
|
||||
<h6 class="text-uppercase text-muted mb-2">
|
||||
<TL>Webspaces</TL>
|
||||
</h6>
|
||||
<span class="h2 mb-0">
|
||||
@(WebSpaceCount)
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<span class="h2 text-muted mb-0">
|
||||
<i class="text-primary bx bx-globe bx-lg"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 col-xl">
|
||||
<a class="mt-4 card" href="/admin/domains">
|
||||
<div class="card-body">
|
||||
<div class="row align-items-center gx-0">
|
||||
<div class="col">
|
||||
<h6 class="text-uppercase text-muted mb-2">
|
||||
<TL>Domains</TL>
|
||||
</h6>
|
||||
<span class="h2 mb-0">
|
||||
@(DomainCount)
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<span class="h2 text-muted mb-">
|
||||
<i class="text-primary bx bx-purchase-tag bx-lg"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 col-xl">
|
||||
<a class="mt-4 card" href="/admin/users">
|
||||
<div class="card-body">
|
||||
<div class="row align-items-center gx-0">
|
||||
<div class="col">
|
||||
<h6 class="text-uppercase text-muted mb-2">
|
||||
<TL>Users</TL>
|
||||
</h6>
|
||||
<span class="h2 mb-0">
|
||||
@(UserCount)
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<span class="h2 text-muted mb-">
|
||||
<i class="text-primary bx bx-user bx-lg"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<LazyLoader Load="LoadHealthCheckData">
|
||||
@if (HealthCheckData == null)
|
||||
{
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="card-title">
|
||||
<TL>Moonlight health</TL>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="alert alert-warning">
|
||||
<TL>Unable to fetch health check data</TL>
|
||||
<div class="col-auto">
|
||||
<span class="h2 text-muted mb-0">
|
||||
<i class="text-primary bx bx-server bx-lg"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<HealthCheckView HealthCheck="@HealthCheckData"/>
|
||||
}
|
||||
</LazyLoader>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 col-xl">
|
||||
<a class="mt-4 card" href="/admin/webspaces">
|
||||
<div class="card-body">
|
||||
<div class="row align-items-center gx-0">
|
||||
<div class="col">
|
||||
<h6 class="text-uppercase text-muted mb-2">
|
||||
<TL>Webspaces</TL>
|
||||
</h6>
|
||||
<span class="h2 mb-0">
|
||||
@(WebSpaceCount)
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<span class="h2 text-muted mb-0">
|
||||
<i class="text-primary bx bx-globe bx-lg"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 col-xl">
|
||||
<a class="mt-4 card" href="/admin/domains">
|
||||
<div class="card-body">
|
||||
<div class="row align-items-center gx-0">
|
||||
<div class="col">
|
||||
<h6 class="text-uppercase text-muted mb-2">
|
||||
<TL>Domains</TL>
|
||||
</h6>
|
||||
<span class="h2 mb-0">
|
||||
@(DomainCount)
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<span class="h2 text-muted mb-">
|
||||
<i class="text-primary bx bx-purchase-tag bx-lg"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 col-xl">
|
||||
<a class="mt-4 card" href="/admin/users">
|
||||
<div class="card-body">
|
||||
<div class="row align-items-center gx-0">
|
||||
<div class="col">
|
||||
<h6 class="text-uppercase text-muted mb-2">
|
||||
<TL>Users</TL>
|
||||
</h6>
|
||||
<span class="h2 mb-0">
|
||||
@(UserCount)
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<span class="h2 text-muted mb-">
|
||||
<i class="text-primary bx bx-user bx-lg"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<LazyLoader Load="LoadHealthCheckData">
|
||||
@if (HealthCheckData == null)
|
||||
{
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="card-title">
|
||||
<TL>Moonlight health</TL>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="alert alert-warning">
|
||||
<TL>Unable to fetch health check data</TL>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<HealthCheckView HealthCheck="@HealthCheckData"/>
|
||||
}
|
||||
</LazyLoader>
|
||||
</OnlyAdmin>
|
||||
</LazyLoader>
|
||||
|
||||
@code
|
||||
{
|
||||
|
|
|
@ -8,62 +8,64 @@
|
|||
@inject ServerRepository ServerRepository
|
||||
@inject SmartTranslateService SmartTranslateService
|
||||
|
||||
<OnlyAdmin>
|
||||
<div class="row">
|
||||
<LazyLoader Load="Load">
|
||||
<div class="card">
|
||||
<div class="card-header border-0 pt-5">
|
||||
<h3 class="card-title align-items-start flex-column">
|
||||
<span class="card-label fw-bold fs-3 mb-1"><TL>Servers</TL></span>
|
||||
</h3>
|
||||
<div class="card-toolbar">
|
||||
<a href="/admin/servers/new" class="btn btn-sm btn-light-success">
|
||||
<i class="bx bx-layer-plus"></i>
|
||||
<TL>New server</TL>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body pt-0">
|
||||
@if (Servers.Any())
|
||||
{
|
||||
<div class="table-responsive">
|
||||
<Table TableItem="Server" Items="Servers" PageSize="25" TableClass="table table-row-bordered table-row-gray-100 align-middle gs-0 gy-3" TableHeadClass="fw-bold text-muted">
|
||||
<Column TableItem="Server" Title="@(SmartTranslateService.Translate("Id"))" Field="@(x => x.Id)" Sortable="true" Filterable="true"/>
|
||||
<Column TableItem="Server" Title="@(SmartTranslateService.Translate("Name"))" Field="@(x => x.Name)" Sortable="true" Filterable="true">
|
||||
<Template>
|
||||
<a href="/server/@(context.Uuid)">@(context.Name)</a>
|
||||
</Template>
|
||||
</Column>
|
||||
<Column TableItem="Server" Title="@(SmartTranslateService.Translate("Cores"))" Field="@(x => x.Cpu)" Sortable="true" Filterable="true"/>
|
||||
<Column TableItem="Server" Title="@(SmartTranslateService.Translate("Memory"))" Field="@(x => x.Memory)" Sortable="true" Filterable="true"/>
|
||||
<Column TableItem="Server" Title="@(SmartTranslateService.Translate("Disk"))" Field="@(x => x.Disk)" Sortable="true" Filterable="true"/>
|
||||
<Column TableItem="Server" Title="@(SmartTranslateService.Translate("Owner"))" Field="@(x => x.Owner)" Sortable="true" Filterable="true">
|
||||
<Template>
|
||||
<a href="/admin/users/view/@(context.Owner.Id)/">@context.Owner.Email</a>
|
||||
</Template>
|
||||
</Column>
|
||||
<Column TableItem="Server" Title="" Field="@(x => x.Id)" Sortable="false" Filterable="false">
|
||||
<Template>
|
||||
<a href="/admin/servers/view/@(context.Id)">
|
||||
@(SmartTranslateService.Translate("Manage"))
|
||||
</a>
|
||||
</Template>
|
||||
</Column>
|
||||
<Pager ShowPageNumber="true" ShowTotalCount="true"/>
|
||||
</Table>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="alert alert-info">
|
||||
<TL>No servers found</TL>
|
||||
</div>
|
||||
}
|
||||
@attribute [PermissionRequired(nameof(Permissions.ServersOverview))]
|
||||
|
||||
<div class="row">
|
||||
<LazyLoader Load="Load">
|
||||
<div class="card">
|
||||
<div class="card-header border-0 pt-5">
|
||||
<h3 class="card-title align-items-start flex-column">
|
||||
<span class="card-label fw-bold fs-3 mb-1">
|
||||
<TL>Servers</TL>
|
||||
</span>
|
||||
</h3>
|
||||
<div class="card-toolbar">
|
||||
<a href="/admin/servers/new" class="btn btn-sm btn-light-success">
|
||||
<i class="bx bx-layer-plus"></i>
|
||||
<TL>New server</TL>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</LazyLoader>
|
||||
</div>
|
||||
</OnlyAdmin>
|
||||
<div class="card-body pt-0">
|
||||
@if (Servers.Any())
|
||||
{
|
||||
<div class="table-responsive">
|
||||
<Table TableItem="Server" Items="Servers" PageSize="25" TableClass="table table-row-bordered table-row-gray-100 align-middle gs-0 gy-3" TableHeadClass="fw-bold text-muted">
|
||||
<Column TableItem="Server" Title="@(SmartTranslateService.Translate("Id"))" Field="@(x => x.Id)" Sortable="true" Filterable="true"/>
|
||||
<Column TableItem="Server" Title="@(SmartTranslateService.Translate("Name"))" Field="@(x => x.Name)" Sortable="true" Filterable="true">
|
||||
<Template>
|
||||
<a href="/server/@(context.Uuid)">@(context.Name)</a>
|
||||
</Template>
|
||||
</Column>
|
||||
<Column TableItem="Server" Title="@(SmartTranslateService.Translate("Cores"))" Field="@(x => x.Cpu)" Sortable="true" Filterable="true"/>
|
||||
<Column TableItem="Server" Title="@(SmartTranslateService.Translate("Memory"))" Field="@(x => x.Memory)" Sortable="true" Filterable="true"/>
|
||||
<Column TableItem="Server" Title="@(SmartTranslateService.Translate("Disk"))" Field="@(x => x.Disk)" Sortable="true" Filterable="true"/>
|
||||
<Column TableItem="Server" Title="@(SmartTranslateService.Translate("Owner"))" Field="@(x => x.Owner)" Sortable="true" Filterable="true">
|
||||
<Template>
|
||||
<a href="/admin/users/view/@(context.Owner.Id)/">@context.Owner.Email</a>
|
||||
</Template>
|
||||
</Column>
|
||||
<Column TableItem="Server" Title="" Field="@(x => x.Id)" Sortable="false" Filterable="false">
|
||||
<Template>
|
||||
<a href="/admin/servers/view/@(context.Id)">
|
||||
@(SmartTranslateService.Translate("Manage"))
|
||||
</a>
|
||||
</Template>
|
||||
</Column>
|
||||
<Pager ShowPageNumber="true" ShowTotalCount="true"/>
|
||||
</Table>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="alert alert-info">
|
||||
<TL>No servers found</TL>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</LazyLoader>
|
||||
</div>
|
||||
|
||||
@code
|
||||
{
|
||||
|
|
|
@ -1,106 +0,0 @@
|
|||
@page "/admin/system/auditlog"
|
||||
|
||||
@using Moonlight.Shared.Components.Navigations
|
||||
@using Moonlight.App.Repositories.LogEntries
|
||||
@using Moonlight.App.Services
|
||||
@using Moonlight.App.Database.Entities.LogsEntries
|
||||
@using BlazorTable
|
||||
@using Moonlight.App.Helpers
|
||||
@using Moonlight.App.Models.Misc
|
||||
@using Moonlight.Shared.Components.AuditLogEntrys
|
||||
|
||||
@inject AuditLogEntryRepository AuditLogEntryRepository
|
||||
|
||||
<OnlyAdmin>
|
||||
<AdminSystemNavigation Index="2"/>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header card-header-stretch">
|
||||
<div class="card-title d-flex align-items-center">
|
||||
<span class="me-3 lh-0">
|
||||
<i class="bx bx-md bx-calendar"></i>
|
||||
</span>
|
||||
<h3 class="fw-bold m-0 text-gray-800">@(Formatter.FormatDateOnly(DateTime))</h3>
|
||||
</div>
|
||||
<div class="card-toolbar m-0">
|
||||
<ul class="nav nav-tabs nav-line-tabs nav-stretch fs-6 border-0 fw-bold">
|
||||
<li class="nav-item">
|
||||
<button @onclick="Left" class="nav-link justify-content-center text-active-gray-800">
|
||||
<i class="bx bx-md bx-left-arrow"></i>
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<button @onclick="Right" class="nav-link justify-content-center text-active-gray-800">
|
||||
<i class="bx bx-md bx-right-arrow"></i>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<LazyLoader @ref="LazyLoader" Load="Load">
|
||||
@if (AuditLogEntries.Any())
|
||||
{
|
||||
<div class="timeline">
|
||||
@foreach (var entry in AuditLogEntries)
|
||||
{
|
||||
switch (entry.Type)
|
||||
{
|
||||
case AuditLogType.Login:
|
||||
<AuditLogEntryLogin Entry="entry"/>
|
||||
break;
|
||||
case AuditLogType.Register:
|
||||
<AuditLogEntryRegister Entry="entry"/>
|
||||
break;
|
||||
case AuditLogType.ChangePassword:
|
||||
<AuditLogEntryChangePassword Entry="entry"/>
|
||||
break;
|
||||
case AuditLogType.ChangePowerState:
|
||||
<AuditLogEntryChangePowerState Entry="entry"/>
|
||||
break;
|
||||
}
|
||||
}
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="alert alert-primary">
|
||||
<TL>No records found for this day</TL>
|
||||
</div>
|
||||
}
|
||||
</LazyLoader>
|
||||
</div>
|
||||
</div>
|
||||
</OnlyAdmin>
|
||||
|
||||
@code
|
||||
{
|
||||
private AuditLogEntry[] AuditLogEntries;
|
||||
private LazyLoader LazyLoader;
|
||||
private DateTime DateTime = DateTime.Today;
|
||||
|
||||
private Task Load(LazyLoader arg)
|
||||
{
|
||||
AuditLogEntries = AuditLogEntryRepository
|
||||
.Get()
|
||||
.Where(x => x.CreatedAt.Date == DateTime.Date)
|
||||
.OrderByDescending(x => x.Id)
|
||||
.ToArray();
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async Task Left()
|
||||
{
|
||||
DateTime = DateTime.AddDays(1);
|
||||
|
||||
await LazyLoader.Reload();
|
||||
}
|
||||
|
||||
private async Task Right()
|
||||
{
|
||||
DateTime = DateTime.AddDays(-1);
|
||||
|
||||
await LazyLoader.Reload();
|
||||
}
|
||||
}
|
|
@ -9,26 +9,26 @@
|
|||
@inject ToastService ToastService
|
||||
@inject SmartTranslateService SmartTranslateService
|
||||
|
||||
<OnlyAdmin>
|
||||
<AdminSystemNavigation Index="8"/>
|
||||
@attribute [PermissionRequired(nameof(Permissions.SystemConfiguration))]
|
||||
|
||||
<LazyLoader Load="Load">
|
||||
<div class="card">
|
||||
<SmartForm Model="Config" OnValidSubmit="OnSubmit">
|
||||
<div class="card-body">
|
||||
<SmartFormClass Model="Config"/>
|
||||
<AdminSystemNavigation Index="8"/>
|
||||
|
||||
<LazyLoader Load="Load">
|
||||
<div class="card">
|
||||
<SmartForm Model="Config" OnValidSubmit="OnSubmit">
|
||||
<div class="card-body">
|
||||
<SmartFormClass Model="Config"/>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<div class="text-end">
|
||||
<button type="submit" class="btn btn-success">
|
||||
<TL>Save</TL>
|
||||
</button>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<div class="text-end">
|
||||
<button type="submit" class="btn btn-success">
|
||||
<TL>Save</TL>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</SmartForm>
|
||||
</div>
|
||||
</LazyLoader>
|
||||
</OnlyAdmin>
|
||||
</div>
|
||||
</SmartForm>
|
||||
</div>
|
||||
</LazyLoader>
|
||||
|
||||
@code
|
||||
{
|
||||
|
|
|
@ -4,34 +4,34 @@
|
|||
|
||||
@inject DiscordBotService DiscordBotService
|
||||
|
||||
<OnlyAdmin>
|
||||
<AdminSystemNavigation Index="6"/>
|
||||
@attribute [PermissionRequired(nameof(Permissions.DiscordBot))]
|
||||
|
||||
<div class="mt-3 card card-body">
|
||||
<WButton Text="Register commands"
|
||||
WorkingText="Working"
|
||||
CssClasses="btn-primary"
|
||||
OnClick="RegisterCommands">
|
||||
</WButton>
|
||||
<AdminSystemNavigation Index="6"/>
|
||||
|
||||
<WButton Text="Void commands"
|
||||
WorkingText="Working"
|
||||
CssClasses="mt-3 btn-danger"
|
||||
OnClick="VoidCommands">
|
||||
</WButton>
|
||||
</div>
|
||||
</OnlyAdmin>
|
||||
<div class="mt-3 card card-body">
|
||||
<WButton Text="Register commands"
|
||||
WorkingText="Working"
|
||||
CssClasses="btn-primary"
|
||||
OnClick="RegisterCommands">
|
||||
</WButton>
|
||||
|
||||
<WButton Text="Void commands"
|
||||
WorkingText="Working"
|
||||
CssClasses="mt-3 btn-danger"
|
||||
OnClick="VoidCommands">
|
||||
</WButton>
|
||||
</div>
|
||||
|
||||
@code
|
||||
{
|
||||
//ToDo: Ole muss ins Bett gehen
|
||||
//ToDo: Bot Info Card with Name, Bot Avatar, (RichPresence) Game Status, Activity Status
|
||||
|
||||
|
||||
private async Task RegisterCommands()
|
||||
{
|
||||
await DiscordBotService.CreateCommands();
|
||||
}
|
||||
|
||||
|
||||
private Task VoidCommands()
|
||||
{
|
||||
DiscordBotService.RemoveCommandsModule.VoidCommands();
|
||||
|
|
|
@ -7,92 +7,92 @@
|
|||
@inject HostSystemHelper HostSystemHelper
|
||||
@inject MoonlightService MoonlightService
|
||||
|
||||
<OnlyAdmin>
|
||||
<AdminSystemNavigation Index="0"/>
|
||||
@attribute [PermissionRequired(nameof(Permissions.SystemDashboard))]
|
||||
|
||||
<LazyLoader Load="Load">
|
||||
<div class="row">
|
||||
<div class="col-xxl-6 my-3">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<TL>Version</TL>
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<span class="fs-5">
|
||||
<TL>You are running moonlight version</TL>
|
||||
<span class="text-primary">@(MoonlightService.AppVersion)</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<AdminSystemNavigation Index="0"/>
|
||||
|
||||
<LazyLoader Load="Load">
|
||||
<div class="row">
|
||||
<div class="col-xxl-6 my-3">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<TL>Version</TL>
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-xxl-6 my-3">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<TL>Operating system</TL>
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<span class="fs-5">
|
||||
<TL>Moonlight is running on</TL>
|
||||
<span class="text-primary">@(HostSystemHelper.GetOsName())</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xxl-6 my-3">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<TL>Memory usage</TL>
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<span class="fs-5">
|
||||
<TL>Moonlight is using</TL>
|
||||
<span class="text-primary">@(HostSystemHelper.GetMemoryUsage()) MB</span>
|
||||
<TL>of memory</TL>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xxl-6 my-3">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<TL>Cpu usage</TL>
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<span class="fs-5">
|
||||
<TL>Moonlight is using</TL>
|
||||
<span class="text-primary">@(HostSystemHelper.GetCpuUsage()) %</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xxl-6 my-3">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<TL>Uptime</TL>
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<span class="fs-5">
|
||||
<TL>Moonlight is since</TL>
|
||||
<span class="text-primary">
|
||||
@(Formatter.FormatUptime(DateTime.UtcNow - MoonlightService.StartTimestamp))
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<span class="fs-5">
|
||||
<TL>You are running moonlight version</TL>
|
||||
<span class="text-primary">@(MoonlightService.AppVersion)</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</LazyLoader>
|
||||
</OnlyAdmin>
|
||||
</div>
|
||||
<div class="col-xxl-6 my-3">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<TL>Operating system</TL>
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<span class="fs-5">
|
||||
<TL>Moonlight is running on</TL>
|
||||
<span class="text-primary">@(HostSystemHelper.GetOsName())</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xxl-6 my-3">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<TL>Memory usage</TL>
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<span class="fs-5">
|
||||
<TL>Moonlight is using</TL>
|
||||
<span class="text-primary">@(HostSystemHelper.GetMemoryUsage()) MB</span>
|
||||
<TL>of memory</TL>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xxl-6 my-3">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<TL>Cpu usage</TL>
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<span class="fs-5">
|
||||
<TL>Moonlight is using</TL>
|
||||
<span class="text-primary">@(HostSystemHelper.GetCpuUsage()) %</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xxl-6 my-3">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<TL>Uptime</TL>
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<span class="fs-5">
|
||||
<TL>Moonlight is since</TL>
|
||||
<span class="text-primary">
|
||||
@(Formatter.FormatUptime(DateTime.UtcNow - MoonlightService.StartTimestamp))
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</LazyLoader>
|
||||
|
||||
@code
|
||||
{
|
||||
|
@ -100,4 +100,4 @@
|
|||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,79 +16,79 @@
|
|||
@inject AlertService AlertService
|
||||
@inject MailService MailService
|
||||
|
||||
<OnlyAdmin>
|
||||
<AdminSystemNavigation Index="9"/>
|
||||
@attribute [PermissionRequired(nameof(Permissions.SystemMail))]
|
||||
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<TL>Actions</TL>
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<WButton Text="@(SmartTranslateService.Translate("Test mail configuration"))"
|
||||
WorkingText="@(SmartTranslateService.Translate("Sending test mail"))"
|
||||
CssClasses="btn-primary"
|
||||
OnClick="SendTestMail">
|
||||
</WButton>
|
||||
</div>
|
||||
<AdminSystemNavigation Index="9"/>
|
||||
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<TL>Actions</TL>
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<WButton Text="@(SmartTranslateService.Translate("Test mail configuration"))"
|
||||
WorkingText="@(SmartTranslateService.Translate("Sending test mail"))"
|
||||
CssClasses="btn-primary"
|
||||
OnClick="SendTestMail">
|
||||
</WButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<LazyLoader @ref="LazyLoader" Load="Load">
|
||||
@if (CurrentMailTemplate == null)
|
||||
{
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<TL>Mail templates</TL>
|
||||
</span>
|
||||
<div class="card-toolbar">
|
||||
<WButton Text="@(SmartTranslateService.Translate("New mail template"))"
|
||||
CssClasses="btn-sm btn-success"
|
||||
OnClick="CreateNewMailTemplate">
|
||||
</WButton>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<Table TableItem="MailTemplate" Items="MailTemplateFiles" PageSize="25" TableClass="table table-row-bordered table-row-gray-100 align-middle gs-0 gy-3" TableHeadClass="fw-bold text-muted">
|
||||
<Column TableItem="MailTemplate" Title="@(SmartTranslateService.Translate("Name"))" Field="@(x => x.Name)" Sortable="true" Filterable="true">
|
||||
<Template>
|
||||
@{
|
||||
var name = context.Name.Replace(Path.GetExtension(context.Name), "");
|
||||
}
|
||||
|
||||
<span>@(name)</span>
|
||||
</Template>
|
||||
</Column>
|
||||
<Column TableItem="MailTemplate" Title="" Field="@(x => x.Name)" Filterable="false" Sortable="false">
|
||||
<Template>
|
||||
<div class="text-end">
|
||||
<WButton Text="@(SmartTranslateService.Translate("Edit"))"
|
||||
OnClick="() => EditTemplate(context)">
|
||||
</WButton>
|
||||
<DeleteButton OnClick="() => DeleteTemplate(context)"
|
||||
Confirm="true">
|
||||
</DeleteButton>
|
||||
</div>
|
||||
</Template>
|
||||
</Column>
|
||||
<Pager ShowPageNumber="true" ShowTotalCount="true"/>
|
||||
</Table>
|
||||
</div>
|
||||
<LazyLoader @ref="LazyLoader" Load="Load">
|
||||
@if (CurrentMailTemplate == null)
|
||||
{
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<TL>Mail templates</TL>
|
||||
</span>
|
||||
<div class="card-toolbar">
|
||||
<WButton Text="@(SmartTranslateService.Translate("New mail template"))"
|
||||
CssClasses="btn-sm btn-success"
|
||||
OnClick="CreateNewMailTemplate">
|
||||
</WButton>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<FileEditor Language="html"
|
||||
HideControls="false"
|
||||
InitialData="@(CurrentMailTemplateContent)"
|
||||
OnCancel="OnCancelTemplateEdit"
|
||||
OnSubmit="OnSubmitTemplateEdit"/>
|
||||
}
|
||||
</LazyLoader>
|
||||
</OnlyAdmin>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<Table TableItem="MailTemplate" Items="MailTemplateFiles" PageSize="25" TableClass="table table-row-bordered table-row-gray-100 align-middle gs-0 gy-3" TableHeadClass="fw-bold text-muted">
|
||||
<Column TableItem="MailTemplate" Title="@(SmartTranslateService.Translate("Name"))" Field="@(x => x.Name)" Sortable="true" Filterable="true">
|
||||
<Template>
|
||||
@{
|
||||
var name = context.Name.Replace(Path.GetExtension(context.Name), "");
|
||||
}
|
||||
|
||||
<span>@(name)</span>
|
||||
</Template>
|
||||
</Column>
|
||||
<Column TableItem="MailTemplate" Title="" Field="@(x => x.Name)" Filterable="false" Sortable="false">
|
||||
<Template>
|
||||
<div class="text-end">
|
||||
<WButton Text="@(SmartTranslateService.Translate("Edit"))"
|
||||
OnClick="() => EditTemplate(context)">
|
||||
</WButton>
|
||||
<DeleteButton OnClick="() => DeleteTemplate(context)"
|
||||
Confirm="true">
|
||||
</DeleteButton>
|
||||
</div>
|
||||
</Template>
|
||||
</Column>
|
||||
<Pager ShowPageNumber="true" ShowTotalCount="true"/>
|
||||
</Table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<FileEditor Language="html"
|
||||
HideControls="false"
|
||||
InitialData="@(CurrentMailTemplateContent)"
|
||||
OnCancel="OnCancelTemplateEdit"
|
||||
OnSubmit="OnSubmitTemplateEdit"/>
|
||||
}
|
||||
</LazyLoader>
|
||||
|
||||
@code
|
||||
{
|
||||
|
|
|
@ -14,89 +14,89 @@
|
|||
|
||||
@implements IDisposable
|
||||
|
||||
<OnlyAdmin>
|
||||
<AdminSystemNavigation Index="2"/>
|
||||
@attribute [PermissionRequired(nameof(Permissions.SystemMalware))]
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
@if (MalwareScanService.IsRunning)
|
||||
{
|
||||
<span class="fs-3 spinner-border align-middle me-3"></span>
|
||||
}
|
||||
<AdminSystemNavigation Index="2"/>
|
||||
|
||||
<span class="fs-3">@(MalwareScanService.Status)</span>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
@if (MalwareScanService.IsRunning)
|
||||
{
|
||||
<button class="btn btn-success disabled">
|
||||
<TL>Scan in progress</TL>
|
||||
</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<WButton Text="@(SmartTranslateService.Translate("Start scan"))"
|
||||
CssClasses="btn-success"
|
||||
OnClick="MalwareScanService.Start">
|
||||
</WButton>
|
||||
}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
@if (MalwareScanService.IsRunning)
|
||||
{
|
||||
<span class="fs-3 spinner-border align-middle me-3"></span>
|
||||
}
|
||||
|
||||
<span class="fs-3">@(MalwareScanService.Status)</span>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
@if (MalwareScanService.IsRunning)
|
||||
{
|
||||
<button class="btn btn-success disabled">
|
||||
<TL>Scan in progress</TL>
|
||||
</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<WButton Text="@(SmartTranslateService.Translate("Start scan"))"
|
||||
CssClasses="btn-success"
|
||||
OnClick="MalwareScanService.Start">
|
||||
</WButton>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<TL>Results</TL>
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<LazyLoader @ref="LazyLoaderResults" Load="LoadResults">
|
||||
<div class="table-responsive">
|
||||
<Table TableItem="Server" Items="ScanResults.Keys" PageSize="25" TableClass="table table-row-bordered table-row-gray-100 align-middle gs-0 gy-3" TableHeadClass="fw-bold text-muted">
|
||||
<Column TableItem="Server" Title="@(SmartTranslateService.Translate("Server"))" Field="@(x => x.Id)" Sortable="false" Filterable="false">
|
||||
<Template>
|
||||
<a href="/server/@(context.Uuid)">@(context.Name)</a>
|
||||
</Template>
|
||||
</Column>
|
||||
<Column TableItem="Server" Title="@(SmartTranslateService.Translate("Results"))" Field="@(x => x.Id)" Sortable="false" Filterable="false">
|
||||
<Template>
|
||||
<div class="row">
|
||||
@foreach (var result in ScanResults[context])
|
||||
{
|
||||
<div class="col-12 col-md-6 p-3">
|
||||
<div class="accordion" id="scanResult@(result.GetHashCode())">
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header" id="scanResult-header@(result.GetHashCode())">
|
||||
<button class="accordion-button fs-4 fw-semibold collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#scanResult-body@(result.GetHashCode())" aria-expanded="false" aria-controls="scanResult-body@(result.GetHashCode())">
|
||||
<span>@(result.Title)</span>
|
||||
</button>
|
||||
</h2>
|
||||
<div id="scanResult-body@(result.GetHashCode())" class="accordion-collapse collapse" aria-labelledby="scanResult-header@(result.GetHashCode())" data-bs-parent="#scanResult">
|
||||
<div class="accordion-body">
|
||||
<p>
|
||||
@(result.Description)
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<TL>Results</TL>
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<LazyLoader @ref="LazyLoaderResults" Load="LoadResults">
|
||||
<div class="table-responsive">
|
||||
<Table TableItem="Server" Items="ScanResults.Keys" PageSize="25" TableClass="table table-row-bordered table-row-gray-100 align-middle gs-0 gy-3" TableHeadClass="fw-bold text-muted">
|
||||
<Column TableItem="Server" Title="@(SmartTranslateService.Translate("Server"))" Field="@(x => x.Id)" Sortable="false" Filterable="false">
|
||||
<Template>
|
||||
<a href="/server/@(context.Uuid)">@(context.Name)</a>
|
||||
</Template>
|
||||
</Column>
|
||||
<Column TableItem="Server" Title="@(SmartTranslateService.Translate("Results"))" Field="@(x => x.Id)" Sortable="false" Filterable="false">
|
||||
<Template>
|
||||
<div class="row">
|
||||
@foreach (var result in ScanResults[context])
|
||||
{
|
||||
<div class="col-12 col-md-6 p-3">
|
||||
<div class="accordion" id="scanResult@(result.GetHashCode())">
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header" id="scanResult-header@(result.GetHashCode())">
|
||||
<button class="accordion-button fs-4 fw-semibold collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#scanResult-body@(result.GetHashCode())" aria-expanded="false" aria-controls="scanResult-body@(result.GetHashCode())">
|
||||
<span>@(result.Title)</span>
|
||||
</button>
|
||||
</h2>
|
||||
<div id="scanResult-body@(result.GetHashCode())" class="accordion-collapse collapse" aria-labelledby="scanResult-header@(result.GetHashCode())" data-bs-parent="#scanResult">
|
||||
<div class="accordion-body">
|
||||
<p>
|
||||
@(result.Description)
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</Template>
|
||||
</Column>
|
||||
<Pager ShowPageNumber="true" ShowTotalCount="true"/>
|
||||
</Table>
|
||||
</div>
|
||||
</LazyLoader>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</Template>
|
||||
</Column>
|
||||
<Pager ShowPageNumber="true" ShowTotalCount="true"/>
|
||||
</Table>
|
||||
</div>
|
||||
</LazyLoader>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</OnlyAdmin>
|
||||
</div>
|
||||
|
||||
@code
|
||||
{
|
||||
|
|
|
@ -10,52 +10,52 @@
|
|||
@inject NavigationManager NavigationManager
|
||||
@inject NewsEntryRepository NewsEntryRepository
|
||||
|
||||
<OnlyAdmin>
|
||||
<LazyLoader Load="Load">
|
||||
@if (Entry == null)
|
||||
{
|
||||
<div class="alert bg-info d-flex flex-column flex-sm-row w-100 p-5">
|
||||
<div class="d-flex flex-column pe-0 pe-sm-10">
|
||||
<h4 class="fw-semibold">
|
||||
<TL>No entry found</TL>
|
||||
</h4>
|
||||
<span>
|
||||
<TL>We were not able to find the news entry with this id</TL>
|
||||
</span>
|
||||
@attribute [PermissionRequired(nameof(Permissions.NewsMessages))]
|
||||
|
||||
<LazyLoader Load="Load">
|
||||
@if (Entry == null)
|
||||
{
|
||||
<div class="alert bg-info d-flex flex-column flex-sm-row w-100 p-5">
|
||||
<div class="d-flex flex-column pe-0 pe-sm-10">
|
||||
<h4 class="fw-semibold">
|
||||
<TL>No entry found</TL>
|
||||
</h4>
|
||||
<span>
|
||||
<TL>We were not able to find the news entry with this id</TL>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="card mb-6">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title w-75">
|
||||
<input type="text" @bind="Entry.Title" placeholder="@SmartTranslateService.Translate("Title...")" class="form-control form-control-flush"/>
|
||||
</h3>
|
||||
<div class="card-toolbar">
|
||||
<span class="text-gray-600 fw-semibold">@(Formatter.FormatDateOnly(Entry.Date))</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="card mb-6">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title w-75">
|
||||
<input type="text" @bind="Entry.Title" placeholder="@SmartTranslateService.Translate("Title...")" class="form-control form-control-flush"/>
|
||||
</h3>
|
||||
<div class="card-toolbar">
|
||||
<span class="text-gray-600 fw-semibold">@(Formatter.FormatDateOnly(Entry.Date))</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<FileEditor @ref="FileEditor" Language="markdown" HideControls="true" InitialData="@(Entry.Markdown)"/>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<WButton CssClasses="btn btn-primary text-end"
|
||||
OnClick="Save"
|
||||
Text="@SmartTranslateService.Translate("Save")"
|
||||
WorkingText="@SmartTranslateService.Translate("Saving...")">
|
||||
</WButton>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<FileEditor @ref="FileEditor" Language="markdown" HideControls="true" InitialData="@(Entry.Markdown)"/>
|
||||
</div>
|
||||
}
|
||||
</LazyLoader>
|
||||
</OnlyAdmin>
|
||||
<div class="card-footer">
|
||||
<WButton CssClasses="btn btn-primary text-end"
|
||||
OnClick="Save"
|
||||
Text="@SmartTranslateService.Translate("Save")"
|
||||
WorkingText="@SmartTranslateService.Translate("Saving...")">
|
||||
</WButton>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</LazyLoader>
|
||||
|
||||
@code
|
||||
{
|
||||
[Parameter]
|
||||
public int Id { get; set; }
|
||||
|
||||
|
||||
private NewsEntry? Entry;
|
||||
|
||||
private FileEditor FileEditor;
|
||||
|
@ -63,16 +63,16 @@
|
|||
private async Task Save()
|
||||
{
|
||||
Entry!.Markdown = await FileEditor.GetData();
|
||||
|
||||
|
||||
NewsEntryRepository.Update(Entry);
|
||||
|
||||
|
||||
NavigationManager.NavigateTo("/admin/system/news");
|
||||
}
|
||||
|
||||
private Task Load(LazyLoader arg)
|
||||
{
|
||||
Entry = NewsEntryRepository.Get().FirstOrDefault(x => x.Id == Id);
|
||||
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
|
@ -12,50 +12,50 @@
|
|||
@inject SmartTranslateService SmartTranslateService
|
||||
@inject AlertService AlertService
|
||||
|
||||
<OnlyAdmin>
|
||||
<AdminSystemNavigation Index="7" />
|
||||
|
||||
<div class="card card-body mb-6">
|
||||
<div class="text-end">
|
||||
<a href="/admin/system/news/new" class="btn btn-success">
|
||||
<TL>New entry</TL>
|
||||
</a>
|
||||
</div>
|
||||
@attribute [PermissionRequired(nameof(Permissions.NewsMessages))]
|
||||
|
||||
<AdminSystemNavigation Index="7"/>
|
||||
|
||||
<div class="card card-body mb-6">
|
||||
<div class="text-end">
|
||||
<a href="/admin/system/news/new" class="btn btn-success">
|
||||
<TL>New entry</TL>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<LazyLoader @ref="LazyLoader" Load="Load">
|
||||
@foreach (var entry in Entries)
|
||||
{
|
||||
<div class="card mb-6">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">@entry.Title</h3>
|
||||
<div class="card-toolbar">
|
||||
<a href="/admin/system/news/edit/@(entry.Id)">
|
||||
<button class="btn btn-sm btn-light me-4">
|
||||
<TL>Edit</TL>
|
||||
</button>
|
||||
</a>
|
||||
<LazyLoader @ref="LazyLoader" Load="Load">
|
||||
@foreach (var entry in Entries)
|
||||
{
|
||||
<div class="card mb-6">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">@entry.Title</h3>
|
||||
<div class="card-toolbar">
|
||||
<a href="/admin/system/news/edit/@(entry.Id)">
|
||||
<button class="btn btn-sm btn-light me-4">
|
||||
<TL>Edit</TL>
|
||||
</button>
|
||||
</a>
|
||||
|
||||
<WButton CssClasses="btn btn-sm btn-light me-4"
|
||||
Text="@SmartTranslateService.Translate("Delete")"
|
||||
WorkingText="@SmartTranslateService.Translate("Deleting...")"
|
||||
OnClick="() => Delete(entry)">
|
||||
</WButton>
|
||||
<WButton CssClasses="btn btn-sm btn-light me-4"
|
||||
Text="@SmartTranslateService.Translate("Delete")"
|
||||
WorkingText="@SmartTranslateService.Translate("Deleting...")"
|
||||
OnClick="() => Delete(entry)">
|
||||
</WButton>
|
||||
|
||||
<span class="text-gray-600 fw-semibold">@(Formatter.FormatDateOnly(entry.Date))</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@{
|
||||
var html = (MarkupString)Markdown.ToHtml(entry.Markdown);
|
||||
}
|
||||
|
||||
@(html)
|
||||
<span class="text-gray-600 fw-semibold">@(Formatter.FormatDateOnly(entry.Date))</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</LazyLoader>
|
||||
</OnlyAdmin>
|
||||
<div class="card-body">
|
||||
@{
|
||||
var html = (MarkupString)Markdown.ToHtml(entry.Markdown);
|
||||
}
|
||||
|
||||
@(html)
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</LazyLoader>
|
||||
|
||||
@code
|
||||
{
|
||||
|
|
|
@ -9,28 +9,28 @@
|
|||
@inject NavigationManager NavigationManager
|
||||
@inject NewsEntryRepository NewsEntryRepository
|
||||
|
||||
<OnlyAdmin>
|
||||
<div class="card mb-6">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title w-75">
|
||||
<input type="text" @bind="Model.Title" placeholder="@SmartTranslateService.Translate("Title...")" class="form-control form-control-flush"/>
|
||||
</h3>
|
||||
<div class="card-toolbar">
|
||||
<span class="text-gray-600 fw-semibold">@(Formatter.FormatDateOnly(Model.Date))</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<FileEditor @ref="FileEditor" Language="markdown" HideControls="true" InitialData=""/>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<WButton CssClasses="btn btn-primary text-end"
|
||||
OnClick="Save"
|
||||
Text="@SmartTranslateService.Translate("Save")"
|
||||
WorkingText="@SmartTranslateService.Translate("Saving...")">
|
||||
</WButton>
|
||||
@attribute [PermissionRequired(nameof(Permissions.NewsMessages))]
|
||||
|
||||
<div class="card mb-6">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title w-75">
|
||||
<input type="text" @bind="Model.Title" placeholder="@SmartTranslateService.Translate("Title...")" class="form-control form-control-flush"/>
|
||||
</h3>
|
||||
<div class="card-toolbar">
|
||||
<span class="text-gray-600 fw-semibold">@(Formatter.FormatDateOnly(Model.Date))</span>
|
||||
</div>
|
||||
</div>
|
||||
</OnlyAdmin>
|
||||
<div class="card-body">
|
||||
<FileEditor @ref="FileEditor" Language="markdown" HideControls="true" InitialData=""/>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<WButton CssClasses="btn btn-primary text-end"
|
||||
OnClick="Save"
|
||||
Text="@SmartTranslateService.Translate("Save")"
|
||||
WorkingText="@SmartTranslateService.Translate("Saving...")">
|
||||
</WButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code
|
||||
{
|
||||
|
@ -44,9 +44,9 @@
|
|||
private async Task Save()
|
||||
{
|
||||
Model.Markdown = await FileEditor.GetData();
|
||||
|
||||
|
||||
NewsEntryRepository.Add(Model);
|
||||
|
||||
|
||||
NavigationManager.NavigateTo("/admin/system/news");
|
||||
}
|
||||
}
|
|
@ -11,26 +11,26 @@
|
|||
@inject ConfigService ConfigService
|
||||
@inject AlertService AlertService
|
||||
|
||||
<OnlyAdmin>
|
||||
<AdminSystemNavigation Index="5"/>
|
||||
@attribute [PermissionRequired(nameof(Permissions.SystemResources))]
|
||||
|
||||
<div class="card card-body mb-6">
|
||||
<div class="text-end">
|
||||
<WButton CssClasses="btn btn-primary"
|
||||
Text="@(SmartTranslateService.Translate("Reload config"))"
|
||||
WorkingText="@(SmartTranslateService.Translate("Reloading"))"
|
||||
OnClick="ReloadConfig">
|
||||
</WButton>
|
||||
</div>
|
||||
<AdminSystemNavigation Index="5"/>
|
||||
|
||||
<div class="card card-body mb-6">
|
||||
<div class="text-end">
|
||||
<WButton CssClasses="btn btn-primary"
|
||||
Text="@(SmartTranslateService.Translate("Reload config"))"
|
||||
WorkingText="@(SmartTranslateService.Translate("Reloading"))"
|
||||
OnClick="ReloadConfig">
|
||||
</WButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card card-body">
|
||||
<FileManager Access="@(new HostFileAccess(PathBuilder.Dir("storage")))">
|
||||
</FileManager>
|
||||
</div>
|
||||
</OnlyAdmin>
|
||||
<div class="card card-body">
|
||||
<FileManager Access="@(new HostFileAccess(PathBuilder.Dir("storage")))">
|
||||
</FileManager>
|
||||
</div>
|
||||
|
||||
@code
|
||||
@code
|
||||
{
|
||||
private async Task ReloadConfig()
|
||||
{
|
||||
|
|
|
@ -13,48 +13,48 @@
|
|||
@inject EventSystem Event
|
||||
@inject ToastService ToastService
|
||||
|
||||
<OnlyAdmin>
|
||||
<AdminSystemNavigation Index="3"/>
|
||||
@attribute [PermissionRequired(nameof(Permissions.SystemSecurity))]
|
||||
|
||||
<div class="card mb-5">
|
||||
<div class="card-header">
|
||||
<div class="card-title">
|
||||
<TL>Ip Bans</TL>
|
||||
</div>
|
||||
<div class="card-toolbar">
|
||||
<table class="w-100">
|
||||
<tr>
|
||||
<td class="w-100">
|
||||
<input @bind="Ip" type="text" class="form-control" placeholder="@(SmartTranslateService.Translate("Enter a ip"))"/>
|
||||
</td>
|
||||
<td>
|
||||
<WButton OnClick="AddIpBan"
|
||||
CssClasses="btn btn-primary ms-2"
|
||||
Text="@(SmartTranslateService.Translate("Add"))"
|
||||
WorkingText="@(SmartTranslateService.Translate("Adding"))">
|
||||
</WButton>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<AdminSystemNavigation Index="3"/>
|
||||
|
||||
<div class="card mb-5">
|
||||
<div class="card-header">
|
||||
<div class="card-title">
|
||||
<TL>Ip Bans</TL>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<LazyLoader @ref="LazyLoader" Load="Load">
|
||||
<Table TableItem="IpBan" Items="IpBans" PageSize="25" TableClass="table table-row-bordered table-row-gray-100 align-middle gs-0 gy-3" TableHeadClass="fw-bold text-muted">
|
||||
<Column TableItem="IpBan" Title="@(SmartTranslateService.Translate("Ip"))" Field="@(x => x.Ip)" Filterable="true" Sortable="false"/>
|
||||
<Column TableItem="IpBan" Title="" Field="@(x => x.Id)" Filterable="false" Sortable="false">
|
||||
<Template>
|
||||
<div class="text-end">
|
||||
<DeleteButton Confirm="true" OnClick="() => DeleteIpBan(context)"></DeleteButton>
|
||||
</div>
|
||||
</Template>
|
||||
</Column>
|
||||
<Pager ShowPageNumber="true" ShowTotalCount="true"/>
|
||||
</Table>
|
||||
</LazyLoader>
|
||||
<div class="card-toolbar">
|
||||
<table class="w-100">
|
||||
<tr>
|
||||
<td class="w-100">
|
||||
<input @bind="Ip" type="text" class="form-control" placeholder="@(SmartTranslateService.Translate("Enter a ip"))"/>
|
||||
</td>
|
||||
<td>
|
||||
<WButton OnClick="AddIpBan"
|
||||
CssClasses="btn btn-primary ms-2"
|
||||
Text="@(SmartTranslateService.Translate("Add"))"
|
||||
WorkingText="@(SmartTranslateService.Translate("Adding"))">
|
||||
</WButton>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</OnlyAdmin>
|
||||
<div class="card-body">
|
||||
<LazyLoader @ref="LazyLoader" Load="Load">
|
||||
<Table TableItem="IpBan" Items="IpBans" PageSize="25" TableClass="table table-row-bordered table-row-gray-100 align-middle gs-0 gy-3" TableHeadClass="fw-bold text-muted">
|
||||
<Column TableItem="IpBan" Title="@(SmartTranslateService.Translate("Ip"))" Field="@(x => x.Ip)" Filterable="true" Sortable="false"/>
|
||||
<Column TableItem="IpBan" Title="" Field="@(x => x.Id)" Filterable="false" Sortable="false">
|
||||
<Template>
|
||||
<div class="text-end">
|
||||
<DeleteButton Confirm="true" OnClick="() => DeleteIpBan(context)"></DeleteButton>
|
||||
</div>
|
||||
</Template>
|
||||
</Column>
|
||||
<Pager ShowPageNumber="true" ShowTotalCount="true"/>
|
||||
</Table>
|
||||
</LazyLoader>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code
|
||||
{
|
||||
|
@ -83,7 +83,7 @@
|
|||
|
||||
Ip = "";
|
||||
await InvokeAsync(StateHasChanged);
|
||||
|
||||
|
||||
await Event.Emit("ipBan.update");
|
||||
|
||||
await ToastService.Success(
|
||||
|
|
|
@ -3,33 +3,33 @@
|
|||
@using Moonlight.Shared.Components.Navigations
|
||||
@using global::Sentry
|
||||
|
||||
<OnlyAdmin>
|
||||
<AdminSystemNavigation Index="1"/>
|
||||
@attribute [PermissionRequired(nameof(Permissions.SystemSentry))]
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xxl-6 my-3">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<TL>Status</TL>
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<span class="fs-5">
|
||||
@if (SentrySdk.IsEnabled)
|
||||
{
|
||||
<TL>Sentry is enabled</TL>
|
||||
}
|
||||
else
|
||||
{
|
||||
<TL>Sentry is disabled</TL>
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
<AdminSystemNavigation Index="1"/>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xxl-6 my-3">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<TL>Status</TL>
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<span class="fs-5">
|
||||
@if (SentrySdk.IsEnabled)
|
||||
{
|
||||
<TL>Sentry is enabled</TL>
|
||||
}
|
||||
else
|
||||
{
|
||||
<TL>Sentry is disabled</TL>
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</OnlyAdmin>
|
||||
</div>
|
||||
|
||||
@code
|
||||
{
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
@using Microsoft.AspNetCore.Components.Web.Virtualization
|
||||
@using Microsoft.JSInterop
|
||||
@using Moonlight
|
||||
@using Moonlight.App.Perms
|
||||
@using Moonlight.Shared.Components
|
||||
@using Moonlight.Shared.Components.StateLogic
|
||||
@using Moonlight.Shared.Components.Alerts
|
||||
|
|
Loading…
Reference in a new issue