From d0371fa0ac88369f2d73b85069e1d8cdb58cfcd2 Mon Sep 17 00:00:00 2001 From: EJClaw Date: Sat, 31 Oct 2026 03:30:39 +0900 Subject: [PATCH] =?UTF-8?q?3D=20=EB=A6=AC=ED=94=8C=EB=A0=88=EC=9D=B4:=20?= =?UTF-8?q?=EB=A6=AC=ED=94=8C=EB=A0=88=EC=9D=B4=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=EC=9D=B4=20=EC=97=86=EC=9C=BC=EB=A9=B4=20'=EB=A6=AC=ED=94=8C?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=20=ED=8C=8C=EC=9D=BC=20=EC=97=86=EC=9D=8C'?= =?UTF-8?q?=EA=B3=BC=20=EC=83=88=EB=A1=9C=EA=B3=A0=EC=B9=A8=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20(=EB=82=B4=EB=A0=A4=EB=B0=9B=EC=9D=80=20=EB=92=A4?= =?UTF-8?q?=20=EB=88=84=EB=A5=B4=EB=A9=B4=20=EB=8B=A4=EC=8B=9C=20=EC=B0=BE?= =?UTF-8?q?=EC=95=84=20=EB=B3=80=ED=99=98)=20=C2=B7=20=EC=98=A4=EB=A5=98?= =?UTF-8?q?=20=EC=83=81=ED=83=9C=EC=97=90=EB=8F=84=20=EC=83=88=EB=A1=9C?= =?UTF-8?q?=EA=B3=A0=EC=B9=A8=20=C2=B7=20=EB=AA=A9=20=EC=84=9C=EB=B2=84?= =?UTF-8?q?=EB=8A=94=20=EB=A6=AC=ED=94=8C=EB=A0=88=EC=9D=B4=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=EC=9D=B4=20=EC=97=86=EC=9C=BC=EB=A9=B4=20404?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- site/web/mock/server.mjs | 3 +- site/web/src/components/ReplayPanel.tsx | 37 ++++++++++++++++++++----- site/web/src/lib/api.ts | 4 ++- site/web/src/styles.css | 15 ++++++++++ 4 files changed, 50 insertions(+), 9 deletions(-) diff --git a/site/web/mock/server.mjs b/site/web/mock/server.mjs index 897337b..a810926 100644 --- a/site/web/mock/server.mjs +++ b/site/web/mock/server.mjs @@ -347,7 +347,8 @@ async function handle(req, res) { if ((m = p.match(/^\/api\/matches\/([^/]+)\/replay$/))) { const mt = db.matches.find((x) => x.id === decodeURIComponent(m[1])); if (!mt) return json(res, 404, { error: 'not_found' }); - if (!mt.replayPath) return json(res, 404, { error: 'replay_not_found' }); + // 파일을 지웠다가 다시 두면 "리플레이 없음 → 내려받고 새로고침" 을 흉내 낼 수 있다 + if (!mt.replayPath || !fs.existsSync(mt.replayPath)) return json(res, 404, { error: 'replay_not_found' }); res.writeHead(200, { 'content-type': 'application/json' }); return fs.createReadStream(mt.replayPath).pipe(res); } diff --git a/site/web/src/components/ReplayPanel.tsx b/site/web/src/components/ReplayPanel.tsx index 19c4a2c..26eefbd 100644 --- a/site/web/src/components/ReplayPanel.tsx +++ b/site/web/src/components/ReplayPanel.tsx @@ -14,6 +14,8 @@ export function ReplayPanel({ m }: { m: MatchDetail }) { const [replay, setReplay] = useState(null); const [err, setErr] = useState(null); const [converting, setConverting] = useState(false); + // 새로고침을 누를 때마다 1씩 올려 리플레이를 다시 묻는다 + const [reload, setReload] = useState(0); useEffect(() => { if (!open || replay) return; let alive = true; @@ -22,7 +24,7 @@ export function ReplayPanel({ m }: { m: MatchDetail }) { // 처음 열면 게임 PC 가 리플레이를 변환한다 (보통 10초 안팎). 변환 중(202)이면 3초 뒤 다시 묻는다 (5분까지) const ask = (tries: number) => api - .replay(m.id) + .replay(m.id, reload > 0) .then((r) => { if (!alive) return; if ('status' in r && r.status === 'converting') { @@ -46,12 +48,17 @@ export function ReplayPanel({ m }: { m: MatchDetail }) { alive = false; if (timer) clearTimeout(timer); }; - }, [open, m.id, replay]); + }, [open, m.id, replay, reload]); const sync = useMemo(() => (replay ? computeSync(m, replay) : null), [m, replay]); // replay_not_found: 앱이 리플레이를 못 찾음. 다른 404: 이 앱 버전에는 리플레이 기능이 아직 없음 const missing = err instanceof ApiError && err.status === 404 && err.code === 'replay_not_found'; const appTooOld = err instanceof ApiError && err.status === 404 && err.code === 'Not Found'; // Fastify 기본 404 (경로 없음) const failed = err instanceof ApiError && err.status === 422 && err.code === 'replay_failed'; + const refresh = ( + + ); return ( ) : missing ? ( -
- 이 경기 리플레이가 아직 없습니다. 발로란트 경력 탭에서 이 경기의 리플레이를 내려받으면 게임 PC 앱이 찾아서 변환합니다 (몇 초 걸림). +
+
+ 리플레이 파일 없음 +
+ 게임 PC 에 이 경기의 리플레이 파일이 없습니다. 발로란트 경력 탭에서 이 경기의 리플레이를 내려받은 뒤 새로고침을 누르면 게임 PC 앱이 찾아서 + 변환합니다 (몇 초 걸림). +
+
+ {refresh}
) : appTooOld ? ( -
지금 게임 PC 앱 버전은 아직 리플레이를 보내지 않습니다. 리플레이 자동 변환이 들어간 앱으로 업데이트하면 볼 수 있습니다.
+
+
지금 게임 PC 앱 버전은 아직 리플레이를 보내지 않습니다. 리플레이 자동 변환이 들어간 앱으로 업데이트하면 볼 수 있습니다.
+ {refresh} +
) : failed ? ( -
게임 PC 가 이 경기 리플레이를 변환하지 못했습니다. 발로란트 패치로 리플레이 형식이 바뀌었을 수 있습니다. ({(err as ApiError).detail ?? '이유 모름'})
+
+
게임 PC 가 이 경기 리플레이를 변환하지 못했습니다. 발로란트 패치로 리플레이 형식이 바뀌었을 수 있습니다. ({(err as ApiError).detail ?? '이유 모름'})
+ {refresh} +
) : err ? ( -
리플레이를 불러오지 못했습니다: {err instanceof Error ? err.message : String(err)}
+
+
리플레이를 불러오지 못했습니다: {err instanceof Error ? err.message : String(err)}
+ {refresh} +
) : !replay || !sync ? ( ) : ( diff --git a/site/web/src/lib/api.ts b/site/web/src/lib/api.ts index c47d27d..20be89b 100644 --- a/site/web/src/lib/api.ts +++ b/site/web/src/lib/api.ts @@ -165,7 +165,9 @@ export const api = { matches: (o: { game?: GameType; limit?: number; before?: number } = {}) => request(`/api/matches${qs(o)}`), match: (id: string) => request(`/api/matches/${encodeURIComponent(id)}`), /** 발로란트 리플레이(.vrf)에서 뽑은 재생 데이터. 없으면 404 replay_not_found, 게임 PC 가 변환 중이면 202 { status: 'converting' } */ - replay: (id: string) => request(`/api/matches/${encodeURIComponent(id)}/replay`), + // fresh: 새로고침 때는 브라우저 캐시를 거치지 않는다 (방금 내려받은 리플레이가 보이게) + replay: (id: string, fresh = false) => + request(`/api/matches/${encodeURIComponent(id)}/replay`, fresh ? { cache: 'no-cache' } : {}), culpritMatches: (o: { game?: GameType; limit?: number } = {}) => request(`/api/culprit/matches${qs(o)}`), culpritMatch: (id: string) => request(`/api/culprit/matches/${encodeURIComponent(id)}`), culpritBudget: () => request('/api/culprit/budget'), diff --git a/site/web/src/styles.css b/site/web/src/styles.css index e822cfe..cc15c35 100644 --- a/site/web/src/styles.css +++ b/site/web/src/styles.css @@ -3936,6 +3936,21 @@ button.match:hover { } /* ── 3D 리플레이 (components/ReplayViewer.tsx) ── */ +.replay-msg { + display: flex; + align-items: center; + justify-content: space-between; + gap: 12px; +} +.replay-msg b { + display: block; + margin-bottom: 2px; + color: #e6edf3; + font-size: 13px; +} +.replay-msg .mini-btn { + flex: none; +} .replay-panel { flex: none; }