Fix a layout.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using Aiursoft.AiurObserver;
|
||||
using Aiursoft.ChessServer.Data;
|
||||
using Aiursoft.ChessServer.Models;
|
||||
using Aiursoft.CSTools.Services;
|
||||
using Aiursoft.WebTools.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Aiursoft.ChessServer.Controllers;
|
||||
@@ -144,4 +146,30 @@ public class HomeController : Controller
|
||||
}
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
|
||||
public async Task ListenChallenge(int id)
|
||||
{
|
||||
var pusher = await HttpContext.AcceptWebSocketClient();
|
||||
var challenge = _database.GetChallenge(id);
|
||||
if (challenge == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var outSub = challenge
|
||||
.ChallengeChangedChannel
|
||||
.Subscribe(t => pusher.Send(t, HttpContext.RequestAborted));
|
||||
try
|
||||
{
|
||||
await pusher.Listen(HttpContext.RequestAborted);
|
||||
}
|
||||
catch (TaskCanceledException)
|
||||
{
|
||||
// Ignore. This happens when the client closes the connection.
|
||||
}
|
||||
finally
|
||||
{
|
||||
await pusher.Close(HttpContext.RequestAborted);
|
||||
outSub.Unsubscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
@model int
|
||||
|
||||
<div class="row">
|
||||
<vc:chess-board game-id="@Model"></vc:chess-board>
|
||||
</div>
|
||||
<div class="container mt-5">
|
||||
<main role="main" class="pb-3">
|
||||
<div class="row">
|
||||
<vc:chess-board game-id="@Model"></vc:chess-board>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user