M2: 사이트 서버 · 사이트 v1 - gvr.tkrmagid.kr 배포

- site/server: Discord OAuth2 + 봇 토큰 멤버 확인, 세션, 1회용 등록 코드·기기 키 인증, 게임 PC WebSocket 중계(JSON·음성 바이너리), 15초 무응답 잠금, 게임 이미지 캐시, 관리 CLI
- site/web: 타임라인·따라 읽기 재생(단어 강조·이어듣기·현장 모드·재생 게인)·필터·검색·실시간·교정, 발로란트/롤 경기 상세, 잠금 화면(관리자 등록 코드), 모바일, 효과음
- deploy/site: Dockerfile·compose·deploy.sh·make-env.sh (.5, 포트 2972)
- 앱 코어: 사이트 필터 묶음(킬·라운드)과 유저 필터 규칙 맞춤, hello 에 서버 ID

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-15 01:32:51 +09:00
parent 2745af8f61
commit 9abda88046
84 changed files with 13399 additions and 21 deletions

View File

@@ -98,6 +98,7 @@ export async function startCore(opts: CoreOptions) {
deviceKey: settings.getSecret('deviceKey') ?? null,
name: S().site.deviceName,
version: opts.version,
guildId: S().discord.guildId,
}));
const retention = new Retention(store, () => S().storage.retentionDays, () => paths().audio);

View File

@@ -29,7 +29,7 @@ export class RelayClient {
constructor(
private api: FastifyInstance,
private bus: Bus,
private cfg: () => { serverUrl: string; deviceId: string | null; deviceKey: string | null; name: string; version: string },
private cfg: () => { serverUrl: string; deviceId: string | null; deviceKey: string | null; name: string; version: string; guildId: string | null },
) {
bus.on('live', (ev: LiveEvent) => this.send({ t: 'event', event: ev }));
}
@@ -69,7 +69,7 @@ export class RelayClient {
this.lastPong = Date.now();
this.status = { state: 'online', error: null, since: Date.now(), serverUrl: c.serverUrl };
log.info(`사이트 서버 연결됨: ${c.serverUrl}`);
this.send({ t: 'hello', name: c.name, version: c.version });
this.send({ t: 'hello', name: c.name, version: c.version, guildId: c.guildId });
this.pingTimer = setInterval(() => {
if (Date.now() - this.lastPong > 20000) {
log.warn('사이트 서버 응답 없음, 다시 연결');

View File

@@ -98,9 +98,14 @@ export class Timeline {
const cur = q.cursor ? parseCursor(q.cursor) : null;
const types = q.types && q.types.length ? new Set(q.types) : null;
const wantUtt = !types || types.has('utterance');
const eventTypes = types
? [...types].flatMap((t) => (t === 'round' ? ['round_end'] : t === 'match' ? ['match_start', 'match_end'] : t === 'utterance' ? [] : [t]))
: null;
// 사이트 필터 묶음: 킬 = 킬·멀티킬·에이스, 라운드 = 라운드 종료·경기 시작/종료·스파이크
const GROUPS: Record<string, string[]> = {
kill: ['kill', 'multikill', 'ace'],
round: ['round_end', 'match_start', 'match_end', 'spike'],
match: ['match_start', 'match_end'],
utterance: [],
};
const eventTypes = types ? [...new Set([...types].flatMap((t) => GROUPS[t] ?? [t]))] : null;
const wantEvents = (!types || (eventTypes && eventTypes.length > 0)) && q.game !== 'none';
const cmp = desc ? '<' : '>';
const ord = desc ? 'DESC' : 'ASC';
@@ -172,15 +177,14 @@ export class Timeline {
args.push(q.game);
}
if (q.users?.length) {
const puuids = this.store
// 선택하지 않은 (디스코드에 연결된) 유저가 주인공인 이벤트만 뺀다. 라운드·오브젝트·상대 킬처럼 유저가 없는 이벤트는 남긴다.
const others = this.store
.listAccounts()
.filter((a) => q.users!.includes(a.user_id))
.filter((a) => a.puuid && !q.users!.includes(a.user_id))
.map((a) => a.puuid);
if (!puuids.length) where.push('0');
else {
const ph = puuids.map(() => '?').join(',');
where.push(`(e.actor_puuid IN (${ph}) OR e.target_puuid IN (${ph}))`);
args.push(...puuids, ...puuids);
if (others.length) {
where.push(`(e.actor_puuid IS NULL OR e.actor_puuid NOT IN (${others.map(() => '?').join(',')}))`);
args.push(...others);
}
}
if (q.from) {