feat: add user icon library and in-game selection

This commit is contained in:
2026-08-01 03:40:36 +00:00
parent 395b60cdbe
commit a275e6a234
26 changed files with 1214 additions and 69 deletions
+22
View File
@@ -32,6 +32,14 @@ export interface GatewayUserInfo {
canUseGeneralPicture?: boolean;
createdAt?: string;
legacyMemberNo?: number;
icons?: GatewayUserIconInfo[];
}
export interface GatewayUserIconInfo {
id: string;
picture: string;
imageServer: number;
createdAt: string;
}
export interface GameSessionTokenPayload {
@@ -98,6 +106,20 @@ export const parseGameSessionTokenPayload = (value: unknown): GameSessionTokenPa
(user.profileIconResetAt !== undefined &&
(typeof user.profileIconResetAt !== 'string' || !isCanonicalIsoTimestamp(user.profileIconResetAt))) ||
(user.canUseGeneralPicture !== undefined && typeof user.canUseGeneralPicture !== 'boolean') ||
(user.icons !== undefined &&
(!Array.isArray(user.icons) ||
user.icons.length > 5 ||
user.icons.some(
(icon) =>
!icon ||
typeof icon !== 'object' ||
typeof icon.id !== 'string' ||
typeof icon.picture !== 'string' ||
!Number.isSafeInteger(icon.imageServer) ||
icon.imageServer < 0 ||
typeof icon.createdAt !== 'string' ||
!isCanonicalIsoTimestamp(icon.createdAt)
))) ||
(user.legacyMemberNo !== undefined && (!Number.isSafeInteger(user.legacyMemberNo) || user.legacyMemberNo <= 0))
) {
return null;
+6 -1
View File
@@ -212,6 +212,7 @@ export type TurnDaemonCommand =
picture: string;
imageServer: number;
iconRevision: string;
enforceCooldown?: boolean;
}
| {
type: 'joinCreateGeneral';
@@ -254,6 +255,9 @@ export type TurnDaemonCommand =
uniqueName: string;
personality: string;
seedOwnerIdentity: string | number;
ownerPicture?: string;
ownerImageServer?: number;
ownerIconRevision?: string;
}
| {
type: 'selectPoolReselect';
@@ -534,8 +538,9 @@ export type TurnDaemonCommandResult =
| {
type: 'adjustGeneralIcon';
ok: false;
code: 'CONFLICT' | 'PRECONDITION_FAILED';
code: 'CONFLICT' | 'PRECONDITION_FAILED' | 'TOO_MANY_REQUESTS';
reason: string;
availableAt?: string;
}
| {
type: 'joinCreateGeneral';