mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-26 07:28:45 -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:
@@ -51,6 +51,7 @@ public class StorefrontsBuyController(
|
||||
public int GiftContext { get; set; }
|
||||
}
|
||||
|
||||
[HttpPost("api/storefronts/v1/buyItem")]
|
||||
[HttpPost("api/storefronts/v2/buyItem")]
|
||||
public async Task<IActionResult> BuyItem([FromBody] RequestPurchaseItemDto req)
|
||||
{
|
||||
@@ -170,6 +171,7 @@ public class StorefrontsBuyController(
|
||||
isGift ? null : gift.Id));
|
||||
}
|
||||
|
||||
[HttpPost("api/storefronts/v1/buyTier")]
|
||||
[HttpPost("api/storefronts/v2/buyTier")]
|
||||
public async Task<IActionResult> BuyTier([FromBody] RequestPurchaseItemDto req)
|
||||
{
|
||||
@@ -185,6 +187,7 @@ public class StorefrontsBuyController(
|
||||
return Ok(BalanceUpdateResponse(newBalance, req.CurrencyType));
|
||||
}
|
||||
|
||||
[HttpPost("api/storefronts/v1/buyElite")]
|
||||
[HttpPost("api/storefronts/v2/buyElite")]
|
||||
public async Task<IActionResult> BuyElite([FromBody] RequestPurchaseItemDto req)
|
||||
{
|
||||
|
||||
@@ -116,15 +116,16 @@ public class StorefrontsController(
|
||||
{
|
||||
var pid = this.RequireCurrentPlayerId();
|
||||
var balance = await level.GetBalanceAsync(pid, currencyType);
|
||||
return Ok(new[]
|
||||
// 2018 client (RecNet.cs:94092, KKBGNKJHGJF<BalanceResponseDTO>) parses a
|
||||
// SINGLE object reading Balance(long)+CurrencyType(int) off the root —
|
||||
// reading "Balance" off an array root throws. This branch is 2018-only,
|
||||
// so the per-currency balance returns a single object, not an array.
|
||||
return Ok(new
|
||||
{
|
||||
new
|
||||
{
|
||||
CurrencyType = currencyType,
|
||||
BalanceType = 0,
|
||||
Balance = balance,
|
||||
Platform = 0,
|
||||
},
|
||||
CurrencyType = currencyType,
|
||||
BalanceType = 0,
|
||||
Balance = balance,
|
||||
Platform = 0,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user