M5: 포터블 exe 앱 (트레이·설정 창·첫 실행 마법사) + M6 사전 기능
- app/src/main: Electron 메인(트레이 상태 아이콘, 설정 창, 단일 실행, DPAPI safeStorage, 스모크 모드), IPC(window.gvr), 파인튜닝 관리 - app/src/renderer: 설정 8개 탭 + 5단계 첫 실행 마법사 (React) - electron-builder: GameVoiceRecorder.exe, zip(폴더 포터블) + 단일 exe 포터블, 워커·리소스 포함 - 사전: 사이트에서 단어·교정 규칙 추가/삭제(/api/dictionary), 게임 패치 이름 자동 추가, 묶음별 중복 허용 + DB 마이그레이션 - 사이트 서버: 종료 시 WebSocket 먼저 끊기(재시작 멈춤 수정) + 재연결 테스트 - scripts/finetune-e2e.mts, stt-eval.mts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { useEffect } from 'react';
|
||||
import { Navigate, Route, Routes } from 'react-router';
|
||||
import { DictionaryPage } from './pages/DictionaryPage';
|
||||
import { MotionConfig } from 'framer-motion';
|
||||
import { AuthProvider, DataProvider, StatusProvider, useAuth, useStatus } from './store/app';
|
||||
import { useReducedMotion } from './store/settings';
|
||||
@@ -64,6 +65,7 @@ function Shell() {
|
||||
<Route path="/matches/:id" element={<MatchPage />} />
|
||||
<Route path="/users" element={<UsersPage />} />
|
||||
<Route path="/users/:id" element={<UserPage />} />
|
||||
<Route path="/dictionary" element={<DictionaryPage />} />
|
||||
<Route path="*" element={<Navigate to="/" replace />} />
|
||||
</Routes>
|
||||
</div>
|
||||
|
||||
@@ -147,6 +147,7 @@ export function Header() {
|
||||
['/', '타임라인'],
|
||||
['/matches', '경기'],
|
||||
['/users', '유저'],
|
||||
['/dictionary', '단어사전'],
|
||||
] as const;
|
||||
return (
|
||||
<header className="topbar">
|
||||
|
||||
@@ -94,6 +94,10 @@ export const api = {
|
||||
return { ok: false, reason: 'anon' };
|
||||
},
|
||||
logout: () => fetch('/auth/logout', { method: 'POST', credentials: 'include' }),
|
||||
dictionary: () => request<DictionaryResponse>('/api/dictionary'),
|
||||
addWord: (word: string) => request<{ ok: true }>('/api/dictionary', { method: 'POST', body: JSON.stringify({ word }) }),
|
||||
addRule: (from: string, to: string) => request<{ ok: true }>('/api/dictionary', { method: 'POST', body: JSON.stringify({ from, to }) }),
|
||||
deleteDict: (id: number) => request<{ ok: true }>(`/api/dictionary/${id}`, { method: 'DELETE' }),
|
||||
/** 관리자(OWNER_DISCORD_IDS) 전용: 게임 PC 1회용 등록 코드 (10분) */
|
||||
registrationCode: () => request<{ code: string; expiresAt: number }>('/admin/registration-code', { method: 'POST' }),
|
||||
status: () => request<StatusResponse>('/api/status'),
|
||||
@@ -121,3 +125,19 @@ export const api = {
|
||||
correct: (id: string, text: string) =>
|
||||
request<UtteranceItem>(`/api/utterances/${encodeURIComponent(id)}`, { method: 'PATCH', body: JSON.stringify({ text }) }),
|
||||
};
|
||||
|
||||
export interface DictionaryEntry {
|
||||
id: number;
|
||||
word: string;
|
||||
from: string | null;
|
||||
kind: 'hotword' | 'correction';
|
||||
pack: string;
|
||||
source: 'builtin' | 'user' | 'site';
|
||||
enabled: boolean;
|
||||
hits: number;
|
||||
}
|
||||
export interface DictionaryResponse {
|
||||
labels: Record<string, string>;
|
||||
entries: DictionaryEntry[];
|
||||
packs: { key: string; label: string; count: number }[];
|
||||
}
|
||||
|
||||
115
site/web/src/pages/DictionaryPage.tsx
Normal file
115
site/web/src/pages/DictionaryPage.tsx
Normal file
@@ -0,0 +1,115 @@
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { api, type DictionaryResponse } from '../lib/api';
|
||||
import { useStatus } from '../store/app';
|
||||
import { sfx } from '../lib/sfx';
|
||||
import { ErrorBox, Spinner } from '../components/common';
|
||||
|
||||
const SRC: Record<string, string> = { builtin: '기본', user: '설정', site: '사이트' };
|
||||
|
||||
/** 단어사전: 자주 쓰는 말·별명(핫워드)과 교정 규칙. 사이트에서 문장을 고치면 여기에 자동으로 쌓인다. */
|
||||
export function DictionaryPage() {
|
||||
const { epoch } = useStatus();
|
||||
const [data, setData] = useState<DictionaryResponse | null>(null);
|
||||
const [err, setErr] = useState<unknown>(null);
|
||||
const [n, setN] = useState(0);
|
||||
const [q, setQ] = useState('');
|
||||
const [word, setWord] = useState('');
|
||||
const [from, setFrom] = useState('');
|
||||
const [to, setTo] = useState('');
|
||||
const [busy, setBusy] = useState(false);
|
||||
useEffect(() => {
|
||||
let alive = true;
|
||||
api
|
||||
.dictionary()
|
||||
.then((d) => alive && setData(d))
|
||||
.catch((e) => alive && setErr(e));
|
||||
return () => {
|
||||
alive = false;
|
||||
};
|
||||
}, [epoch, n]);
|
||||
const words = useMemo(() => (data?.entries ?? []).filter((e) => e.kind === 'hotword' && (!q || e.word.includes(q))), [data, q]);
|
||||
const rules = useMemo(() => (data?.entries ?? []).filter((e) => e.kind === 'correction' && (!q || e.word.includes(q) || (e.from ?? '').includes(q))), [data, q]);
|
||||
const run = async (fn: () => Promise<unknown>) => {
|
||||
setBusy(true);
|
||||
try {
|
||||
await fn();
|
||||
sfx('click');
|
||||
setN((x) => x + 1);
|
||||
} catch (e) {
|
||||
setErr(e);
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
if (err) return <main className="page-pad"><ErrorBox error={err} onRetry={() => { setErr(null); setN((x) => x + 1); }} /></main>;
|
||||
if (!data) return <main className="page-pad"><Spinner /></main>;
|
||||
return (
|
||||
<main className="page-pad dict-page">
|
||||
<h2 className="page-h h">단어사전</h2>
|
||||
<p className="muted small">
|
||||
여기 넣은 단어는 음성 인식할 때 힌트로 쓰이고, 교정 규칙은 인식 결과를 바로 고칩니다. 타임라인에서 문장을 고치면 바뀐 단어가 자동으로 추가됩니다.
|
||||
</p>
|
||||
<div className="dict-packs">
|
||||
{data.packs.map((p) => (
|
||||
<span key={p.key} className="chip">
|
||||
{p.label} <b>{p.count.toLocaleString()}</b>
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
<input className="dict-search" placeholder="단어 검색" value={q} onChange={(e) => setQ(e.target.value)} />
|
||||
<div className="dict-grid">
|
||||
<section className="card">
|
||||
<h3 className="h">자주 쓰는 말 · 별명 <span className="dim small">{words.length}</span></h3>
|
||||
<form
|
||||
className="dict-form"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
if (word.trim()) void run(async () => { await api.addWord(word.trim()); setWord(''); });
|
||||
}}
|
||||
>
|
||||
<input placeholder="예: 승한이, 개꿀맵, 로테" value={word} onChange={(e) => setWord(e.target.value)} />
|
||||
<button className="btn primary" disabled={busy || !word.trim()}>추가</button>
|
||||
</form>
|
||||
<div className="dict-list">
|
||||
{words.length === 0 && <div className="dim small">아직 없습니다</div>}
|
||||
{words.map((w) => (
|
||||
<span key={w.id} className="dict-word">
|
||||
{w.word}
|
||||
<span className="dim tiny">{SRC[w.source] ?? w.source}{w.hits ? ` · ${w.hits}회` : ''}</span>
|
||||
<button aria-label="삭제" onClick={() => void run(() => api.deleteDict(w.id))}>✕</button>
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
<section className="card">
|
||||
<h3 className="h">교정 규칙 <span className="dim small">{rules.length}</span></h3>
|
||||
<form
|
||||
className="dict-form"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
if (from.trim() && to.trim()) void run(async () => { await api.addRule(from.trim(), to.trim()); setFrom(''); setTo(''); });
|
||||
}}
|
||||
>
|
||||
<input placeholder="잘못 나온 말 (예: 레이저)" value={from} onChange={(e) => setFrom(e.target.value)} />
|
||||
<span className="dim">→</span>
|
||||
<input placeholder="바른 말 (예: 레이즈)" value={to} onChange={(e) => setTo(e.target.value)} />
|
||||
<button className="btn primary" disabled={busy || !from.trim() || !to.trim()}>추가</button>
|
||||
</form>
|
||||
<table className="dict-table">
|
||||
<tbody>
|
||||
{rules.map((r) => (
|
||||
<tr key={r.id}>
|
||||
<td className="from">{r.from}</td>
|
||||
<td className="dim">→</td>
|
||||
<td className="to">{r.word}</td>
|
||||
<td><span className={`badge src-${r.source}`}>{SRC[r.source] ?? r.source}</span></td>
|
||||
<td>{r.source !== 'builtin' && <button className="link" onClick={() => void run(() => api.deleteDict(r.id))}>삭제</button>}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -3202,3 +3202,28 @@ button.match:hover {
|
||||
/* 관리자: 게임 PC 등록 코드 */
|
||||
.lock-reg { margin: 14px 0 4px; padding: 12px 14px; border: 1px dashed rgba(200, 170, 110, 0.45); border-radius: 10px; font-size: 13px; line-height: 1.6; }
|
||||
.lock-code { font-family: ui-monospace, 'JetBrains Mono', monospace; font-size: 26px; letter-spacing: 3px; color: #c8aa6e; margin: 6px 0 2px; user-select: all; }
|
||||
|
||||
/* 단어사전 */
|
||||
.dict-page .dict-packs { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
|
||||
.dict-page .dict-packs b { color: #c8aa6e; margin-left: 4px; font-weight: 700; }
|
||||
.dict-search { width: 280px; background: #0d1720; border: 1px solid #243545; border-radius: 8px; padding: 9px 12px; color: inherit; margin-bottom: 14px; }
|
||||
.dict-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 16px; }
|
||||
@media (max-width: 900px) { .dict-grid { grid-template-columns: 1fr; } }
|
||||
.dict-grid .card { background: #121e29; border: 1px solid #243545; border-radius: 12px; padding: 16px 18px; }
|
||||
.dict-grid h3 { font-size: 15px; margin-bottom: 12px; }
|
||||
.dict-form { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
|
||||
.dict-form input { flex: 1; min-width: 0; background: #0d1720; border: 1px solid #243545; border-radius: 8px; padding: 9px 12px; color: inherit; }
|
||||
.dict-list { display: flex; flex-wrap: wrap; gap: 8px; }
|
||||
.dict-word { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 12px; border-radius: 999px; background: #182634; border: 1px solid #243545; font-size: 13px; }
|
||||
.dict-word .tiny { font-size: 11px; }
|
||||
.dict-word button { background: none; border: 0; color: #8696a6; cursor: pointer; padding: 0 4px; }
|
||||
.dict-word button:hover { color: #ff4655; }
|
||||
.dict-table { width: 100%; border-collapse: collapse; font-size: 13px; }
|
||||
.dict-table td { padding: 7px 6px; border-bottom: 1px solid #1c2b39; }
|
||||
.dict-table .from { color: #ff8a94; text-decoration: line-through; text-decoration-color: rgba(255, 70, 85, 0.5); }
|
||||
.dict-table .to { color: #45d39a; font-weight: 600; }
|
||||
.dict-table .badge.src-site { background: rgba(20, 193, 183, 0.15); color: #14c1b7; }
|
||||
.dict-table .badge.src-builtin { background: rgba(134, 150, 166, 0.15); color: #8696a6; }
|
||||
.dict-table .badge.src-user { background: rgba(200, 170, 110, 0.15); color: #c8aa6e; }
|
||||
.dict-table .link { background: none; border: 0; color: #8696a6; cursor: pointer; font-size: 12px; }
|
||||
.dict-table .link:hover { color: #ff4655; }
|
||||
|
||||
Reference in New Issue
Block a user