Merge branch 'main' into StatisticSystem
This commit is contained in:
@@ -37,7 +37,7 @@ public class User
|
||||
public DateTime TokenValidTime { get; set; } = DateTime.Now;
|
||||
|
||||
// Discord
|
||||
public long DiscordId { get; set; } = -1;
|
||||
public ulong DiscordId { get; set; }
|
||||
|
||||
// Date stuff
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
@@ -115,7 +115,7 @@ public class DiscordOAuth2Service
|
||||
Email = getData.GetValue<string>("email"),
|
||||
FirstName = "User",
|
||||
LastName = "User",
|
||||
DiscordId = getData.GetValue<long>("id"),
|
||||
DiscordId = getData.GetValue<ulong>("id"),
|
||||
Status = UserStatus.DataPending
|
||||
};
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class UserService
|
||||
State = "",
|
||||
Status = UserStatus.Unverified,
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
DiscordId = -1,
|
||||
DiscordId = 0,
|
||||
TotpEnabled = false,
|
||||
TotpSecret = "",
|
||||
UpdatedAt = DateTime.UtcNow,
|
||||
|
||||
@@ -52,14 +52,6 @@ else
|
||||
<span class="menu-title"><TL>Websites</TL></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="menu-item">
|
||||
<a class="menu-link" href="/databases">
|
||||
<span class="menu-icon">
|
||||
<i class="bx bx-data"></i>
|
||||
</span>
|
||||
<span class="menu-title"><TL>Databases</TL></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="menu-item">
|
||||
<a class="menu-link" href="/domains">
|
||||
<span class="menu-icon">
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
@using Moonlight.App.Repositories.Servers
|
||||
@using Moonlight.Shared.Components.FileManagerPartials
|
||||
@using Moonlight.App.Database.Entities
|
||||
@using Moonlight.App.Helpers
|
||||
@using Moonlight.App.Helpers.Files
|
||||
@using Moonlight.App.Services
|
||||
|
||||
@inject ServerRepository ServerRepository
|
||||
@inject WingsApiHelper WingsApiHelper
|
||||
@inject SmartTranslateService SmartTranslateService
|
||||
@inject ServerService ServerService
|
||||
|
||||
<div class="col">
|
||||
<div class="card card-body">
|
||||
@@ -42,14 +41,9 @@
|
||||
private FileSelectModal FileSelectModal;
|
||||
private LazyLoader LazyLoader;
|
||||
|
||||
protected override void OnInitialized()
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Access = new WingsFileAccess(WingsApiHelper,
|
||||
null!,
|
||||
CurrentServer,
|
||||
null!,
|
||||
null!
|
||||
);
|
||||
Access = await ServerService.CreateFileAccess(CurrentServer, null!);
|
||||
}
|
||||
|
||||
private async Task Load(LazyLoader lazyLoader)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
@using Moonlight.App.Services
|
||||
|
||||
@inject ServerRepository ServerRepository
|
||||
@inject WingsApiHelper WingsApiHelper
|
||||
@inject ServerService ServerService
|
||||
@inject SmartTranslateService SmartTranslateService
|
||||
|
||||
<div class="col">
|
||||
@@ -42,14 +42,9 @@
|
||||
private FileSelectModal FileSelectModal;
|
||||
private LazyLoader LazyLoader;
|
||||
|
||||
protected override void OnInitialized()
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Access = new WingsFileAccess(WingsApiHelper,
|
||||
null!,
|
||||
CurrentServer,
|
||||
null!,
|
||||
null!
|
||||
);
|
||||
Access = await ServerService.CreateFileAccess(CurrentServer, null!);
|
||||
}
|
||||
|
||||
private async Task Load(LazyLoader lazyLoader)
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
@inject SmartTranslateService SmartTranslateService
|
||||
@inject AlertService AlertService
|
||||
@inject ToastService ToastService
|
||||
@inject WingsApiHelper WingsApiHelper
|
||||
@inject ConfigService ConfigService
|
||||
@inject ServerService ServerService
|
||||
|
||||
<WButton Text="@(SmartTranslateService.Translate("Reset"))"
|
||||
@@ -35,13 +33,7 @@
|
||||
{
|
||||
await ToastService.CreateProcessToast("serverReset", SmartTranslateService.Translate("Resetting server"));
|
||||
|
||||
var access = new WingsFileAccess(
|
||||
WingsApiHelper,
|
||||
null!,
|
||||
CurrentServer,
|
||||
ConfigService,
|
||||
null!
|
||||
);
|
||||
var access = await ServerService.CreateFileAccess(CurrentServer, null!);
|
||||
|
||||
var files = await access.Ls();
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
@page "/admin"
|
||||
@using Moonlight.App.Repositories.Servers
|
||||
@using Moonlight.App.Repositories
|
||||
@using Moonlight.App.Repositories.Domains
|
||||
|
||||
@inject ServerRepository ServerRepository
|
||||
@inject UserRepository UserRepository
|
||||
@inject WebsiteRepository WebsiteRepository
|
||||
@inject DomainRepository DomainRepository
|
||||
|
||||
<OnlyAdmin>
|
||||
<LazyLoader Load="Load">
|
||||
@@ -38,7 +41,7 @@
|
||||
<TL>Websites</TL>
|
||||
</h6>
|
||||
<span class="h2 mb-0">
|
||||
0
|
||||
@(WebsiteCount)
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
@@ -50,27 +53,6 @@
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 col-xl">
|
||||
<div class="mt-4 card" href="/databases">
|
||||
<div class="card-body">
|
||||
<div class="row align-items-center gx-0">
|
||||
<div class="col">
|
||||
<h6 class="text-uppercase text-muted mb-2">
|
||||
<TL>Databases</TL>
|
||||
</h6>
|
||||
<span class="h2 mb-0">
|
||||
@(DatabaseCount)
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<span class="h2 text-muted mb-0">
|
||||
<i class="text-primary bx bx-data bx-lg"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 col-xl">
|
||||
<a class="mt-4 card" href="/domains">
|
||||
<div class="card-body">
|
||||
@@ -80,7 +62,7 @@
|
||||
<TL>Domains</TL>
|
||||
</h6>
|
||||
<span class="h2 mb-0">
|
||||
0
|
||||
@(DomainCount)
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
@@ -119,15 +101,17 @@
|
||||
|
||||
@code
|
||||
{
|
||||
private int DatabaseCount = 0;
|
||||
private int ServerCount = 0;
|
||||
private int UserCount = 0;
|
||||
private int DomainCount = 0;
|
||||
private int WebsiteCount = 0;
|
||||
|
||||
private Task Load(LazyLoader lazyLoader)
|
||||
{
|
||||
DatabaseCount = 0;
|
||||
ServerCount = ServerRepository.Get().Count();
|
||||
UserCount = UserRepository.Get().Count();
|
||||
DomainCount = DomainRepository.Get().Count();
|
||||
WebsiteCount = WebsiteRepository.Get().Count();
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
@@ -3,8 +3,12 @@
|
||||
@using Moonlight.App.Repositories.Servers
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using Moonlight.App.Database.Entities
|
||||
@using Moonlight.App.Repositories
|
||||
@using Moonlight.App.Repositories.Domains
|
||||
|
||||
@inject ServerRepository ServerRepository
|
||||
@inject WebsiteRepository WebsiteRepository
|
||||
@inject DomainRepository DomainRepository
|
||||
|
||||
<LazyLoader Load="Load">
|
||||
<div class="row mb-5">
|
||||
@@ -38,7 +42,7 @@
|
||||
<TL>Websites</TL>
|
||||
</h6>
|
||||
<span class="h2 mb-0">
|
||||
0
|
||||
@(WebsiteCount)
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
@@ -50,27 +54,6 @@
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 col-xl">
|
||||
<div class="mt-4 card" href="/databases">
|
||||
<div class="card-body">
|
||||
<div class="row align-items-center gx-0">
|
||||
<div class="col">
|
||||
<h6 class="text-uppercase text-muted mb-2">
|
||||
<TL>Databases</TL>
|
||||
</h6>
|
||||
<span class="h2 mb-0">
|
||||
@(DatabaseCount)
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<span class="h2 text-muted mb-0">
|
||||
<i class="text-primary bx bx-data bx-lg"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 col-xl">
|
||||
<a class="mt-4 card" href="/domains">
|
||||
<div class="card-body">
|
||||
@@ -80,7 +63,7 @@
|
||||
<TL>Domains</TL>
|
||||
</h6>
|
||||
<span class="h2 mb-0">
|
||||
0
|
||||
@(DomainCount)
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
@@ -119,20 +102,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="separator mb-2 mt-2"></div>
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="symbol symbol-50px me-3">
|
||||
<i class="bx bx-md bx-data"></i>
|
||||
</div>
|
||||
<div class="d-flex justify-content-start flex-column">
|
||||
<a href="/databases/create" class="text-gray-800 text-hover-primary mb-1 fs-5">
|
||||
<TL>Create a database</TL>
|
||||
</a>
|
||||
<span class="text-gray-400 fw-semibold d-block fs-6">
|
||||
<TL>A quick way to store your data and manage it from all around the world</TL>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="separator mb-2 mt-2"></div>
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="symbol symbol-50px me-3">
|
||||
<i class="bx bx-md bx-globe"></i>
|
||||
@@ -188,20 +157,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="separator mb-2 mt-2"></div>
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="symbol symbol-50px me-3">
|
||||
<i class="bx bx-md bx-data"></i>
|
||||
</div>
|
||||
<div class="d-flex justify-content-start flex-column">
|
||||
<a href="/databases" class="text-gray-800 text-hover-primary mb-1 fs-5">
|
||||
<TL>Manage your databases</TL>
|
||||
</a>
|
||||
<span class="text-gray-400 fw-semibold d-block fs-6">
|
||||
<TL>Insert, delete and update the data in your databases</TL>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="separator mb-2 mt-2"></div>
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="symbol symbol-50px me-3">
|
||||
<i class="bx bx-md bx-globe"></i>
|
||||
@@ -239,16 +194,27 @@
|
||||
[CascadingParameter]
|
||||
public User User { get; set; }
|
||||
|
||||
private int DatabaseCount = 0;
|
||||
private int ServerCount = 0;
|
||||
private int DomainCount = 0;
|
||||
private int WebsiteCount = 0;
|
||||
|
||||
private async Task Load(LazyLoader lazyLoader)
|
||||
private Task Load(LazyLoader lazyLoader)
|
||||
{
|
||||
DatabaseCount = 0;
|
||||
|
||||
ServerCount = ServerRepository
|
||||
.Get()
|
||||
.Include(x => x.Owner)
|
||||
.Count(x => x.Owner.Id == User.Id);
|
||||
|
||||
DomainCount = DomainRepository
|
||||
.Get()
|
||||
.Include(x => x.Owner)
|
||||
.Count(x => x.Owner.Id == User.Id);
|
||||
|
||||
WebsiteCount = WebsiteRepository
|
||||
.Get()
|
||||
.Include(x => x.Owner)
|
||||
.Count(x => x.Owner.Id == User.Id);
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -517,3 +517,4 @@ Day;Day
|
||||
Month;Month
|
||||
Year;Year
|
||||
All time;All time
|
||||
SRV records cannot be updated thanks to the cloudflare api client. Please delete the record and create a new one;SRV records cannot be updated thanks to the cloudflare api client. Please delete the record and create a new one
|
||||
Reference in New Issue
Block a user