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) <noreply@anthropic.com>
This commit is contained in:
+3
-3
@@ -34,9 +34,6 @@ app.use((req, res, next) => {
|
|||||||
// Parse JSON bodies
|
// Parse JSON bodies
|
||||||
app.use(express.json());
|
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
|
// Image proxy — fetches album art server-side so OBS can display it
|
||||||
app.get('/api/image-proxy', async (req, res) => {
|
app.get('/api/image-proxy', async (req, res) => {
|
||||||
const url = req.query.url;
|
const url = req.query.url;
|
||||||
@@ -88,6 +85,9 @@ app.post('/api/now-playing', (req, res) => {
|
|||||||
res.json(currentState);
|
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
|
// Send current state to newly connected WebSocket clients
|
||||||
wss.on('connection', (ws) => {
|
wss.on('connection', (ws) => {
|
||||||
ws.send(JSON.stringify(currentState));
|
ws.send(JSON.stringify(currentState));
|
||||||
|
|||||||
Reference in New Issue
Block a user