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:
EJClaw
2026-10-16 05:01:14 +09:00
parent 2ffb18263c
commit fa6126e17f
66 changed files with 2265 additions and 128 deletions

View File

@@ -10,9 +10,12 @@ import type {
UserProfile,
User,
UtteranceItem,
UtteranceInfo,
GameType,
} from '@gvr/shared';
import { reportClient } from './report';
/** 전역 신호: 401 → 로그인 화면, 503 device_offline → 잠금 화면 */
type Signal = 'unauthorized' | 'not_member' | 'device_offline';
const listeners = new Set<(s: Signal) => void>();
@@ -55,12 +58,16 @@ async function request<T>(path: string, init: RequestInit = {}): Promise<T> {
if (res.status === 401) emit('unauthorized');
else if (res.status === 403 && code === 'not_member') emit('not_member');
else if (res.status === 503 && code === 'device_offline') emit('device_offline');
// 게임 PC 쪽 오류 · 시간 초과는 사이트 로그에도 남긴다 (게임 PC 꺼짐은 서버가 이미 남김)
else if (res.status >= 500) reportClient('error', `요청 실패 ${res.status} ${code}: ${init.method ?? 'GET'} ${path.split('?')[0]}`);
throw new ApiError(res.status, code);
}
export interface Me {
user: { id: string; name: string; avatar: string | null };
isOwner: boolean;
/** 사이트 로그를 볼 수 있는지 (관리자 · 최고 관리자, v1.3.6~) */
canViewLogs?: boolean;
}
export interface StatusResponse {
device: DeviceStatus;
@@ -75,7 +82,6 @@ export interface TimelineQuery {
to?: number;
q?: string;
types?: string[];
hideNoise?: boolean;
cursor?: string | null;
limit?: number;
order?: 'asc' | 'desc';
@@ -117,7 +123,6 @@ export const api = {
to: q.to,
q: q.q,
types: q.types?.length ? q.types.join(',') : undefined,
hideNoise: q.hideNoise ? 1 : undefined,
cursor: q.cursor,
limit: q.limit ?? 100,
order: q.order,
@@ -152,6 +157,7 @@ export const api = {
if (res.status === 503 && b.error === 'device_offline') emit('device_offline');
return { ok: false, status: res.status, error: b.error ?? 'error', message: b.message ?? '분석을 시작하지 못했습니다' };
},
utteranceInfo: (id: string) => request<UtteranceInfo>(`/api/utterances/${encodeURIComponent(id)}/info`),
correct: (id: string, text: string) =>
request<UtteranceItem>(`/api/utterances/${encodeURIComponent(id)}`, { method: 'PATCH', body: JSON.stringify({ text }) }),
};

View File

@@ -1,3 +1,5 @@
import { settings } from '../store/settings';
/** 공용 AudioContext 와 출력 체인 (플레이어 + 효과음) */
let ctx: AudioContext | null = null;
let playerBus: GainNode | null = null;
@@ -14,6 +16,11 @@ export function audioCtx(): AudioContext {
limiter.attack.value = 0.002;
limiter.release.value = 0.12;
playerBus = ctx.createGain();
// 녹음 재생 음량 (플레이어 막대의 음량 조절). 리미터 앞에서 바꿔 크게 키워도 찢어지지 않는다
playerBus.gain.value = clampVolume(settings.get().playVolume);
settings.subscribe(() => {
if (playerBus) playerBus.gain.value = clampVolume(settings.get().playVolume);
});
playerBus.connect(limiter).connect(ctx.destination);
sfxBus = ctx.createGain();
sfxBus.connect(ctx.destination);
@@ -35,4 +42,6 @@ export function sfxOutput(): GainNode {
return sfxBus!;
}
export const clampVolume = (v: unknown) => (typeof v === 'number' && isFinite(v) ? Math.min(2, Math.max(0, v)) : 1);
export const dbToGain = (db: number) => Math.pow(10, db / 20);

View File

@@ -11,7 +11,6 @@ export interface Filters {
to: number | undefined;
q: string;
types: TypeGroup[];
hideNoise: boolean;
order: 'asc' | 'desc' | null;
}
@@ -28,7 +27,6 @@ export function parseFilters(p: URLSearchParams): Filters {
to: num(p.get('to')),
q: p.get('q') ?? '',
types: (p.get('types')?.split(',').filter(Boolean) ?? []) as TypeGroup[],
hideNoise: p.get('hideNoise') === '1',
order: order === 'asc' || order === 'desc' ? order : null,
};
}
@@ -42,7 +40,6 @@ export function writeFilters(f: Filters): URLSearchParams {
if (f.to != null) p.set('to', String(f.to));
if (f.q) p.set('q', f.q);
if (f.types.length) p.set('types', f.types.join(','));
if (f.hideNoise) p.set('hideNoise', '1');
if (f.order) p.set('order', f.order);
return p;
}
@@ -59,7 +56,6 @@ export function toQuery(f: Filters): TimelineQuery {
to: f.to,
q: f.q || undefined,
types: f.types,
hideNoise: f.hideNoise,
order: effectiveOrder(f),
};
}
@@ -76,7 +72,7 @@ export function matchesFilter(it: TimelineItem, f: Filters): boolean {
const kw = f.q.trim().toLowerCase();
if (it.kind === 'utterance') {
if (f.users.length && !f.users.includes(it.userId)) return false;
if (f.hideNoise && it.noise) return false;
if (it.noise) return false; // 잡음은 보여 주지 않는다
if (kw && !(it.text ?? '').toLowerCase().includes(kw)) return false;
} else {
if (f.users.length && it.userId && !f.users.includes(it.userId)) return false;

View File

@@ -0,0 +1,29 @@
/** 브라우저 오류를 사이트 로그([web])에 남긴다. 같은 내용은 30초에 한 번만 */
const recent = new Map<string, number>();
export function reportClient(level: 'warn' | 'error', message: string, detail?: string): void {
const key = `${level}:${message}`;
const now = Date.now();
if ((recent.get(key) ?? 0) > now - 30000) return;
recent.set(key, now);
if (recent.size > 200) recent.clear();
void fetch('/site/client-log', {
method: 'POST',
credentials: 'include',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ level, message: message.slice(0, 500), detail: detail?.slice(0, 2000), page: location.pathname + location.search }),
keepalive: true,
}).catch(() => undefined);
}
let installed = false;
export function installErrorReporting(): void {
if (installed) return;
installed = true;
window.addEventListener('error', (e) => reportClient('error', `화면 오류: ${e.message}`, e.error?.stack ?? `${e.filename}:${e.lineno}:${e.colno}`));
window.addEventListener('unhandledrejection', (e) => {
const r = e.reason;
if (r?.name === 'AbortError') return;
reportClient('error', `처리 안 된 오류: ${r?.message ?? String(r)}`, r?.stack);
});
}