From 2e7a039b8bc6742196ead6f99f067b0466cdc6fa Mon Sep 17 00:00:00 2001 From: Dorian Date: Fri, 13 Mar 2026 16:16:44 +0000 Subject: [PATCH] fix: serve /docs/*.md as static files, not SPA fallback - Add /docs/* route to serve markdown setup guides - Add md to MIME map and SPA catch-all exclusion - Normalize BOTFIGHTS.md placeholders to YOUR_BOT_ID/YOUR_BOT_SECRET Co-Authored-By: Claude Opus 4.6 --- frontend/public/docs/BOTFIGHTS.md | 4 ++-- server/src/app.ts | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/public/docs/BOTFIGHTS.md b/frontend/public/docs/BOTFIGHTS.md index d5482e8..d9cbd8d 100644 --- a/frontend/public/docs/BOTFIGHTS.md +++ b/frontend/public/docs/BOTFIGHTS.md @@ -7,8 +7,8 @@ Your AI reads this file to set up a fighting bot for BOTFIGHTS. Follow the instr You should have received these from BOTFIGHTS registration: ``` -BOT_ID=your_bot_id -BOT_SECRET=your_bot_secret +BOT_ID=YOUR_BOT_ID +BOT_SECRET=YOUR_BOT_SECRET ``` If the user provided credentials above, use those values. If not, ask the user for them. diff --git a/server/src/app.ts b/server/src/app.ts index 22f8a69..1a62597 100644 --- a/server/src/app.ts +++ b/server/src/app.ts @@ -125,6 +125,7 @@ if (process.env.NODE_ENV === 'production' && existsSync(publicDir)) { wav: 'audio/wav', mp3: 'audio/mpeg', ogg: 'audio/ogg', + md: 'text/markdown', } function serveFile(c: Context, reqPath: string, cacheControl: string) { @@ -163,6 +164,9 @@ if (process.env.NODE_ENV === 'production' && existsSync(publicDir)) { app.get('/icon.svg', (c) => serveFile(c, '/icon.svg', 'public, max-age=86400')) app.get('/apple-touch-icon.png', (c) => serveFile(c, '/apple-touch-icon.png', 'public, max-age=86400')) + // Docs (markdown setup guides) + app.get('/docs/*', (c) => serveFile(c, c.req.path, 'public, max-age=3600')) + // Audio files (pre-generated TTS, SFX) app.get('/audio/*', (c) => serveFile(c, c.req.path, 'public, max-age=86400')) // SPA fallback: only for navigation requests (not JS/CSS/asset files) @@ -170,7 +174,7 @@ if (process.env.NODE_ENV === 'production' && existsSync(publicDir)) { if (c.req.path.startsWith('/api/')) return c.notFound() // Don't serve index.html for asset requests — return 404 so the browser gets a proper error const ext = c.req.path.split('.').pop() - if (ext && ext !== c.req.path && ['js', 'css', 'map', 'json', 'png', 'jpg', 'svg', 'woff', 'woff2', 'webp', 'ico', 'wav', 'mp3', 'ogg'].includes(ext)) { + if (ext && ext !== c.req.path && ['js', 'css', 'map', 'json', 'png', 'jpg', 'svg', 'woff', 'woff2', 'webp', 'ico', 'wav', 'mp3', 'ogg', 'md'].includes(ext)) { return c.notFound() } const indexPath = join(publicDir, 'index.html')