Revert "Merge pull request #106 from Moonlight-Panel/DiscordBot"
This reverts commitf71fcc0f5d, reversing changes made toe0bea9b61c.
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
@using Moonlight.Shared.Components.ErrorBoundaries
|
||||
@using Moonlight.Shared.Components.Partials
|
||||
@using Moonlight.Shared.Components.Alerts
|
||||
@using Moonlight.Shared.Components.Auth
|
||||
@using Moonlight.App.Database.Entities
|
||||
@using Moonlight.App.Extensions
|
||||
@@ -8,7 +6,7 @@
|
||||
@using Moonlight.App.Services
|
||||
@using Moonlight.App.Services.Interop
|
||||
@using Moonlight.App.Services.Sessions
|
||||
@using Logging.Net
|
||||
@using Moonlight.App.Events
|
||||
|
||||
@layout ThemeInit
|
||||
@implements IDisposable
|
||||
@@ -18,8 +16,9 @@
|
||||
@inject IdentityService IdentityService
|
||||
@inject SessionService SessionService
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject MessageService MessageService
|
||||
@inject EventSystem Event
|
||||
@inject ToastService ToastService
|
||||
@inject SmartTranslateService SmartTranslateService
|
||||
|
||||
<GlobalErrorBoundary>
|
||||
@{
|
||||
@@ -60,52 +59,69 @@
|
||||
<div id="kt_app_content_container" class="app-container container-fluid">
|
||||
<div class="mt-10">
|
||||
<SoftErrorBoundary>
|
||||
@if (uri.LocalPath != "/login" &&
|
||||
uri.LocalPath != "/passwordreset" &&
|
||||
uri.LocalPath != "/register")
|
||||
@if (UserProcessed)
|
||||
{
|
||||
if (User == null)
|
||||
@if (uri.LocalPath != "/login" &&
|
||||
uri.LocalPath != "/passwordreset" &&
|
||||
uri.LocalPath != "/register")
|
||||
{
|
||||
<Login></Login>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (User.Status == UserStatus.Banned)
|
||||
if (User == null)
|
||||
{
|
||||
<BannedAlert></BannedAlert>
|
||||
}
|
||||
else if (User.Status == UserStatus.Disabled)
|
||||
{
|
||||
<DisabledAlert></DisabledAlert>
|
||||
}
|
||||
else if (User.Status == UserStatus.PasswordPending)
|
||||
{
|
||||
<PasswordChangeView></PasswordChangeView>
|
||||
}
|
||||
else if (User.Status == UserStatus.DataPending)
|
||||
{
|
||||
<UserDataSetView></UserDataSetView>
|
||||
<Login></Login>
|
||||
}
|
||||
else
|
||||
{
|
||||
@Body
|
||||
if (User.Status == UserStatus.Banned)
|
||||
{
|
||||
<BannedAlert></BannedAlert>
|
||||
}
|
||||
else if (User.Status == UserStatus.Disabled)
|
||||
{
|
||||
<DisabledAlert></DisabledAlert>
|
||||
}
|
||||
else if (User.Status == UserStatus.PasswordPending)
|
||||
{
|
||||
<PasswordChangeView></PasswordChangeView>
|
||||
}
|
||||
else if (User.Status == UserStatus.DataPending)
|
||||
{
|
||||
<UserDataSetView></UserDataSetView>
|
||||
}
|
||||
else
|
||||
{
|
||||
@Body
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (uri.LocalPath == "/login")
|
||||
{
|
||||
<Login></Login>
|
||||
}
|
||||
else if (uri.LocalPath == "/register")
|
||||
{
|
||||
<Register></Register>
|
||||
}
|
||||
else if (uri.LocalPath == "/passwordreset")
|
||||
{
|
||||
<PasswordReset></PasswordReset>
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (uri.LocalPath == "/login")
|
||||
{
|
||||
<Login></Login>
|
||||
}
|
||||
else if (uri.LocalPath == "/register")
|
||||
{
|
||||
<Register></Register>
|
||||
}
|
||||
else if (uri.LocalPath == "/passwordreset")
|
||||
{
|
||||
<PasswordReset></PasswordReset>
|
||||
}
|
||||
<div class="modal d-block">
|
||||
<div class="modal-dialog modal-dialog-centered mw-900px">
|
||||
<div class="modal-content">
|
||||
<div class="pt-2 modal-body py-lg-10 px-lg-10">
|
||||
|
||||
<h2>@(SmartTranslateService.Translate("Authenticating"))...</h2>
|
||||
<p class="mt-3 fw-normal fs-6">@(SmartTranslateService.Translate("Verifying token, loading user data"))</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</SoftErrorBoundary>
|
||||
</div>
|
||||
@@ -123,6 +139,7 @@
|
||||
@code
|
||||
{
|
||||
private User? User;
|
||||
private bool UserProcessed = false;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
@@ -153,6 +170,7 @@
|
||||
try
|
||||
{
|
||||
User = await IdentityService.Get();
|
||||
UserProcessed = true;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
|
||||
await JsRuntime.InvokeVoidAsync("document.body.removeAttribute", "data-kt-app-reset-transition");
|
||||
@@ -160,22 +178,23 @@
|
||||
await JsRuntime.InvokeVoidAsync("KTMenu.createInstances");
|
||||
await JsRuntime.InvokeVoidAsync("KTDrawer.createInstances");
|
||||
|
||||
//await JsRuntime.InvokeVoidAsync("createSnow");
|
||||
|
||||
await SessionService.Register();
|
||||
|
||||
NavigationManager.LocationChanged += (sender, args) => { SessionService.Refresh(); };
|
||||
|
||||
MessageService.Subscribe<MainLayout, SupportMessage>(
|
||||
$"support.{User.Id}.message",
|
||||
this,
|
||||
async message =>
|
||||
{
|
||||
if (!NavigationManager.Uri.EndsWith("/support") && (message.IsSupport || message.IsSystem))
|
||||
if (User != null)
|
||||
{
|
||||
await Event.On<SupportChatMessage>(
|
||||
$"supportChat.{User.Id}.message",
|
||||
this,
|
||||
async message =>
|
||||
{
|
||||
await ToastService.Info($"Support: {message.Message}");
|
||||
}
|
||||
});
|
||||
if (!NavigationManager.Uri.EndsWith("/support") && message.Sender != User)
|
||||
{
|
||||
await ToastService.Info($"Support: {message.Content}");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
RunDelayedMenu(0);
|
||||
RunDelayedMenu(1);
|
||||
@@ -189,13 +208,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
public async void Dispose()
|
||||
{
|
||||
SessionService.Close();
|
||||
|
||||
if (User != null)
|
||||
{
|
||||
MessageService.Unsubscribe($"support.{User.Id}.message", this);
|
||||
await Event.Off($"supportChat.{User.Id}.message", this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user