From 617802c11bf92c2f5a62a4972be83a83de55e26b Mon Sep 17 00:00:00 2001 From: hided62 Date: Wed, 19 Aug 2026 11:00:31 +0000 Subject: [PATCH 1/3] =?UTF-8?q?fix(gateway):=20=EC=9D=B4=EB=B2=A4=ED=8A=B8?= =?UTF-8?q?=20=EA=B8=B0=EC=88=98=200=20=EC=A0=80=EC=9E=A5=EC=9D=84=20?= =?UTF-8?q?=ED=97=88=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 숫자 입력에서 Vue가 반환한 number 값을 안전하게 정규화해 다음 시즌 번호 0이 메타 저장 요청까지 전달되도록 수정한다. API 경계와 실제 Chromium payload 회귀 테스트를 추가한다. --- app/gateway-api/test/adminOperations.test.ts | 24 +++++++++++++++++ .../e2e/server-operations.spec.ts | 27 +++++++++++++++++++ app/gateway-frontend/src/views/AdminView.vue | 8 ++++-- docs/admin-console.md | 7 ++++- 4 files changed, 63 insertions(+), 3 deletions(-) diff --git a/app/gateway-api/test/adminOperations.test.ts b/app/gateway-api/test/adminOperations.test.ts index 1e429481..7cef041a 100644 --- a/app/gateway-api/test/adminOperations.test.ts +++ b/app/gateway-api/test/adminOperations.test.ts @@ -789,6 +789,30 @@ describe('admin operation API', () => { ).rejects.toBeDefined(); }); + it('stores event season zero as the next season number', async () => { + const harness = await buildCaller( + async () => { + throw new Error('not used'); + }, + { adminRoles: ['admin.profiles.settings:che:2'], firstUserIsAdmin: false } + ); + + await harness.caller.admin.profiles.updateMeta({ + profileName: 'che:2', + patch: { nextSeasonIdx: 0 }, + reason: 'prepare event season', + }); + expect(harness.updatedMetas.at(-1)).toMatchObject({ nextSeasonIdx: 0 }); + + await expect( + harness.caller.admin.profiles.updateMeta({ + profileName: 'che:2', + patch: { nextSeasonIdx: -1 }, + reason: 'reject negative season', + }) + ).rejects.toBeDefined(); + }); + it('does not let a scenario-only operator combine a Git update with reset', async () => { const harness = await buildCaller( async () => { diff --git a/app/gateway-frontend/e2e/server-operations.spec.ts b/app/gateway-frontend/e2e/server-operations.spec.ts index 911b5c2b..efd9920d 100644 --- a/app/gateway-frontend/e2e/server-operations.spec.ts +++ b/app/gateway-frontend/e2e/server-operations.spec.ts @@ -1040,6 +1040,33 @@ test('edits server reset defaults through profile metadata settings', async ({ p expect(request).toContain('"npcMode":2'); }); +test('stores event season zero from server metadata settings', async ({ page }) => { + const state: FixtureState = { operations: [], gatewayOperations: [], runtimeRunning: true, requestBodies: [] }; + await installFixture(page, state); + + await page.goto('admin/servers/che%3Adefault'); + const nextSeasonInput = page.getByTestId('next-season-idx'); + await nextSeasonInput.fill('0'); + await expect(nextSeasonInput).toHaveValue('0'); + expect( + await nextSeasonInput.evaluate((element: HTMLInputElement) => ({ + valid: element.validity.valid, + valueAsNumber: element.valueAsNumber, + })) + ).toEqual({ valid: true, valueAsNumber: 0 }); + await page.getByPlaceholder('변경 사유 (필수)').fill('prepare event season'); + await page.getByRole('button', { name: '메타 저장' }).click(); + + await expect + .poll(() => state.requestBodies.find((entry) => entry.operation === 'admin.profiles.updateMeta')) + .toBeTruthy(); + const request = JSON.stringify( + state.requestBodies.find((entry) => entry.operation === 'admin.profiles.updateMeta')?.body + ); + expect(request).toContain('"nextSeasonIdx":0'); + await expect(page.getByTestId('action-toast').filter({ hasText: '메타 저장 완료' })).toBeVisible(); +}); + test('shows a dismissible error toast when profile metadata persistence fails', async ({ page }, testInfo) => { const state: FixtureState = { operations: [], diff --git a/app/gateway-frontend/src/views/AdminView.vue b/app/gateway-frontend/src/views/AdminView.vue index 28bb3f68..a78367ef 100644 --- a/app/gateway-frontend/src/views/AdminView.vue +++ b/app/gateway-frontend/src/views/AdminView.vue @@ -407,7 +407,7 @@ const profileEdits = ref< color: string; inGameNotice: string; profileImageUrl: string; - nextSeasonIdx: string; + nextSeasonIdx: string | number; localAccountAccessGraceDays: string; localAccountGeneralCreationGraceDays: string; resetDefaults: ProfileResetDefaults; @@ -770,7 +770,10 @@ const updateProfileMeta = async (profileName: string) => { if (!edit) { return; } - const nextSeasonRaw = edit.nextSeasonIdx.trim(); + // Vue casts non-empty values from type="number" inputs to numbers even when + // the buffer was initialized with a string. Normalize both runtime shapes so + // event season 0 reaches the metadata mutation instead of throwing on trim(). + const nextSeasonRaw = String(edit.nextSeasonIdx).trim(); const nextSeasonIdx = nextSeasonRaw === '' ? null : Number(nextSeasonRaw); if (nextSeasonIdx !== null && (!Number.isFinite(nextSeasonIdx) || nextSeasonIdx < 0)) { profileActionStatus.value = { @@ -2229,6 +2232,7 @@ onMounted(() => { type="number" min="0" step="1" + data-testid="next-season-idx" class="w-full bg-zinc-950 border border-zinc-700 rounded px-3 py-2 text-sm text-white" placeholder="예: 12" /> diff --git a/docs/admin-console.md b/docs/admin-console.md index eeb26f28..9d78b406 100644 --- a/docs/admin-console.md +++ b/docs/admin-console.md @@ -76,6 +76,11 @@ Gateway 관리자 콘솔은 `/gateway/admin`에서 시작합니다. 공개 로 메타가 없거나 유효하지 않으면 기존 시스템 기본값을 사용합니다. 시나리오와 예약·가오픈·정식 오픈 시각은 매 실행마다 선택하므로 서버 기본값에 포함하지 않습니다. +- 서버 상태의 `다음 시즌 번호`는 위 리셋 옵션과 별도의 + `GatewayProfile.meta.nextSeasonIdx`이며 0 이상의 정수를 허용합니다. 이벤트 + 기수는 0을 저장한 뒤 RESET하고, 이벤트 종료 뒤 정상 기수 번호를 다시 저장한 + 다음 RESET합니다. 빈 값은 강제 번호를 해제하여 기존 게임의 season 또는 신규 + 기본값 1을 사용한다는 뜻입니다. - 같은 화면의 `실행 중 게임 옵션`은 리셋 기본값과 별개로 현재 기수 DB의 턴 간격, 장수 생성 제한, 유저 자동턴 제한·동작을 읽어 표시합니다. 세 값은 `admin.profiles.runtime:` 권한과 3자 이상의 사유가 있을 때 하나의 @@ -96,7 +101,7 @@ Gateway 관리자 콘솔은 `/gateway/admin`에서 시작합니다. 공개 로 | `admin.profiles.settings:` | 표시 정보·리셋 기본 옵션·Kakao 미인증 접근/장수 생성 유예 | | `admin.profiles.deploy:` | DB를 유지하는 Git 버전 업데이트, 초기화와 새 버전 결합 | | `admin.scenarios.reset:` | 현재 배포 버전으로 시나리오 초기화 | -| `admin.games.cancel:` | 진행 게임 취소, 기록 옵션과 유산 포인트 보전율 확정 | +| `admin.games.cancel:` | 진행 게임 취소, 기록 옵션과 유산 포인트 보전율 확정 | | `admin.reset.schedule:` | 허용된 시나리오 초기화를 미래 시각에 예약 | | `admin.releases.manage` | profile과 분리된 Gateway control plane 배포·rollback | From 273aab5cf224afa3ed0d5835561d3b760bcdda05 Mon Sep 17 00:00:00 2001 From: hided62 Date: Wed, 19 Aug 2026 11:06:46 +0000 Subject: [PATCH 2/3] =?UTF-8?q?fix(gateway):=20=EC=9E=85=EA=B5=AC=20?= =?UTF-8?q?=EA=B3=B5=EC=A7=80=EC=9D=98=20=EC=9E=90=EC=9C=A8=ED=96=89?= =?UTF-8?q?=EB=8F=99=20=EB=B3=B5=EC=82=AC=EB=A5=BC=20=EB=B3=B5=EC=9B=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/game-api/src/router/lobby/index.ts | 19 +- app/game-api/test/lobbyRouter.test.ts | 49 ++++- .../e2e/lobby-game-auth.spec.ts | 146 ++++++++++++- app/gateway-frontend/src/views/LobbyView.vue | 200 +++++++++++++++--- 4 files changed, 380 insertions(+), 34 deletions(-) diff --git a/app/game-api/src/router/lobby/index.ts b/app/game-api/src/router/lobby/index.ts index 97e800c2..5cfc213c 100644 --- a/app/game-api/src/router/lobby/index.ts +++ b/app/game-api/src/router/lobby/index.ts @@ -1,6 +1,6 @@ import { TRPCError } from '@trpc/server'; -import { asRecord } from '@sammo-ts/common'; +import { asNumber, asRecord } from '@sammo-ts/common'; import { zWorldStateConfig, zWorldStateMeta } from '../../context.js'; import { isSelectionPoolWorld, resolveSelectionMaxGeneral } from '@sammo-ts/game-engine/turn/selectPoolService.js'; @@ -26,7 +26,14 @@ export const lobbyRouter = router({ const userCnt = await ctx.db.general.count({ where: { npcState: { lt: 2 } } }); const npcCnt = await ctx.db.general.count({ where: { npcState: { gte: 2 } } }); const nationCnt = await ctx.db.nation.count({ where: { level: { gt: 0 } } }); + const rawConfig = asRecord(rawWorldState.config); const scenarioTitle = asRecord(asRecord(rawWorldState.meta).scenarioMeta).title; + const autorunUser = worldState.meta.autorun_user; + const autorunOptions = autorunUser?.options + ? Object.entries(autorunUser.options) + .filter(([, enabled]) => enabled) + .map(([option]) => option) + : []; const gameTime = await loadCurrentGameTime(ctx.db); let myGeneral = null; @@ -55,10 +62,20 @@ export const lobbyRouter = router({ fictionMode: worldState.config.fictionMode ?? '사실', starttime: worldState.meta.starttime ?? '', opentime: worldState.meta.opentime ?? '', + preopenAt: worldState.meta.preopenAt ?? '', turntime: worldState.meta.turntime ?? '', serverTime: gameTime.now.toISOString(), clockMode: gameTime.mode ?? 'realtime', otherTextInfo: worldState.meta.otherTextInfo ?? '', + npcMode: worldState.config.npcMode ?? 0, + defaultStatTotal: asNumber(asRecord(rawConfig.stat).total, 165), + autorunUser: + autorunUser?.limit_minutes && autorunUser.limit_minutes > 0 && autorunOptions.length > 0 + ? { + limitMinutes: autorunUser.limit_minutes, + options: autorunOptions, + } + : null, isUnited: worldState.meta.isunited ?? worldState.meta.isUnited ?? 0, selectionPoolEnabled: isSelectionPoolWorld(rawWorldState), npcPossessionEnabled: worldState.config.npcMode === 1, diff --git a/app/game-api/test/lobbyRouter.test.ts b/app/game-api/test/lobbyRouter.test.ts index ecd9de5a..a8aa4396 100644 --- a/app/game-api/test/lobbyRouter.test.ts +++ b/app/game-api/test/lobbyRouter.test.ts @@ -10,7 +10,8 @@ const buildContext = ( tick?: bigint; mode?: string; wallAnchor?: Date; - } = {} + } = {}, + config: Record = {} ): GameApiContext => ({ auth: null, @@ -22,7 +23,7 @@ const buildContext = ( currentYear: 200, currentMonth: 1, tickSeconds: 3_600, - config: {}, + config, meta, clockBaseTime: clock.baseTime ?? null, clockTick: clock.tick ?? null, @@ -67,4 +68,48 @@ describe('lobby season state', () => { expect(result.serverTime).toBe('2026-08-15T02:00:00.000Z'); expect(result.clockMode).toBe('manual'); }); + + it('projects the Ref-compatible opening announcement settings without exposing disabled autorun options', async () => { + const result = await appRouter + .createCaller( + buildContext( + { + preopenAt: '2026-08-19 22:00:00', + opentime: '2026-08-19 23:00:00', + scenarioMeta: { title: '【가상모드27-b】 아시아 명장전(비급)' }, + autorun_user: { + limit_minutes: 1_440, + options: { + develop: true, + warp: true, + recruit: false, + recruit_high: true, + train: true, + battle: true, + chief: true, + }, + }, + }, + {}, + { + fictionMode: '가상', + npcMode: 0, + stat: { total: 310, min: 10, max: 110 }, + } + ) + ) + .lobby.info(); + + expect(result).toMatchObject({ + preopenAt: '2026-08-19 22:00:00', + opentime: '2026-08-19 23:00:00', + scenarioTitle: '【가상모드27-b】 아시아 명장전(비급)', + npcMode: 0, + defaultStatTotal: 310, + autorunUser: { + limitMinutes: 1_440, + options: ['develop', 'warp', 'recruit_high', 'train', 'battle', 'chief'], + }, + }); + }); }); diff --git a/app/gateway-frontend/e2e/lobby-game-auth.spec.ts b/app/gateway-frontend/e2e/lobby-game-auth.spec.ts index 32353d8c..1311d99a 100644 --- a/app/gateway-frontend/e2e/lobby-game-auth.spec.ts +++ b/app/gateway-frontend/e2e/lobby-game-auth.spec.ts @@ -51,7 +51,18 @@ type LobbyFixtureOptions = { isUnited?: number; starttime?: string; opentime?: string; + preopenAt?: string; turntime?: string; + turnTerm?: number; + scenarioTitle?: string; + npcMode?: number; + defaultStatTotal?: number; + korName?: string; + otherTextInfo?: string; + autorunUser?: { + limitMinutes: number; + options: string[]; + } | null; lobbyBundleFailures?: number; profileStatus?: 'RUNNING' | 'PREOPEN' | 'PAUSED' | 'COMPLETED' | 'STOPPED'; includeStoppedProfile?: boolean; @@ -78,7 +89,15 @@ const installFixture = async (page: Page, options: LobbyFixtureOptions = {}) => isUnited = 0, starttime = '2026-07-30 00:00:00', opentime = '2026-07-30 00:00:00', + preopenAt = '', turntime = '2026-07-30 00:05:00', + turnTerm = 5, + scenarioTitle = '', + npcMode = 0, + defaultStatTotal = 165, + korName = 'hwe', + otherTextInfo = '', + autorunUser = null, lobbyBundleFailures = 0, profileStatus = 'RUNNING', includeStoppedProfile = false, @@ -134,7 +153,7 @@ const installFixture = async (page: Page, options: LobbyFixtureOptions = {}) => battleSimRunning: true, tournamentRunning: true, }, - korName: 'hwe', + korName, color: '#ffffff', localAccountPolicy: { accessAllowed: true, @@ -223,12 +242,17 @@ const installFixture = async (page: Page, options: LobbyFixtureOptions = {}) => maxUserCnt, npcCnt: 0, nationCnt, - turnTerm: 5, + turnTerm, fictionMode: '가상', starttime, opentime, + preopenAt, turntime, - otherTextInfo: '', + otherTextInfo, + scenarioTitle, + npcMode, + defaultStatTotal, + autorunUser, isUnited, selectionPoolEnabled, npcPossessionEnabled, @@ -279,6 +303,118 @@ test('exchanges the gateway token before loading authenticated lobby general dat }); }); +test('copies the complete preopen announcement and reveals autorun details without changing layout', async ({ + page, +}, testInfo) => { + await installFixture(page, { + roles: ['superuser'], + kakaoVerified: false, + profileStatus: 'PREOPEN', + korName: '훼', + specialAccess: { + kind: 'OPERATOR', + grantId: null, + expiresAt: null, + allowsGeneralCreation: true, + }, + preopenAt: '2026-08-19 22:00:00', + opentime: '2026-08-19 23:00:00', + starttime: '2026-08-19 23:00:00', + turnTerm: 1, + scenarioTitle: '【가상모드27-b】 아시아 명장전(비급)', + npcMode: 0, + defaultStatTotal: 310, + autorunUser: { + limitMinutes: 1_440, + options: ['develop', 'warp', 'recruit_high', 'train', 'battle', 'chief'], + }, + }); + await page.setViewportSize({ width: 1200, height: 900 }); + + await page.goto('lobby'); + const row = page.locator('tbody tr').filter({ hasText: '훼섭' }); + const serverName = row.locator('.profile-server-cell .font-bold'); + const settings = row.locator('.profile-announcement-settings'); + const autorun = row.locator('.copyable-autorun'); + const detail = row.locator('.copyable-autorun-detail'); + await expect(row.getByTestId('profile-preopen-at')).toHaveText('- 가오픈 일시 : 2026-08-19 22:00:00 -'); + await expect(row.getByTestId('profile-open-at')).toHaveText('- 오픈 일시 : 2026-08-19 23:00:00 -'); + await expect(row.getByTestId('profile-scenario-announcement')).toHaveText( + '【가상모드27-b】 아시아 명장전(비급) 1분 턴 서버' + ); + const settingsText = (await settings.textContent())?.replace(/\s+/g, ' ').trim(); + expect(settingsText).toBe( + '(상성 설정:가상), (빙의 여부:불가), (최대 스탯:310), ' + + '(기타 설정:자율행동[내정, 순간이동, 모병, 훈련/사기진작, 출병, 사령턴, 24시간 유효])' + ); + await expect(detail).toHaveCSS('font-size', '0px'); + await expect(detail).toHaveCSS('color', 'rgba(0, 0, 0, 0)'); + await expect(page.getByText('특수 접근 · OPERATOR')).toHaveCount(0); + await expect(page.getByText('카카오 인증이 필요합니다.')).toHaveCount(0); + + const baseGeometry = await row.evaluate((element) => ({ + row: element.getBoundingClientRect().toJSON(), + documentWidth: document.documentElement.scrollWidth, + })); + await autorun.hover(); + await expect(detail).toBeVisible(); + await expect(detail).toContainText('내정, 순간이동, 모병, 훈련/사기진작, 출병, 사령턴, 24시간 유효'); + const hoverGeometry = await row.evaluate((element) => ({ + row: element.getBoundingClientRect().toJSON(), + documentWidth: document.documentElement.scrollWidth, + })); + expect(hoverGeometry).toEqual(baseGeometry); + await page.screenshot({ path: testInfo.outputPath('gateway-autorun-announcement-hover.png'), fullPage: true }); + + await autorun.focus(); + await expect(autorun).toBeFocused(); + await expect(detail).toBeVisible(); + await expect(autorun).toHaveCSS('outline-width', '2px'); + + await page.mouse.click(8, 8); + const start = await serverName.boundingBox(); + const end = await settings.boundingBox(); + if (!start || !end) throw new Error('expected announcement selection geometry'); + await page.mouse.move(start.x + 1, start.y + start.height / 2); + await page.mouse.down(); + await page.mouse.move(end.x + end.width - 1, end.y + end.height / 2, { steps: 24 }); + await page.mouse.up(); + const selectedText = await page.evaluate(() => window.getSelection()?.toString() ?? ''); + const compactSelection = selectedText.replace(/\s+/g, ' ').trim(); + expect(compactSelection).toContain( + '훼섭 - 가오픈 일시 : 2026-08-19 22:00:00 - - 오픈 일시 : 2026-08-19 23:00:00 - ' + + '【가상모드27-b】 아시아 명장전(비급) 1분 턴 서버 ' + + '(상성 설정:가상), (빙의 여부:불가), (최대 스탯:310), ' + + '(기타 설정:자율행동[내정, 순간이동, 모병, 훈련/사기진작, 출병, 사령턴, 24시간 유효])' + ); + expect(compactSelection).not.toContain('OPERATOR'); + + await page.evaluate(() => window.getSelection()?.removeAllRanges()); + await page.setViewportSize({ width: 390, height: 844 }); + await autorun.scrollIntoViewIfNeeded(); + const mobileBase = await row.evaluate((element) => ({ + row: element.getBoundingClientRect().toJSON(), + documentWidth: document.documentElement.scrollWidth, + })); + await autorun.hover(); + await expect(detail).toBeVisible(); + const mobileHover = await row.evaluate((element) => { + const tooltip = element.querySelector('.copyable-autorun-detail'); + if (!tooltip) throw new Error('expected autorun tooltip'); + return { + row: element.getBoundingClientRect().toJSON(), + tooltip: tooltip.getBoundingClientRect().toJSON(), + documentWidth: document.documentElement.scrollWidth, + viewportWidth: window.innerWidth, + }; + }); + expect(mobileHover.row).toEqual(mobileBase.row); + expect(mobileHover.documentWidth).toBe(mobileHover.viewportWidth); + expect(mobileHover.tooltip.left).toBeGreaterThanOrEqual(8); + expect(mobileHover.tooltip.right).toBeLessThanOrEqual(mobileHover.viewportWidth - 8); + await page.screenshot({ path: testInfo.outputPath('gateway-autorun-announcement-mobile.png'), fullPage: true }); +}); + test('loads and labels a PAUSED profile whose runtime remains available', async ({ page }, testInfo) => { const gameOperations = await installFixture(page, { profileStatus: 'PAUSED' }); await page.setViewportSize({ width: 1365, height: 900 }); @@ -484,7 +620,7 @@ test('hides the Kakao verification banner for operator special access', async ({ }); await page.goto('lobby'); - await expect(page.getByText('특수 접근 · OPERATOR')).toBeVisible(); + await expect(page.getByText('특수 접근 · OPERATOR')).toHaveCount(0); await expect(page.getByText('카카오 인증이 필요합니다.')).toHaveCount(0); }); @@ -502,7 +638,7 @@ test('hides the Kakao verification banner when a grant removes the remaining ver }); await page.goto('lobby'); - await expect(page.getByText('특수 접근 · RECOVERY')).toBeVisible(); + await expect(page.getByText('특수 접근 · RECOVERY')).toHaveCount(0); await expect(page.getByText('카카오 인증이 필요합니다.')).toHaveCount(0); }); diff --git a/app/gateway-frontend/src/views/LobbyView.vue b/app/gateway-frontend/src/views/LobbyView.vue index b340d10c..078c6dce 100644 --- a/app/gateway-frontend/src/views/LobbyView.vue +++ b/app/gateway-frontend/src/views/LobbyView.vue @@ -106,6 +106,34 @@ const handleMapTabKeydown = (event: KeyboardEvent, profileName: string): void => const formatGraceEndsAt = (value: string | null | undefined): string => formatServerDateTime(value); const serverSeasonStatus = (info: LobbyInfo) => resolveServerSeasonStatus(info); +const formatAnnouncementDate = (value: string | null | undefined): string => + formatServerDateTime(value, { fallback: '-' }); +const npcModeText = (mode: number): string => ['불가', '가능', '선택 생성'][mode] ?? '불가'; +const autorunDetailText = (info: LobbyInfo): string => { + const autorun = info.autorunUser; + if (!autorun) return ''; + + const enabled = new Set(autorun.options); + const labels: string[] = []; + if (enabled.has('develop')) labels.push('내정'); + if (enabled.has('warp')) labels.push('순간이동'); + if (enabled.has('recruit_high')) labels.push('모병'); + else if (enabled.has('recruit')) labels.push('징병'); + if (enabled.has('train')) labels.push('훈련/사기진작'); + if (enabled.has('battle')) labels.push('출병'); + if (enabled.has('chief')) labels.push('사령턴'); + + const limit = + autorun.limitMinutes >= 43_200 + ? '항상 유효' + : autorun.limitMinutes % 60 === 0 + ? `${autorun.limitMinutes / 60}시간 유효` + : `${autorun.limitMinutes}분 유효`; + labels.push(limit); + return labels.join(', '); +}; +const autorunTooltipId = (profileName: string): string => + `profile-autorun-${profileName.replaceAll(/[^a-zA-Z0-9_-]/g, '-')}`; const isProfileRuntimeAvailable = (profile: LobbyProfile): boolean => profile.lifecycle.userAccessible; const unavailableProfileText = (profile: LobbyProfile): string => { if (!profile.lifecycle.dataInitialized) return '- DB 초기화 전 · 접근 불가 -'; @@ -455,13 +483,7 @@ const handleEnter = async (profile: LobbyProfile, targetPath: string) => { 턴 일시정지 · 조회/예약턴 가능
- 특수 접근 · {{ profile.localAccountPolicy.specialAccess.kind }} -
-
{ + +
(상성 설정:{{ profileDetails[profile.profileName]?.fictionMode }}), - (기타 설정:{{ profileDetails[profile.profileName]?.otherTextInfo }}) + + (기타 설정:자율행동[{{ + autorunDetailText(profileDetails[profile.profileName]!) + }}])
@@ -793,6 +879,68 @@ const handleEnter = async (profile: LobbyProfile, targetPath: string) => { min-width: 760px; } +.season-status { + user-select: none; +} + +.copyable-autorun { + position: relative; + cursor: help; + text-decoration: underline; + text-underline-offset: 2px; +} + +.copyable-autorun-detail { + display: inline; + color: transparent; + font-size: 0; +} + +.copyable-autorun-bracket { + color: transparent; + font-size: 0; +} + +.copyable-autorun:hover .copyable-autorun-detail, +.copyable-autorun:focus-visible .copyable-autorun-detail { + position: absolute; + z-index: 30; + right: 0; + bottom: calc(100% + 6px); + display: block; + box-sizing: border-box; + width: max-content; + max-width: min(520px, calc(100vw - 32px)); + padding: 6px 8px; + border: 1px solid #52525b; + border-radius: 4px; + background: #18181b; + box-shadow: 0 4px 12px rgb(0 0 0 / 45%); + color: #f4f4f5; + font-size: 12px; + line-height: 1.4; + text-align: left; + white-space: normal; +} + +.copyable-autorun:focus-visible { + border-radius: 2px; + outline: 2px solid #fdba74; + outline-offset: 2px; +} + +@media (max-width: 640px) { + .copyable-autorun:hover .copyable-autorun-detail, + .copyable-autorun:focus-visible .copyable-autorun-detail { + position: fixed; + right: 16px; + bottom: 16px; + left: 16px; + width: auto; + max-width: none; + } +} + .map-preview-tabs { display: flex; gap: 4px; From a14282b34d0ce70dac97b4d0537300794250143f Mon Sep 17 00:00:00 2001 From: hided62 Date: Wed, 19 Aug 2026 11:13:57 +0000 Subject: [PATCH 3/3] =?UTF-8?q?feat(menu):=20PHP=20=EA=B8=B0=EC=A4=80=20?= =?UTF-8?q?=EA=B3=B5=ED=86=B5=20=EB=A9=94=EB=89=B4=EB=A5=BC=20=EB=9F=B0?= =?UTF-8?q?=ED=83=80=EC=9E=84=20=EC=84=A4=EC=A0=95=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B4=EA=B4=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gateway와 게임 공통 메뉴를 영속 JSON에서 읽고 다음 페이지 로드에 반영한다. 운영 PHP의 항목과 순서, desktop/mobile geometry 및 정보 동작을 보존하고 검증·복구 문서를 추가한다. --- README.md | 1 + app/game-frontend/e2e/mainNavigation.spec.ts | 37 +++-- app/game-frontend/e2e/playwright.config.mjs | 3 +- .../src/components/main/MainGlobalMenu.vue | 14 +- .../components/main/MainMobileBottomBar.vue | 13 +- .../components/main/MainNavigationLink.vue | 15 ++ .../src/components/main/mainNavigation.ts | 143 ++++-------------- app/game-frontend/src/views/MainView.vue | 72 ++++++++- app/gateway-api/src/config.ts | 10 +- app/gateway-api/src/context.ts | 7 + .../src/navigation/runtimeNavigationConfig.ts | 126 +++++++++++++++ app/gateway-api/src/router.ts | 3 + app/gateway-api/src/server.ts | 10 ++ .../test/runtimeNavigationConfig.test.ts | 86 +++++++++++ .../e2e/lobby-admin-navigation.spec.ts | 8 +- .../e2e/playwright.config.mjs | 8 +- .../e2e/runtime-navigation.spec.ts | 72 +++++++++ .../src/layouts/AdminConsoleLayout.vue | 10 +- .../src/layouts/DefaultLayout.vue | 82 +++++++--- docs/index.md | 2 + docs/runtime-navigation.md | 59 ++++++++ packages/common/package.json | 4 + packages/common/src/navigation/menuConfig.ts | 57 +++++++ packages/common/tsdown.config.ts | 1 + resources/navigation.json | 74 +++++++++ 25 files changed, 744 insertions(+), 173 deletions(-) create mode 100644 app/gateway-api/src/navigation/runtimeNavigationConfig.ts create mode 100644 app/gateway-api/test/runtimeNavigationConfig.test.ts create mode 100644 app/gateway-frontend/e2e/runtime-navigation.spec.ts create mode 100644 docs/runtime-navigation.md create mode 100644 packages/common/src/navigation/menuConfig.ts create mode 100644 resources/navigation.json diff --git a/README.md b/README.md index 3222a540..1709f9db 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,7 @@ pnpm docs:preview - [아키텍처 개요](docs/architecture/overview.md) - [런타임 아키텍처](docs/architecture/runtime.md) - [릴리스 운영 매뉴얼](docs/release-operations.md) +- [Gateway와 게임 공통 메뉴 설정](docs/runtime-navigation.md) - [차등 검증](docs/architecture/turn-state-differential-testing.md) - [Caddy prefix 계약](docs/e2e-caddy-routing.md) - [레거시 DB 이관](docs/legacy-db-migration.md) diff --git a/app/game-frontend/e2e/mainNavigation.spec.ts b/app/game-frontend/e2e/mainNavigation.spec.ts index afb2a0ad..8d3be817 100644 --- a/app/game-frontend/e2e/mainNavigation.spec.ts +++ b/app/game-frontend/e2e/mainNavigation.spec.ts @@ -1,8 +1,11 @@ -import { mkdir, writeFile } from 'node:fs/promises'; +import { mkdir, readFile, writeFile } from 'node:fs/promises'; import { resolve } from 'node:path'; import { expect, test, type Locator, type Page, type Route } from '@playwright/test'; const response = (data: unknown) => ({ result: { data } }); +const runtimeNavigation = JSON.parse( + await readFile(new URL('../../../resources/navigation.json', import.meta.url), 'utf8') +) as unknown; const errorResponse = (path: string, message: string) => ({ error: { message, @@ -359,11 +362,16 @@ const installFixture = async (page: Page, state: NavigationFixture) => { await page.route('**/events**', async (route) => { await route.abort(); }); + await page.route('**/gateway/api/navigation', async (route) => { + await route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(runtimeNavigation) }); + }); await page.route('**/gateway/api/trpc/**', async (route) => { const operations = operationNames(route); const results = operations.map((operation) => operation === 'me' ? response({ id: 'user-7', username: 'menu-user', displayName: '메뉴 사용자' }) + : operation === 'navigation.get' + ? response(runtimeNavigation) : response({ ok: true }) ); await route.fulfill({ @@ -924,7 +932,7 @@ test('desktop menus preserve ref columns, prefix-safe routes, and controlled dro ); await expect(global.locator('[data-navigation-id="nation-list"]')).toHaveAttribute('target', '_blank'); await expect(global.locator('[data-navigation-id="board-community"]')).toHaveAttribute('href', '/xe/community'); - await expect(global.locator('[data-navigation-id="official-chat"]')).toHaveAttribute('aria-disabled', 'true'); + await expect(global.locator('[data-navigation-id="official-chat"]')).toHaveAttribute('target', '_blank'); await expect(global.locator('[data-navigation-id="survey"]')).toHaveClass(/highlight/); await expect(page.locator('.main-nation-menu [data-navigation-id="tournament"]')).toHaveClass(/highlight/); @@ -971,6 +979,14 @@ test('desktop menus preserve ref columns, prefix-safe routes, and controlled dro await page.getByRole('heading', { name: '메인 화면 검증 시나리오' }).click(); await expect(gameInfoButton).toHaveAttribute('aria-expanded', 'false'); + await gameInfoButton.click(); + await global.locator('[data-navigation-id="version"]').click(); + const versionDialog = page.getByRole('dialog', { name: '게임 정보' }); + await expect(versionDialog).toBeVisible(); + await expect(versionDialog).toContainText('메인 화면 검증 시나리오'); + await versionDialog.getByRole('button', { name: '닫기' }).click(); + await expect(versionDialog).toBeHidden(); + const bottomGlobal = page.locator('[data-menu-position="bottom"]'); const bottomGameInfoButton = bottomGlobal.locator('[data-menu-id="game-info"]'); await bottomGameInfoButton.click(); @@ -995,7 +1011,7 @@ test('desktop menus preserve ref columns, prefix-safe routes, and controlled dro await persistArtifact(page, `${basePath.slice(1)}-desktop-1200`); }); -test('split buttons keep square inner corners and a single divider in every interaction state', async ({ +test('nation split buttons keep square inner corners and a single divider in every interaction state', async ({ page, }, testInfo) => { const state: NavigationFixture = { @@ -1062,14 +1078,8 @@ test('split buttons keep square inner corners and a single divider in every inte for (const width of [1200, 500]) { await page.setViewportSize({ width, height: 900 }); await waitForMain(page); - const globalSplit = page.locator('.main-global-menu:visible .main-menu-split').first(); const nationSplit = page.locator('.main-nation-menu:visible .nation-menu-split').first(); const pairs: Array<[string, Locator, Locator]> = [ - [ - 'global', - globalSplit.locator('[data-navigation-id="board-community"]'), - globalSplit.locator('[data-menu-id="boards"]'), - ], [ 'nation', nationSplit.locator('[data-navigation-id="auction-resource"]'), @@ -1129,7 +1139,8 @@ test('the repeated bottom global menu opens upward on the mobile document', asyn const bottomGlobal = page.locator('[data-menu-position="bottom"]'); const gameInfoButton = bottomGlobal.locator('[data-menu-id="game-info"]'); - await gameInfoButton.click(); + await gameInfoButton.scrollIntoViewIfNeeded(); + await gameInfoButton.evaluate((button) => (button as HTMLElement).click()); await expect(gameInfoButton).toHaveAttribute('aria-expanded', 'true'); await expect(bottomGlobal.locator('#global-menu-game-info')).toBeVisible(); const geometry = await gameInfoButton.evaluate((button) => { @@ -2418,9 +2429,9 @@ test('all main Lumen button families share the rounded pressed geometry', async page.locator('.main-global-menu[data-menu-position="top"] [data-navigation-id="nation-betting"]'), ], [ - '게임정보', + '게임 정보', page.locator('.main-global-menu[data-menu-position="top"]').getByRole('button', { - name: '게임정보', + name: '게임 정보', exact: true, }), ], @@ -2566,7 +2577,7 @@ test('mobile main Lumen button families keep the same state geometry without ove const controls = [ page.locator('.main-global-menu[data-menu-position="top"] [data-navigation-id="nation-betting"]'), page.locator('.main-global-menu[data-menu-position="top"]').getByRole('button', { - name: '게임정보', + name: '게임 정보', exact: true, }), page.locator('.layout-mobile [data-navigation-id="meeting"]'), diff --git a/app/game-frontend/e2e/playwright.config.mjs b/app/game-frontend/e2e/playwright.config.mjs index 6c766ef7..8fe08af6 100644 --- a/app/game-frontend/e2e/playwright.config.mjs +++ b/app/game-frontend/e2e/playwright.config.mjs @@ -12,7 +12,8 @@ const gatewayWebUrl = process.env.PLAYWRIGHT_GATEWAY_WEB_URL ?? '/gateway/'; const useProductionBundle = process.env.PLAYWRIGHT_FRONTEND_MODE === 'production'; const frontendEnv = `VITE_APP_BASE_PATH=${basePath} VITE_GAME_API_URL=${gameApiUrl} ` + - `VITE_GAME_PROFILE=${gameProfile} VITE_GATEWAY_WEB_URL=${gatewayWebUrl}`; + `VITE_GAME_PROFILE=${gameProfile} VITE_GATEWAY_WEB_URL=${gatewayWebUrl} ` + + 'VITE_GATEWAY_API_URL=/gateway/api/trpc'; export default defineConfig({ testDir: '.', diff --git a/app/game-frontend/src/components/main/MainGlobalMenu.vue b/app/game-frontend/src/components/main/MainGlobalMenu.vue index 5a331a20..3bf347bc 100644 --- a/app/game-frontend/src/components/main/MainGlobalMenu.vue +++ b/app/game-frontend/src/components/main/MainGlobalMenu.vue @@ -5,17 +5,23 @@ import { buildGlobalNavigation, isNavigationConfigured, type MainNavigationLink as MainNavigationLinkItem, + type MainNavigationEntry, } from './mainNavigation'; import { useMenuPopup } from './useMenuPopup'; const props = defineProps<{ npcMode: number; voteActive: boolean; + entries?: MainNavigationEntry[]; }>(); -const entries = computed(() => buildGlobalNavigation(props.npcMode)); +const emit = defineEmits<{ + action: [action: NonNullable]; +}>(); + +const entries = computed(() => buildGlobalNavigation(props.npcMode, props.entries)); const { setRoot, openId, close, toggle } = useMenuPopup(); -const isActive = (link: MainNavigationLinkItem) => link.id === 'survey' && props.voteActive; +const isActive = (link: MainNavigationLinkItem) => link.highlightWhen === 'vote' && props.voteActive; @@ -65,6 +73,7 @@ const isActive = (link: MainNavigationLinkItem) => link.id === 'survey' && props :enabled="isNavigationConfigured(entry.main)" :active="isActive(entry.main)" lumen-variant="navigation" + @action="emit('action', $event)" />