mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-25 23:18:44 -07:00
feat: Add support for 2018 client API endpoints and data models
- 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.
This commit is contained in:
@@ -34,9 +34,14 @@ public class PlayerCheerController(
|
||||
[Consumes("application/x-www-form-urlencoded", "multipart/form-data", "application/json")]
|
||||
public async Task<IActionResult> Create(
|
||||
[FromForm(Name = "TargetAccountId")] long? targetAccountId,
|
||||
[FromForm(Name = "Type")] int type = 0)
|
||||
[FromForm(Name = "PlayerIdTo")] long? playerIdTo,
|
||||
[FromForm(Name = "Type")] int type = 0,
|
||||
[FromForm(Name = "CheerCategory")] int? cheerCategory = null)
|
||||
{
|
||||
if (targetAccountId is not long target || target <= 0)
|
||||
// 2018 client posts PlayerIdTo + CheerCategory (RecNet.cs); 2020 posts
|
||||
// TargetAccountId + Type. Accept both.
|
||||
type = cheerCategory ?? type;
|
||||
if ((targetAccountId ?? playerIdTo) is not long target || target <= 0)
|
||||
return Ok(new { success = false, error = "missing_target" });
|
||||
if (Me == target)
|
||||
return Ok(new { success = false, error = "cannot_cheer_self" });
|
||||
@@ -65,8 +70,11 @@ public class PlayerCheerController(
|
||||
/// PlayerSetting key <c>SelectedCheer</c> (string-form int).</summary>
|
||||
[HttpPost("api/PlayerCheer/v1/SetSelectedCheer")]
|
||||
[Consumes("application/x-www-form-urlencoded", "multipart/form-data", "application/json")]
|
||||
public async Task<IActionResult> SetSelectedCheer([FromForm(Name = "Cheer")] int cheer = 0)
|
||||
public async Task<IActionResult> SetSelectedCheer(
|
||||
[FromForm(Name = "Cheer")] int cheer = 0,
|
||||
[FromForm(Name = "CheerCategory")] int? cheerCategory = null)
|
||||
{
|
||||
cheer = cheerCategory ?? cheer; // 2018 sends CheerCategory
|
||||
var existing = await db.PlayerSettings
|
||||
.FirstOrDefaultAsync(s => s.PlayerId == Me && s.Key == "SelectedCheer");
|
||||
if (existing is null)
|
||||
|
||||
Reference in New Issue
Block a user