games: automatic CS2 / PUBG / R6 match history — games.matches, match_players, seasons, snapshots, accounts; in-app poller (Leetify, FACEIT, Steam share codes, PUBG API, Ubisoft) every 20 min plus scripts/games-ingest.ts for backfills; match history, stats, maps and seasons on the per-game pages
All checks were successful
Deploy production / deploy (push) Successful in 1m6s

This commit is contained in:
2026-10-25 16:00:48 +00:00
parent 9114b5433b
commit 80803ef5ac
24 changed files with 30747 additions and 5 deletions

30
scripts/games-ingest.ts Normal file
View File

@@ -0,0 +1,30 @@
// Games match history ingest (CS2 / PUBG / R6), the same pass the app runs every 20 minutes
// (src/lib/server/games/poller.ts). Use it for backfills and debugging, inside the app
// container so it has DB_URL and the keys:
// sudo docker exec personal-website-app-1 bun scripts/games-ingest.ts --backfill
// … bun scripts/games-ingest.ts --only leetify,faceit --force
import postgres from 'postgres';
import { runIngest } from '../src/lib/games-ingest/run';
const url = process.env.DB_URL;
if (!url) throw new Error('Set DB_URL');
const arg = (name: string) => {
const i = process.argv.indexOf(name);
return i >= 0 ? process.argv[i + 1] : undefined;
};
const sql = postgres(url, { max: 1, prepare: false, onnotice: () => {} });
try {
const results = await runIngest(sql, process.env, {
backfill: process.argv.includes('--backfill'),
force: process.argv.includes('--force'),
only: arg('--only')?.split(','),
log: (m) => console.error(m)
});
for (const r of results)
console.log(
`${r.status.padEnd(7)} ${r.game.padEnd(4)} ${r.source.padEnd(8)} ${r.account}: +${r.added}${r.note ? ` (${r.note})` : ''}`
);
if (results.some((r) => r.status === 'error')) process.exitCode = 1;
} finally {
await sql.end();
}