feat: implement Blazor web interface for GM session management
Deploy Telegram Bot / deploy (push) Has been cancelled
Deploy Telegram Bot / deploy (push) Has been cancelled
- Created GmRelay.Web project (Blazor Server) - Created GmRelay.Shared library for domain models and rendering - Refactored GmRelay.Bot to use the Shared library - Integrated Telegram Login widget with server-side HMAC verification - Added Dashboard, Group Details, and Edit Session pages - Enabled bot notifications and in-place message updates from web actions - Updated .NET Aspire orchestration and Docker Compose configuration
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
@page "/login"
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
@inject NavigationManager Navigation
|
||||
@inject IConfiguration Configuration
|
||||
|
||||
<PageTitle>Login - GM-Relay</PageTitle>
|
||||
|
||||
<div class="container">
|
||||
<div class="row justify-content-center mt-5">
|
||||
<div class="col-md-6 text-center">
|
||||
<h3>GM-Relay Control Panel</h3>
|
||||
<p class="text-muted">Please log in as a Game Master to manage your sessions.</p>
|
||||
|
||||
<div class="mt-4">
|
||||
@if (Navigation.Uri.Contains("error=auth_failed"))
|
||||
{
|
||||
<div class="alert alert-danger">Authentication failed. Please try again.</div>
|
||||
}
|
||||
|
||||
@* Telegram Login Widget *@
|
||||
<div id="telegram-login-container">
|
||||
<script async src="https://telegram.org/js/telegram-widget.js?22"
|
||||
data-telegram-login="@BotUsername"
|
||||
data-size="large"
|
||||
data-auth-url="@AuthUrl"
|
||||
data-request-access="write"></script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private string BotUsername => Configuration["Telegram:BotUsername"] ?? "GmRelayBot";
|
||||
private string AuthUrl => Navigation.ToAbsoluteUri("/auth/telegram").ToString();
|
||||
|
||||
[CascadingParameter]
|
||||
private Task<AuthenticationState>? AuthStateTask { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (AuthStateTask is not null)
|
||||
{
|
||||
var user = (await AuthStateTask).User;
|
||||
if (user.Identity?.IsAuthenticated == true)
|
||||
{
|
||||
Navigation.NavigateTo("/");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user