mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-26 15:38:45 -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.
31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
using DorkNet.Models.Auth;
|
|
using DorkNet.Server.Data.Entities;
|
|
|
|
namespace DorkNet.Server.Compat2018;
|
|
|
|
/// <summary>
|
|
/// Maps a <see cref="PlayerEntity"/> to the June-2018 wire player object
|
|
/// (<see cref="Player2018"/>). Lives in the server (not DorkNet.Models) because
|
|
/// the DTO project can't reference the data-layer entity. Shared by the
|
|
/// platformlogin/v1, players/v1, and presence controllers so the 2018 player
|
|
/// shape is produced in exactly one place.
|
|
/// Keys verified against RecNet.EEBPLECPEGD.Deserialize (RecNet.cs:64632).
|
|
/// </summary>
|
|
public static class Player2018Mapper
|
|
{
|
|
public static Player2018 From(PlayerEntity p) => new()
|
|
{
|
|
Id = p.Id,
|
|
Username = p.Username,
|
|
DisplayName = string.IsNullOrEmpty(p.DisplayName) ? p.Username : p.DisplayName,
|
|
Bio = p.Bio ?? string.Empty,
|
|
XP = p.XP,
|
|
Level = p.Level,
|
|
Developer = p.IsDeveloper,
|
|
CanReceiveInvites = p.CanReceiveInvites,
|
|
ProfileImageName = p.ProfileImageName ?? string.Empty,
|
|
JuniorProfile = p.IsJunior,
|
|
HasBirthday = p.Birthday.HasValue,
|
|
};
|
|
}
|