From 27bf5704207a25e1b317068b05bf8853c5076182 Mon Sep 17 00:00:00 2001 From: jedarden Date: Thu, 30 Apr 2026 13:12:11 -0400 Subject: [PATCH] fix(web): use /r2/replays/ URL for all replay links MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace /replays/{id}.json.gz with /r2/replays/{id}.json.gz in all pages (home, matches, bot-profile, playlists, feedback). The /replays/ path is not served by Cloudflare Pages — it falls back to the SPA shell causing "Unexpected token '<', --- web/src/pages/bot-profile.ts | 2 +- web/src/pages/feedback.ts | 2 +- web/src/pages/home.ts | 2 +- web/src/pages/matches.ts | 2 +- web/src/pages/playlists.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/web/src/pages/bot-profile.ts b/web/src/pages/bot-profile.ts index 7dd93a0..efaacca 100644 --- a/web/src/pages/bot-profile.ts +++ b/web/src/pages/bot-profile.ts @@ -188,7 +188,7 @@ function renderMatchItem(match: BotProfile['recent_matches'][number]): string { ${opponent ? escapeHtml(opponent.name) : 'Unknown'} ${match.participants.map(p => p.score).join(' - ')} ${enrichedBadge} - Watch + Watch `; } diff --git a/web/src/pages/feedback.ts b/web/src/pages/feedback.ts index 6d36d9f..41ddeaa 100644 --- a/web/src/pages/feedback.ts +++ b/web/src/pages/feedback.ts @@ -401,7 +401,7 @@ function initFeedback(): void { // ─── Utilities ──────────────────────────────────────────────────────────────── function replayUrlForMatch(m: MatchSummary): string { - return `/replays/${m.id}.json.gz`; + return `/r2/replays/${m.id}.json.gz`; } function formatDate(s: string | null): string { diff --git a/web/src/pages/home.ts b/web/src/pages/home.ts index 6ff6f21..39711d8 100644 --- a/web/src/pages/home.ts +++ b/web/src/pages/home.ts @@ -147,7 +147,7 @@ export async function renderHomePage(): Promise { ? `${featuredReplay!.participants.map((p) => `${esc(p.name)}`).join(' vs ')}${featuredReplay!.winner_id ? ` — Winner: ${esc(featuredReplay!.participants.find((p) => p.bot_id === featuredReplay!.winner_id)?.name || 'Unknown')}` : ''}` : 'Demo Replay — Watch a sample battle'; const replayLink = hasLiveReplay - ? `#/watch/replay?url=/replays/${featuredReplay!.id}.json.gz` + ? `#/watch/replay?url=/r2/replays/${featuredReplay!.id}.json.gz` : '#/watch/replays'; // Build lazy-loaded content for below-the-fold sections diff --git a/web/src/pages/matches.ts b/web/src/pages/matches.ts index bf14879..9d5649b 100644 --- a/web/src/pages/matches.ts +++ b/web/src/pages/matches.ts @@ -319,7 +319,7 @@ function renderMatchCard(match: MatchSummary): string { ${match.end_reason ?? '-'} ${match.map_id ? `Map: ${escapeHtml(match.map_id)}` : ''} - Watch Replay + Watch Replay `; diff --git a/web/src/pages/playlists.ts b/web/src/pages/playlists.ts index efc9d2d..a547db4 100644 --- a/web/src/pages/playlists.ts +++ b/web/src/pages/playlists.ts @@ -532,7 +532,7 @@ function addMatchShowMore(container: HTMLElement, remaining: PlaylistMatch[]): v } function watchMatch(matchId: string): void { - window.location.hash = `/watch/replay?url=/replays/${matchId}.json.gz`; + window.location.hash = `/watch/replay?url=/r2/replays/${matchId}.json.gz`; } function copyEmbedCode(matchId: string): void {