fix(gateway): use Korean server labels by default
This commit is contained in:
@@ -20,7 +20,7 @@ import {
|
||||
import type { GatewayApiContext } from './context.js';
|
||||
import { resolveLocalAccountProfilePolicy } from './auth/localAccountPolicy.js';
|
||||
import { GATEWAY_BUILD_STATUSES, GATEWAY_PROFILE_STATUSES } from './orchestrator/profileRepository.js';
|
||||
import { orderGatewayProfiles } from './profileOrder.js';
|
||||
import { orderGatewayProfiles, resolveGatewayProfileKoreanName } from './profileOrder.js';
|
||||
import { purifyGatewayNoticeHtml } from './security/gatewayNoticeHtml.js';
|
||||
|
||||
const zProfileStatus = z.enum(GATEWAY_PROFILE_STATUSES);
|
||||
@@ -1585,7 +1585,7 @@ export const adminRouter = router({
|
||||
instanceKey: profile.instanceKey,
|
||||
currentScenario: profile.currentScenario,
|
||||
meta: {
|
||||
...(typeof profile.meta.korName === 'string' ? { korName: profile.meta.korName } : {}),
|
||||
korName: resolveGatewayProfileKoreanName(profile.profile, profile.meta.korName),
|
||||
},
|
||||
}));
|
||||
}),
|
||||
|
||||
@@ -4,7 +4,7 @@ import type {
|
||||
GatewayProfileRepository,
|
||||
GatewayProfileStatus,
|
||||
} from '../orchestrator/profileRepository.js';
|
||||
import { orderGatewayProfiles } from '../profileOrder.js';
|
||||
import { orderGatewayProfiles, resolveGatewayProfileKoreanName } from '../profileOrder.js';
|
||||
|
||||
export type LobbyMapSnapshot = {
|
||||
updatedAt: string | null;
|
||||
@@ -102,7 +102,7 @@ export class RepositoryProfileStatusService implements GatewayProfileStatusServi
|
||||
battleSimRunning: false,
|
||||
tournamentRunning: false,
|
||||
},
|
||||
korName: (meta.korName as string | undefined) ?? row.profile,
|
||||
korName: resolveGatewayProfileKoreanName(row.profile, meta.korName),
|
||||
color: (meta.color as string | undefined) ?? '#ffffff',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,24 @@
|
||||
export const GATEWAY_PROFILE_ORDER = ['che', 'kwe', 'pwe', 'twe', 'nya', 'pya', 'hwe'] as const;
|
||||
|
||||
export const GATEWAY_PROFILE_KOREAN_NAMES = {
|
||||
che: '체',
|
||||
kwe: '퀘',
|
||||
pwe: '풰',
|
||||
twe: '퉤',
|
||||
nya: '냐',
|
||||
pya: '퍄',
|
||||
hwe: '훼',
|
||||
} as const satisfies Record<(typeof GATEWAY_PROFILE_ORDER)[number], string>;
|
||||
|
||||
const gatewayProfileOrder = new Map<string, number>(GATEWAY_PROFILE_ORDER.map((profile, index) => [profile, index]));
|
||||
const gatewayProfileKoreanNames = new Map<string, string>(Object.entries(GATEWAY_PROFILE_KOREAN_NAMES));
|
||||
|
||||
export const resolveGatewayProfileKoreanName = (profile: string, configuredName?: unknown): string => {
|
||||
if (typeof configuredName === 'string' && configuredName.trim()) {
|
||||
return configuredName.trim();
|
||||
}
|
||||
return gatewayProfileKoreanNames.get(profile) ?? profile;
|
||||
};
|
||||
|
||||
export const compareGatewayProfiles = (
|
||||
left: { profile: string; instanceKey: string },
|
||||
|
||||
Reference in New Issue
Block a user