v1.3.6: 목소리 깨짐(RTP 기준 쉼 채우기) · 알 수 없음 · 잡음 숨기기/삭제 · 사이트 로그 · 지금 게임 · TTS 속도 · 시작 창
- 녹음기: 패킷 도착 간격 대신 RTP 타임스탬프로 자리를 정한다. 게임 중 몰려 온 패킷 사이에 무음이 끼어 목소리가 깨졌다. 예전 녹음은 한 번 고친 뒤 다시 변환 - users.updated 를 빈 목록으로 보내 사이트에서 말한 사람이 '알 수 없음'이 되던 것 - 잡음은 숨기고 ogg 삭제, 로그에 잡음으로 남김. 짧은 목소리도 Whisper 로, 반복 고리는 줄여서 보여 줌 - 사이트: 재생 음량, 발화 우클릭(자세한 정보 · ogg 다운로드), 사이트 로그(/logs, 게임 PC 꺼져도), 지금 게임 상태 - 앱: 지금 게임 상태, 녹음 안내 말 속도 0.1~2.0, 포터블 · 앱 시작 창 - 발로란트 데스매치 가짜 라운드 · 에이스, 빈 선수 이름 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,9 +7,12 @@ import { sfx, SFX_LABEL } from '../lib/sfx';
|
||||
import { resumeAudio } from '../lib/audio';
|
||||
import { Avatar, Brand } from './common';
|
||||
import { IGear, ILogout, ISearch } from './Icons';
|
||||
import { GAME_NAME, liveGameLine, liveGameRows } from '@gvr/shared';
|
||||
|
||||
function SettingsPopover({ onClose }: { onClose: () => void }) {
|
||||
const s = useSettings();
|
||||
const { auth } = useAuth();
|
||||
const canViewLogs = auth.status === 'ok' && !!auth.me.canViewLogs;
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
useEffect(() => {
|
||||
const down = (e: PointerEvent) => {
|
||||
@@ -80,11 +83,36 @@ function SettingsPopover({ onClose }: { onClose: () => void }) {
|
||||
<input type="checkbox" checked={s.reduceMotion} onChange={(e) => settings.set({ reduceMotion: e.target.checked })} />
|
||||
<span>모션 줄이기</span>
|
||||
</label>
|
||||
{canViewLogs && (
|
||||
<>
|
||||
<h5>문제 해결</h5>
|
||||
<a className="row" href="/logs">
|
||||
📄 사이트 로그 보기 · 내려받기
|
||||
</a>
|
||||
</>
|
||||
)}
|
||||
<div className="pop-foot">단축키: Space 재생 · ←/→ 이전·다음 발화 · / 검색 · Esc 닫기</div>
|
||||
</motion.div>
|
||||
);
|
||||
}
|
||||
|
||||
/** 지금 게임: 경기 중이면 "발로란트 · 경쟁전 · 어센트 · R15 8:6", 아니면 연결된 게임 상태 */
|
||||
function GamePill() {
|
||||
const { overview } = useData();
|
||||
const live = (overview?.live ?? []).filter((g) => g.enabled && g.connected);
|
||||
const g = live.find((x) => x.inMatch) ?? live[0];
|
||||
if (!g) return null;
|
||||
const tip = liveGameRows(g)
|
||||
.map(([k, v]) => `${k}: ${v}`)
|
||||
.join('\n');
|
||||
return (
|
||||
<div className={`game-pill ${g.game}${g.inMatch ? ' in' : ''}`} title={tip}>
|
||||
<span className="gp-name">{GAME_NAME[g.game]}</span>
|
||||
<span className="gp-txt">{liveGameLine(g)}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function SearchBox() {
|
||||
const [params, setParams] = useSearchParams();
|
||||
const loc = useLocation();
|
||||
@@ -170,6 +198,7 @@ export function Header() {
|
||||
<span className="rec-short">녹음 중</span>
|
||||
</div>
|
||||
)}
|
||||
{!locked && <GamePill />}
|
||||
{device && (
|
||||
<div className={`conn ${locked ? 'off' : conn === 'open' ? 'on' : 'warn'}`} title={conn === 'open' ? '실시간 연결됨' : '실시간 연결 재시도 중'}>
|
||||
<span className="dot" />
|
||||
|
||||
@@ -65,6 +65,17 @@ export const IVolume = (p: SVGProps<SVGSVGElement>) => (
|
||||
<path d="M19 5a10 10 0 0 1 0 14" />
|
||||
</svg>
|
||||
);
|
||||
export const IMute = (p: SVGProps<SVGSVGElement>) => (
|
||||
<svg {...base(p)}>
|
||||
<path d="M11 5 6 9H2v6h4l5 4V5z" />
|
||||
<path d="m23 9-6 6M17 9l6 6" />
|
||||
</svg>
|
||||
);
|
||||
export const IDownload = (p: SVGProps<SVGSVGElement>) => (
|
||||
<svg {...base(p)}>
|
||||
<path d="M12 3v12M7 10l5 5 5-5M4 21h16" />
|
||||
</svg>
|
||||
);
|
||||
export const IUsers = (p: SVGProps<SVGSVGElement>) => (
|
||||
<svg {...base(p)}>
|
||||
<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" />
|
||||
|
||||
@@ -123,6 +123,11 @@ export function LockOverlay() {
|
||||
>
|
||||
↻ {checking ? '확인 중…' : '지금 다시 확인'}
|
||||
</button>
|
||||
{auth.status === 'ok' && auth.me.canViewLogs && (
|
||||
<a className="btn" href="/logs">
|
||||
📄 사이트 로그 보기
|
||||
</a>
|
||||
)}
|
||||
<button className="btn" onClick={logout}>
|
||||
로그아웃
|
||||
</button>
|
||||
|
||||
@@ -6,7 +6,8 @@ import { useData } from '../store/app';
|
||||
import { sfx } from '../lib/sfx';
|
||||
import { fmtClock, fmtSec } from '../lib/format';
|
||||
import { Avatar } from './common';
|
||||
import { IClose, ILoop, INext, IPause, IPlay, IPrev, IVolume } from './Icons';
|
||||
import { IClose, ILoop, IMute, INext, IPause, IPlay, IPrev, IVolume } from './Icons';
|
||||
import { clampVolume } from '../lib/audio';
|
||||
|
||||
const RATES = [1, 1.25, 1.5, 2];
|
||||
|
||||
@@ -51,6 +52,32 @@ function SceneLanes({ scene }: { scene: SceneInfo }) {
|
||||
);
|
||||
}
|
||||
|
||||
/** 녹음 재생 음량 0~200% (아이콘을 누르면 음소거 / 되돌리기) */
|
||||
function VolumeControl() {
|
||||
const cfg = useSettings();
|
||||
const v = clampVolume(cfg.playVolume);
|
||||
const last = useRef(v || 1);
|
||||
if (v > 0) last.current = v;
|
||||
return (
|
||||
<div className="pb-vol" title={`재생 음량 ${Math.round(v * 100)}%`}>
|
||||
<button className={`icon-btn${v === 0 ? ' muted-on' : ''}`} onClick={() => settings.set({ playVolume: v === 0 ? last.current : 0 })} aria-label={v === 0 ? '소리 켜기' : '음소거'}>
|
||||
{v === 0 ? <IMute width={16} height={16} /> : <IVolume width={16} height={16} />}
|
||||
</button>
|
||||
<input
|
||||
type="range"
|
||||
min={0}
|
||||
max={200}
|
||||
step={5}
|
||||
value={Math.round(v * 100)}
|
||||
onChange={(e) => settings.set({ playVolume: Number(e.target.value) / 100 })}
|
||||
aria-label="재생 음량"
|
||||
style={{ ['--p' as string]: `${(v / 2) * 100}%` }}
|
||||
/>
|
||||
<span className="mono pb-vol-n">{Math.round(v * 100)}%</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function PlayerBar() {
|
||||
const s = usePlayer((x) => x);
|
||||
const cfg = useSettings();
|
||||
@@ -145,6 +172,7 @@ export function PlayerBar() {
|
||||
<button className="chip mono" onClick={click(() => settings.set({ rate: RATES[(RATES.indexOf(cfg.rate) + 1) % RATES.length] }))} title="재생 속도">
|
||||
{cfg.rate}x
|
||||
</button>
|
||||
<VolumeControl />
|
||||
<button
|
||||
className={`chip${cfg.normalize ? ' on-mint' : ''}`}
|
||||
onClick={click(() => settings.set({ normalize: !cfg.normalize }))}
|
||||
|
||||
218
site/web/src/components/UttMenu.tsx
Normal file
218
site/web/src/components/UttMenu.tsx
Normal file
@@ -0,0 +1,218 @@
|
||||
import { useEffect, useState, useSyncExternalStore, type ReactNode } from 'react';
|
||||
import type { UtteranceInfo, UtteranceItem } from '@gvr/shared';
|
||||
import { api, ApiError } from '../lib/api';
|
||||
import { fmtWhen } from '../lib/format';
|
||||
import { player } from '../store/player';
|
||||
import { useData } from '../store/app';
|
||||
import { IClose, IDownload, IPlay } from './Icons';
|
||||
|
||||
/** 발화 우클릭 메뉴 · 자세한 정보 창 (앱에 하나만 띄운다) */
|
||||
type MenuState = { item: UtteranceItem; x: number; y: number } | null;
|
||||
let menu: MenuState = null;
|
||||
let infoFor: UtteranceItem | null = null;
|
||||
const subs = new Set<() => void>();
|
||||
const notify = () => subs.forEach((f) => f());
|
||||
const subscribe = (f: () => void) => {
|
||||
subs.add(f);
|
||||
return () => {
|
||||
subs.delete(f);
|
||||
};
|
||||
};
|
||||
|
||||
export function openUttMenu(item: UtteranceItem, x: number, y: number): void {
|
||||
menu = { item, x, y };
|
||||
notify();
|
||||
}
|
||||
function closeMenu(): void {
|
||||
menu = null;
|
||||
notify();
|
||||
}
|
||||
function openInfo(item: UtteranceItem): void {
|
||||
menu = null;
|
||||
infoFor = item;
|
||||
notify();
|
||||
}
|
||||
function closeInfo(): void {
|
||||
infoFor = null;
|
||||
notify();
|
||||
}
|
||||
|
||||
/** 녹음 원본(.ogg)을 내려받는다. 게임 PC → 사이트 서버 중계로 받은 파일을 그대로 저장 */
|
||||
export async function downloadAudio(item: UtteranceItem, fileName?: string | null): Promise<void> {
|
||||
const res = await fetch(`/api/audio/${encodeURIComponent(item.id)}`, { credentials: 'include' });
|
||||
if (!res.ok) throw new Error(res.status === 410 ? '음성 파일이 삭제되었습니다' : `받지 못했습니다 (${res.status})`);
|
||||
const blob = await res.blob();
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = fileName || `${item.id}.ogg`;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
setTimeout(() => URL.revokeObjectURL(url), 10000);
|
||||
}
|
||||
|
||||
const copy = (text: string) => navigator.clipboard?.writeText(text).catch(() => undefined);
|
||||
|
||||
export function UttMenuHost() {
|
||||
const m = useSyncExternalStore(subscribe, () => menu);
|
||||
const info = useSyncExternalStore(subscribe, () => infoFor);
|
||||
const [err, setErr] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (!m) return;
|
||||
const close = () => closeMenu();
|
||||
const onKey = (e: KeyboardEvent) => e.key === 'Escape' && closeMenu();
|
||||
window.addEventListener('pointerdown', close);
|
||||
window.addEventListener('scroll', close, true);
|
||||
window.addEventListener('resize', close);
|
||||
window.addEventListener('keydown', onKey);
|
||||
return () => {
|
||||
window.removeEventListener('pointerdown', close);
|
||||
window.removeEventListener('scroll', close, true);
|
||||
window.removeEventListener('resize', close);
|
||||
window.removeEventListener('keydown', onKey);
|
||||
};
|
||||
}, [m]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!err) return;
|
||||
const t = setTimeout(() => setErr(null), 4000);
|
||||
return () => clearTimeout(t);
|
||||
}, [err]);
|
||||
|
||||
const act = (fn: () => unknown) => (e: React.PointerEvent | React.MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
closeMenu();
|
||||
fn();
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{m && (
|
||||
<div
|
||||
className="ctx-menu"
|
||||
role="menu"
|
||||
style={{ left: Math.min(m.x, window.innerWidth - 230), top: Math.min(m.y, window.innerHeight - 190) }}
|
||||
onPointerDown={(e) => e.stopPropagation()}
|
||||
onContextMenu={(e) => e.preventDefault()}
|
||||
>
|
||||
<button role="menuitem" disabled={!m.item.audio} onClick={act(() => void player.play(m.item))}>
|
||||
<IPlay width={14} height={14} /> 재생
|
||||
</button>
|
||||
<button role="menuitem" onClick={act(() => openInfo(m.item))}>
|
||||
<span className="ctx-ic">ℹ</span> 자세한 정보
|
||||
</button>
|
||||
<button role="menuitem" disabled={!m.item.audio} onClick={act(() => downloadAudio(m.item).catch((e) => setErr(e.message)))}>
|
||||
<IDownload width={14} height={14} /> 음성 다운로드 (.ogg)
|
||||
</button>
|
||||
<button role="menuitem" disabled={!m.item.text} onClick={act(() => copy(m.item.text ?? ''))}>
|
||||
<span className="ctx-ic">⧉</span> 내용 복사
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
{info && <InfoDialog item={info} onError={setErr} />}
|
||||
{err && <div className="ctx-toast">{err}</div>}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
const STATUS: Record<string, string> = { pending: '변환 대기', realtime: '실시간 모델', precise: '정밀 모델', failed: '인식 실패' };
|
||||
const DELETED: Record<string, string> = { retention: '보관 기간이 지나 삭제됨', noise: '잡음이라 삭제됨', missing: '파일을 찾을 수 없음' };
|
||||
|
||||
function fmtBytes(n: number): string {
|
||||
return n >= 1024 * 1024 ? `${(n / 1024 / 1024).toFixed(2)} MB` : `${(n / 1024).toFixed(1)} KB`;
|
||||
}
|
||||
|
||||
function InfoDialog({ item, onError }: { item: UtteranceItem; onError: (m: string) => void }) {
|
||||
const { userById } = useData();
|
||||
const [info, setInfo] = useState<UtteranceInfo | null>(null);
|
||||
const [failed, setFailed] = useState<string | null>(null);
|
||||
const [copied, setCopied] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
let alive = true;
|
||||
api
|
||||
.utteranceInfo(item.id)
|
||||
.then((r) => alive && setInfo(r))
|
||||
.catch((e) => {
|
||||
if (!alive) return;
|
||||
// v1.3.5 이하 앱에는 이 기능이 없다
|
||||
setFailed(e instanceof ApiError && e.status === 404 ? '게임 PC 의 겜녹이가 예전 버전입니다. v1.3.6 이상으로 업데이트하면 볼 수 있습니다.' : '정보를 받지 못했습니다.');
|
||||
});
|
||||
const onKey = (e: KeyboardEvent) => e.key === 'Escape' && closeInfo();
|
||||
window.addEventListener('keydown', onKey);
|
||||
return () => {
|
||||
alive = false;
|
||||
window.removeEventListener('keydown', onKey);
|
||||
};
|
||||
}, [item.id]);
|
||||
|
||||
const doCopy = (label: string, v: string) => {
|
||||
void copy(v);
|
||||
setCopied(label);
|
||||
setTimeout(() => setCopied(null), 1500);
|
||||
};
|
||||
const user = userById(item.userId);
|
||||
const rows: [string, ReactNode][] = info
|
||||
? [
|
||||
['말한 사람', user?.name ?? info.userId],
|
||||
['원본 파일', <span className="mono">{info.fileName ?? '-'}</span>],
|
||||
[
|
||||
'경로 (게임 PC)',
|
||||
info.path ? (
|
||||
<span className="mono path">
|
||||
{info.path}{' '}
|
||||
<button className="link-btn" onClick={() => doCopy('path', info.path!)}>
|
||||
{copied === 'path' ? '복사됨' : '복사'}
|
||||
</button>
|
||||
</span>
|
||||
) : (
|
||||
'-'
|
||||
),
|
||||
],
|
||||
['파일 상태', info.deleted ? DELETED[info.deleted] : info.sizeBytes != null ? `있음 · ${fmtBytes(info.sizeBytes)}` : '-'],
|
||||
['녹음 시각', `${fmtWhen(info.startedAt)} · ${(info.durationMs / 1000).toFixed(1)}초`],
|
||||
['음성채널', info.channel ?? '-'],
|
||||
['경기', info.matchId ?? '경기 밖'],
|
||||
['인식', `${STATUS[info.status] ?? info.status}${info.model ? ` · ${info.model}` : ''}${info.confidence != null ? ` · 신뢰도 ${Math.round(info.confidence * 100)}%` : ''}`],
|
||||
['원래 인식 결과', info.rawText ?? '-'],
|
||||
...(info.corrected ? ([['교정', '사람이 고친 글']] as [string, ReactNode][]) : []),
|
||||
['음량', `${info.lufs != null ? `${info.lufs.toFixed(1)} LUFS` : '-'} · 재생 보정 ${info.gainDb != null ? `${info.gainDb > 0 ? '+' : ''}${info.gainDb.toFixed(1)} dB` : '-'}`],
|
||||
['발화 ID', <span className="mono">{info.id}</span>],
|
||||
]
|
||||
: [];
|
||||
|
||||
return (
|
||||
<div className="ctx-dim" onPointerDown={closeInfo}>
|
||||
<div className="ctx-dialog" role="dialog" aria-label="발화 자세한 정보" onPointerDown={(e) => e.stopPropagation()}>
|
||||
<div className="ctx-head">
|
||||
<b>발화 자세한 정보</b>
|
||||
<button className="icon-btn" onClick={closeInfo} aria-label="닫기">
|
||||
<IClose width={16} height={16} />
|
||||
</button>
|
||||
</div>
|
||||
{failed && <p className="dim">{failed}</p>}
|
||||
{!info && !failed && <p className="dim">불러오는 중…</p>}
|
||||
{info && (
|
||||
<dl className="ctx-rows">
|
||||
{rows.map(([k, v]) => (
|
||||
<div key={k}>
|
||||
<dt>{k}</dt>
|
||||
<dd>{v}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
)}
|
||||
<div className="ctx-foot">
|
||||
<button className="chip on" disabled={!item.audio || !!info?.deleted} onClick={() => downloadAudio(item, info?.fileName).catch((e) => onError(e.message))}>
|
||||
<IDownload width={14} height={14} /> 원본 ogg 다운로드
|
||||
</button>
|
||||
<button className="chip" onClick={closeInfo}>
|
||||
닫기
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import { sfx } from '../lib/sfx';
|
||||
import { realTip } from '../lib/format';
|
||||
import { Avatar, TimeCell } from './common';
|
||||
import { IEdit } from './Icons';
|
||||
import { openUttMenu } from './UttMenu';
|
||||
|
||||
const STATUS: Record<UtteranceItem['status'], [string, string]> = {
|
||||
realtime: ['실시간', 'st-rt'],
|
||||
@@ -152,6 +153,12 @@ export const UtteranceRow = memo(function UtteranceRow({ item, variant = 'full',
|
||||
if (active && player.state.mode === 'single') player.toggle();
|
||||
else void player.play(item);
|
||||
};
|
||||
// 우클릭: 재생 · 자세한 정보(원본 ogg 이름 · 경로) · 다운로드
|
||||
const menu = (e: MouseEvent) => {
|
||||
if (editing) return;
|
||||
e.preventDefault();
|
||||
openUttMenu(item, e.clientX, e.clientY);
|
||||
};
|
||||
const edit = (e: MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
sfx('click');
|
||||
@@ -178,7 +185,7 @@ export const UtteranceRow = memo(function UtteranceRow({ item, variant = 'full',
|
||||
|
||||
if (variant === 'compact') {
|
||||
return (
|
||||
<div className={`l utt${active ? ' cur' : ''}${item.noise ? ' is-noise' : ''}`} onClick={click} data-id={item.id}>
|
||||
<div className={`l utt${active ? ' cur' : ''}${item.noise ? ' is-noise' : ''}`} onClick={click} onContextMenu={menu} data-id={item.id}>
|
||||
<span className="t mono" data-tip={realTip(item.ts)}>
|
||||
{timeText ?? item.time.primary}
|
||||
</span>
|
||||
@@ -199,7 +206,7 @@ export const UtteranceRow = memo(function UtteranceRow({ item, variant = 'full',
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={`it utt${active ? ' playing' : ''}${item.noise ? ' is-noise' : ''}`} onClick={click} data-id={item.id}>
|
||||
<div className={`it utt${active ? ' playing' : ''}${item.noise ? ' is-noise' : ''}`} onClick={click} onContextMenu={menu} data-id={item.id}>
|
||||
<TimeCell time={item.time} real={!item.game} />
|
||||
<Avatar user={user} size={30} />
|
||||
<div className="body">
|
||||
|
||||
Reference in New Issue
Block a user