mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-26 07:28:45 -07:00
fa7486915b
Fixes #19 by making the December server advertise notification and service URLs with the configured deployment scheme.
35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using DorkNet.Server.Services;
|
|
|
|
namespace DorkNet.Server.Controllers.API.Notification.V2;
|
|
|
|
/// <summary>
|
|
/// Legacy raw-WebSocket notification endpoint. Replaced by the SignalR
|
|
/// hub at <c>notify.{apex}/hub/v1</c>. Returns 410 Gone for any client
|
|
/// that still tries the old path.
|
|
/// </summary>
|
|
[ApiController]
|
|
[Route("api/[controller]/v2")]
|
|
public class NotificationController(DomainConfig domain) : ControllerBase
|
|
{
|
|
[HttpGet]
|
|
public IActionResult Connect() => StatusCode(StatusCodes.Status410Gone, new
|
|
{
|
|
error = "use_signalr_hub",
|
|
hint = $"connect to {domain.Url("notify", "/hub/v1")} instead",
|
|
});
|
|
|
|
/// <summary>GET <c>api/notification/hub/v1</c> — returns the
|
|
/// SignalR hub URL the client should open. Without this the
|
|
/// watch falls back to its own default and may try the wrong
|
|
/// scheme. URL is built off the configured deployment apex
|
|
/// (DORKNET_DOMAIN).</summary>
|
|
[HttpGet("/api/notification/hub/v1")]
|
|
public IActionResult HubInfo() => Ok(new
|
|
{
|
|
Url = domain.Url("notify", "/hub/v1"),
|
|
Protocol = "signalr",
|
|
Version = 1,
|
|
});
|
|
}
|