feat: 코드 리뷰 기반 전면 개선 — 보안, 접근성, 테스트, UX
Some checks failed
Client CI/CD / test (push) Failing after 15m27s
Client CI/CD / deploy (push) Has been cancelled

- HttpOnly 쿠키 refresh token (localStorage 제거)
- 런치 티켓 방식 (JWT URL 노출 방지)
- JWT 디코드로 role 결정 (localStorage 신뢰 제거)
- apiUpload withCredentials 추가
- ErrorBoundary 컴포넌트 추가
- 404 catch-all 라우트 추가
- ARIA 접근성 (tab pattern, aria-label, aria-live)
- Toast CSS 추출 + toastId useRef
- UploadForm 별도 파일 분리 + apiUpload 함수
- UserAdmin fetchError 상태 + retry 버튼
- AuthRedirect 일관성 (모든 경로 → /login)
- DownloadSection localStorage 중복 제거
- CI lint + test + build 검증 단계 추가
- Vitest 테스트 (client 8, Register 10, Login 8)
- AuthPage.css 공유 의도 명확화

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-15 18:07:32 +09:00
parent 254617530c
commit 96f5381d1c
27 changed files with 2154 additions and 401 deletions

View File

@@ -2,7 +2,7 @@ import { useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { useAuth } from '../context/useAuth';
import { getDownloadInfo } from '../api/download';
import { refreshToken } from '../api/auth';
import { createLaunchTicket } from '../api/auth';
import './DownloadSection.css';
export default function DownloadSection() {
@@ -30,24 +30,18 @@ export default function DownloadSection() {
return;
}
// 토큰이 없으면 (다른 탭에서 로그아웃 등) 로그인 유도
let token = localStorage.getItem('token');
if (!token) {
setLaunching(true);
// JWT를 URL에 직접 노출하지 않고, 일회용 티켓을 발급받아 전달
try {
const ticket = await createLaunchTicket();
window.location.href = 'a301://launch?ticket=' + encodeURIComponent(ticket);
} catch {
// 티켓 발급 실패 시 로그인 유도
navigate('/login');
return;
}
setLaunching(true);
// 토큰 만료 대비: 런처에 전달하기 전에 리프레시 시도
try {
token = await refreshToken();
} catch {
// 리프레시 실패해도 기존 토큰으로 시도 (아직 유효할 수 있음)
}
window.location.href = 'a301://launch?token=' + encodeURIComponent(token);
// 런처가 실행되지 않았을 수 있으므로 안내 표시
setLaunched(true);
setLaunching(false);
@@ -58,7 +52,9 @@ export default function DownloadSection() {
const a = document.createElement('a');
a.href = info.launcherUrl;
a.download = 'launcher.exe';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
}
};