mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-25 23:18:44 -07:00
Import december-2020-12-18 from private repo (scrubbed 2026-05-27)
Targets Rec Room 2020.12.18 client.
Re-import after adding:
- DorkNet.ClientMod/dorknet-clientmod.json.template — config schema
the launcher's manifest-driven patcher renders into UserData/.
- tools/build-patcher-zip.ps1 — produces the dorknet-clientpatch-{key}.zip
Release asset the launcher fetches.
- .github/workflows/release.yml — auto-publishes both Release assets
on v1-december-* tag push.
Scrubbed via maintainer-side scrub-for-public.ps1: same drop rules as
the prior import, plus build-patcher-zip.ps1 added to the tools/
allow-list so it survives the scrub.
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using DorkNet.Server.Services;
|
||||
|
||||
namespace DorkNet.Server.Controllers.API.Announcements;
|
||||
|
||||
/// <summary>
|
||||
/// api.{rec.net,localhost}/api/announcement/v{1,2}/get — fetches the
|
||||
/// current server announcement (shown on the watch's home tab). The
|
||||
/// payload is sourced from <see cref="CommunityBoardService"/> so the
|
||||
/// admin SPA's "edit announcement" form is the single place to
|
||||
/// update what players see.
|
||||
///
|
||||
/// Wire shape per <c>RecNet/AnnouncementDTO.cs</c> — AnnouncementId,
|
||||
/// AnnouncementType, LinkType, Platform are all required via
|
||||
/// <c>Util.GetKey</c> (throws on miss); Title/Body/ImageName/LinkName/
|
||||
/// LinkUri/CreatedAt are GetKeyOrDefault.
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
public class AnnouncementsController(CommunityBoardService communityBoard) : ControllerBase
|
||||
{
|
||||
[HttpGet("api/announcement/v1/get")]
|
||||
[HttpGet("api/announcement/v2/get")]
|
||||
public async Task<IActionResult> Current()
|
||||
{
|
||||
var board = await communityBoard.GetAsync();
|
||||
var ann = board.CurrentAnnouncement;
|
||||
if (ann is null) return Ok(Array.Empty<object>());
|
||||
return Ok(new[]
|
||||
{
|
||||
new
|
||||
{
|
||||
AnnouncementId = 1L,
|
||||
AnnouncementType = 0,
|
||||
Title = "Server Announcement",
|
||||
Body = ann.Message ?? string.Empty,
|
||||
ImageName = "",
|
||||
LinkType = 0,
|
||||
LinkName = "",
|
||||
LinkUri = ann.MoreInfoUrl ?? string.Empty,
|
||||
Platform = 0,
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user