diff --git a/DorkNet.Server/Controllers/API/Avatar/V2/AvatarGiftsController.cs b/DorkNet.Server/Controllers/API/Avatar/V2/AvatarGiftsController.cs index 7dd81db..5c57416 100644 --- a/DorkNet.Server/Controllers/API/Avatar/V2/AvatarGiftsController.cs +++ b/DorkNet.Server/Controllers/API/Avatar/V2/AvatarGiftsController.cs @@ -262,7 +262,7 @@ public class AvatarGiftsController( // GiftRarity, GiftContext. Missing any one → KeyNotFoundException // surfaces as "Failed to download gifts: Malformed Response" from // BootSequence and BLOCKS LOGIN. - private static object ToWire(GiftPackageEntity g) => new + public static object ToWire(GiftPackageEntity g) => new { g.Id, g.FromPlayerId, diff --git a/DorkNet.Server/Controllers/Admin/AdminController.cs b/DorkNet.Server/Controllers/Admin/AdminController.cs index 5ce94ee..1a04f3d 100644 --- a/DorkNet.Server/Controllers/Admin/AdminController.cs +++ b/DorkNet.Server/Controllers/Admin/AdminController.cs @@ -2318,31 +2318,7 @@ public class AdminController( // one that ends up invoking the GiftManager popup path. await notifications.NotifyAsync(id, PushNotificationId.GiftPackageReceivedImmediate, - new - { - gift.Id, - gift.FromPlayerId, - gift.AvatarItemType, - AvatarItemDesc = gift.AvatarItemDescOrHairDyeDesc, - gift.AvatarItemDescOrHairDyeDesc, - gift.EquipmentPrefabName, - gift.EquipmentModificationGuid, - gift.CurrencyType, - gift.Currency, - gift.Xp, - gift.Level, - gift.GiftContext, - gift.GiftRarity, - gift.Message, - gift.Platform, - gift.PackageMaterial, - gift.PackageVariant, - gift.Consumed, - gift.IsValid, - gift.ErrorMessage, - gift.SupportsCurrentPlatform, - gift.IsGifted, - }); + DorkNet.Server.Controllers.API.Avatar.V2.AvatarGiftsController.ToWire(gift)); return Ok(new { gift.Id, gift.RecipientPlayerId }); } diff --git a/DorkNet.Server/admin-ui/src/lib/types.ts b/DorkNet.Server/admin-ui/src/lib/types.ts index 6a04cf1..c625a7d 100644 --- a/DorkNet.Server/admin-ui/src/lib/types.ts +++ b/DorkNet.Server/admin-ui/src/lib/types.ts @@ -39,8 +39,19 @@ export interface PlayerDetail extends Player { // matches the host's signing key id). export function profileImageUrl(name: string | null | undefined, width = 96): string | null { if (!name) return null; - const apex = typeof window !== 'undefined' && window.location.host.endsWith('localhost') ? 'localhost' : 'rec.net'; - return `https://img.${apex}/${encodeURIComponent(name)}?width=${width}&cropSquare=1&sig=p1`; + const apex = adminApex(); + const scheme = apex === 'localhost' ? 'http' : 'https'; + return `${scheme}://img.${apex}/${encodeURIComponent(name)}?width=${width}&cropSquare=1&sig=p1`; +} + +function adminApex(): string { + if (typeof window === 'undefined') return 'rec.net'; + + const host = window.location.hostname.toLowerCase(); + if (host === 'localhost' || host.endsWith('.localhost')) return 'localhost'; + + const parts = host.split('.'); + return parts.length > 2 ? parts.slice(1).join('.') : host; } export interface Room {