From 7f9a09066625f1beec4194d9bfd2b956255e29ef Mon Sep 17 00:00:00 2001 From: Josh Knapp Date: Sun, 12 Apr 2026 11:58:12 -0700 Subject: [PATCH] Fix image proxy by moving API routes before static middleware Express was matching static files before API routes, causing the image-proxy endpoint to return 404 in browser. Co-Authored-By: Claude Opus 4.6 (1M context) --- server/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/index.js b/server/index.js index 21ed7ac..1ba6f2b 100644 --- a/server/index.js +++ b/server/index.js @@ -34,9 +34,6 @@ app.use((req, res, next) => { // Parse JSON bodies app.use(express.json()); -// Serve static files from the overlay directory -app.use(express.static(path.join(__dirname, '..', 'overlay'))); - // Image proxy — fetches album art server-side so OBS can display it app.get('/api/image-proxy', async (req, res) => { const url = req.query.url; @@ -88,6 +85,9 @@ app.post('/api/now-playing', (req, res) => { res.json(currentState); }); +// Serve static files from the overlay directory (after API routes) +app.use(express.static(path.join(__dirname, '..', 'overlay'))); + // Send current state to newly connected WebSocket clients wss.on('connection', (ws) => { ws.send(JSON.stringify(currentState));