fix(gateway): use Korean server labels by default

This commit is contained in:
2026-08-13 16:28:04 +00:00
parent b6add2930b
commit d03160a4b3
5 changed files with 51 additions and 6 deletions
+2 -2
View File
@@ -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',
};
}
+18
View File
@@ -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 },
+1 -1
View File
@@ -366,7 +366,7 @@ describe('admin profile navigation API', () => {
profile: 'che',
instanceKey: '2',
currentScenario: '2',
meta: {},
meta: { korName: '체' },
},
]);
expect(harness.getRuntimeStateListCount()).toBe(0);
+28 -1
View File
@@ -1,6 +1,11 @@
import { describe, expect, it } from 'vitest';
import { GATEWAY_PROFILE_ORDER, orderGatewayProfiles } from '../src/profileOrder.js';
import {
GATEWAY_PROFILE_KOREAN_NAMES,
GATEWAY_PROFILE_ORDER,
orderGatewayProfiles,
resolveGatewayProfileKoreanName,
} from '../src/profileOrder.js';
describe('orderGatewayProfiles', () => {
it('uses the public server order instead of alphabetical profile order', () => {
@@ -29,3 +34,25 @@ describe('orderGatewayProfiles', () => {
expect(profiles[0]?.profile).toBe('zeta');
});
});
describe('resolveGatewayProfileKoreanName', () => {
it('uses the canonical Korean labels for every public profile', () => {
expect(GATEWAY_PROFILE_ORDER.map((profile) => resolveGatewayProfileKoreanName(profile))).toEqual(
GATEWAY_PROFILE_ORDER.map((profile) => GATEWAY_PROFILE_KOREAN_NAMES[profile])
);
expect(GATEWAY_PROFILE_ORDER.map((profile) => `${resolveGatewayProfileKoreanName(profile)}`)).toEqual([
'체섭',
'퀘섭',
'풰섭',
'퉤섭',
'냐섭',
'퍄섭',
'훼섭',
]);
});
it('preserves configured and unknown profile names', () => {
expect(resolveGatewayProfileKoreanName('che', ' 천하서버 ')).toBe('천하서버');
expect(resolveGatewayProfileKoreanName('custom')).toBe('custom');
});
});