Files
RRAC/RecRoomArchive/Controllers/API/VersionCheck/V3/VersionCheckController.cs
T
2026-02-27 19:30:49 -08:00

29 lines
1.3 KiB
C#

using Microsoft.AspNetCore.Mvc;
using RecRoomArchive.Models.API.VersionCheck;
using RecRoomArchive.Services;
namespace RecRoomArchive.Controllers.API.VersionCheck.V3
{
/// <summary>
/// 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
/// </summary>
[Route(template: "api/[controller]/v3")]
[ApiController]
public class VersionCheckController(AppVersionService appVersionService) : ControllerBase
{
/// <summary>
/// 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)
/// </summary>
/// <returns>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</returns>
[HttpGet]
public async Task<ActionResult> CheckVersion([FromQuery(Name = "v")] string appVersion)
{
if (appVersion == null)
return BadRequest(new VersionCheckResponse(VersionStatus.UpdateRequired));
await appVersionService.StoreAppVersion(appVersion);
return Ok(new VersionCheckResponse());
}
}
}