경기 탭 리플레이 필터: 리플레이 있는 경기 / 없는 경기 (게임 PC 에 발로란트 .vrf 가 있는지, GET /api/matches?replay=yes|no · 롤 제외 · 요약에 replay) · 예전 앱이면 업데이트 안내 · 롤을 고르면 숨김 · '필터 초기화' · 목 서버 · 시험 · v1.12.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-11-21 11:49:18 +09:00
parent 1e892d1523
commit e8a1c4d5b3
9 changed files with 86 additions and 16 deletions

View File

@@ -130,9 +130,11 @@ function timeline(q) {
return { items: page, next: items.length > limit ? enc(page[page.length - 1]) : null };
}
const hasReplay = (m) => !!m.replayPath && fs.existsSync(m.replayPath);
const summary = (m) => ({
id: m.id, game: m.game, startedAt: m.startedAt, endedAt: m.endedAt, map: m.map, mode: m.mode, win: m.win, score: m.score, status: m.status, participants: m.participants,
source: m.source ?? 'live', voice: m.utterances.length > 0,
...(m.game === 'valorant' ? { replay: hasReplay(m) } : {}),
});
function userProfile(id) {
@@ -361,8 +363,11 @@ async function handle(req, res) {
// 모드 · 날짜 필터, 데스매치는 늘 뺀다 (v1.11.0 앱과 같게)
const mode = q.get('mode');
const after = q.get('after') ? Number(q.get('after')) : 0;
// 리플레이 필터 (v1.12.0 앱과 같게): 발로란트 경기만
const replay = q.get('replay');
const keepReplay = (x) => (replay === 'yes' || replay === 'no' ? x.game === 'valorant' && hasReplay(x) === (replay === 'yes') : true);
const list = db.matches
.filter((x) => (!game || x.game === game) && x.startedAt < before && x.startedAt >= after && keep(x) && x.mode !== '데스매치' && (!mode || x.mode === mode))
.filter((x) => (!game || x.game === game) && x.startedAt < before && x.startedAt >= after && keep(x) && keepReplay(x) && x.mode !== '데스매치' && (!mode || x.mode === mode))
.sort((a, b) => b.startedAt - a.startedAt)
.slice(0, limit)
.map(summary);