mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-26 07:28:45 -07:00
d471b418b9
Targets Rec Room 2020.03.10 client (also serves 2020.03.06).
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 dorknet-clientpatch-{key}.zip
for v1-march-* Release uploads.
- .github/workflows/release.yml — on tag push publishes both
dorknet-server-march_2020_03_10-win-x64.zip and
dorknet-clientpatch-march_2020_03_10.zip as Release assets.
Same scrub rules as december; tools/build-patcher-zip.ps1 added to
the maintainer-side allow-list so it survives.
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,
|
|
});
|
|
}
|
|
}
|