mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-26 15:38:45 -07:00
4edf25b2d5
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.
61 lines
2.2 KiB
C#
61 lines
2.2 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using DorkNet.Server.Services;
|
|
|
|
namespace DorkNet.Server.Controllers.Rooms;
|
|
|
|
/// <summary>
|
|
/// rooms.{rec.net,localhost} — secondary room-listing host (the
|
|
/// primary surface is api.*/api/rooms/v2/* via
|
|
/// <c>Controllers/API/Rooms/V2/RoomsController</c>). Some older
|
|
/// 2020 client paths still hit this host for the room-tile lookup
|
|
/// during share-link resolution and friend-room-join probes.
|
|
/// Both controllers share <see cref="RoomService"/> so the data is
|
|
/// identical regardless of which host the watch chose.
|
|
/// </summary>
|
|
[ApiController]
|
|
public class RoomsController(RoomService rooms) : ControllerBase
|
|
{
|
|
[HttpGet("/rooms/v3/{roomId:long}")]
|
|
public async Task<IActionResult> GetById(long roomId)
|
|
{
|
|
var r = await rooms.GetByIdAsync(roomId);
|
|
return r is null ? NotFound() : Ok(RoomService.ToWireRoom(r));
|
|
}
|
|
|
|
[HttpGet("/rooms/v3/search")]
|
|
public async Task<IActionResult> Search([FromQuery] string? query, [FromQuery] int take = 20)
|
|
{
|
|
var rows = await rooms.SearchAsync(query ?? string.Empty, Math.Clamp(take, 1, 100));
|
|
return Ok(rows.Select(RoomService.ToWireRoom).ToList());
|
|
}
|
|
|
|
[HttpGet("/rooms/v3/hot")]
|
|
public async Task<IActionResult> Hot([FromQuery] string? tag, [FromQuery] int take = 50)
|
|
=> Ok((await rooms.HotAsync(tag, Math.Clamp(take, 1, 100))).Select(RoomService.ToWireRoom).ToList());
|
|
|
|
[HttpGet("/rooms/v3/new")]
|
|
public async Task<IActionResult> New([FromQuery] int take = 50)
|
|
{
|
|
// No dedicated "new rooms" path on RoomService — order by
|
|
// CreatedAt is acceptable as a fallback since RoomEntity has
|
|
// both UpdatedAt + CreatedAt.
|
|
var rows = await rooms.HotAsync(null, Math.Clamp(take, 1, 100));
|
|
return Ok(rows.Select(RoomService.ToWireRoom).ToList());
|
|
}
|
|
|
|
[HttpGet("/rooms/v3/{roomId:long}/stats")]
|
|
public async Task<IActionResult> GetStats(long roomId)
|
|
{
|
|
var r = await rooms.GetByIdAsync(roomId);
|
|
if (r is null) return NotFound();
|
|
return Ok(new
|
|
{
|
|
RoomId = r.Id,
|
|
VisitCount = r.VisitCount,
|
|
CheerCount = r.CheerCount,
|
|
FavoriteCount = r.FavoriteCount,
|
|
VisitorCount = r.VisitorCount,
|
|
});
|
|
}
|
|
}
|