mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-25 23:18:44 -07:00
579071858a
- Implemented new search endpoints for rooms to accommodate the 2018 client. - Added support for retrieving room details and featured rooms in a format compatible with the 2018 client. - Introduced new data models for login responses and player presence specific to the 2018 client. - Created mappers to convert between internal entities and the 2018 wire formats for players and rooms. - Updated existing storefront APIs to include versioned endpoints for the 2018 client. - Enhanced the version controller to return dual-format responses for compatibility with both 2018 and 2020 clients. - Refactored the configuration service to ensure trailing slashes in URLs for the 2018 client.
32 lines
1.3 KiB
C#
32 lines
1.3 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace DorkNet.Server.Controllers.API.Version;
|
|
|
|
[ApiController]
|
|
public class VersionController : ControllerBase
|
|
{
|
|
// VersionStatus enum: ValidForPlay=0, ValidForMenu=1, UpdateRequired=2
|
|
//
|
|
// Dual-shape response so a single endpoint satisfies both client eras:
|
|
// • 2020 build reads the int "VersionStatus" (0 == ValidForPlay).
|
|
// • 2018.06 build (api/versioncheck/v3) reads the bool "ValidVersion"
|
|
// via a case-sensitive dict index (RecNet.cs BPPMLPMDHCI.Deserialize
|
|
// -> Util.GetKey<bool>("ValidVersion")). A MISSING key throws
|
|
// KeyNotFoundException -> the connect coroutine shows "Rec Room
|
|
// update required" and aborts boot before login. Emitting both keys
|
|
// keeps each era reading only the field it knows.
|
|
private static readonly object ValidForPlay = new { VersionStatus = 0, ValidVersion = true };
|
|
|
|
[HttpGet("api/version/v1")]
|
|
[HttpGet("api/version")]
|
|
public ActionResult<object> GetV1() => Ok(ValidForPlay);
|
|
|
|
// Actual path the 2020 build uses
|
|
[HttpGet("api/versioncheck/v4")]
|
|
[HttpGet("api/versioncheck/v3")]
|
|
[HttpGet("api/versioncheck/v2")]
|
|
[HttpGet("api/versioncheck/v1")]
|
|
[HttpGet("api/versioncheck")]
|
|
public ActionResult<object> GetCheck() => Ok(ValidForPlay);
|
|
}
|