using Microsoft.AspNetCore.Mvc; using RecRoomArchive.Models.API.VersionCheck; using RecRoomArchive.Services; namespace RecRoomArchive.Controllers.API.VersionCheck.V3 { /// /// Endpoints used to check if the version the player is playing on is up to date enough to play Rec Room, due to this being a custom server, it doesn't really matter /// [Route(template: "api/[controller]/v3")] [ApiController] public class VersionCheckController(AppVersionService appVersionService) : ControllerBase { /// /// Checks if the appVersion provided is allowed to play (which it most certainly will be unless its a weird build or someone messed with it) /// /// A valid VersionCheckResponse if the version is valid, an invalid VersionCheckResponse if it is not. Forbid will yield the client displaying "Rec Room Update Required" soo maybe don't [HttpGet] public async Task CheckVersion([FromQuery(Name = "v")] string appVersion) { if (appVersion == null) return BadRequest(new VersionCheckResponse(VersionStatus.UpdateRequired)); await appVersionService.StoreAppVersion(appVersion); return Ok(new VersionCheckResponse()); } } }