diff --git a/backend/src/index.ts b/backend/src/index.ts index a371332..b485ae9 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -49,6 +49,14 @@ app.get('/{*path}', (req, res, next) => { if (req.path.startsWith(apiRoot)) return next(); if (req.path === '/_cron/tick') return next(); + // Do not serve HTML for static assets or requests that do not accept HTML + const isAsset = /\.[a-z0-9]{2,4}$/i.test(req.path); + const acceptsHtml = req.headers.accept?.includes('text/html'); + if (isAsset || !acceptsHtml) { + res.status(404).json({ success: false, error: 'Not found' }); + return; + } + if (req.path.startsWith('/mobile')) { res.sendFile(path.join(publicDir, 'mobile/index.html'), (err) => { if (err) next(); diff --git a/mobile/app.json b/mobile/app.json index 2ffc6b8..944c4e8 100644 --- a/mobile/app.json +++ b/mobile/app.json @@ -23,8 +23,7 @@ "web": { "bundler": "metro", "output": "single", - "favicon": "./assets/images/favicon.png", - "baseUrl": "/mobile" + "favicon": "./assets/images/favicon.png" }, "plugins": [ "expo-router", @@ -32,7 +31,8 @@ "expo-web-browser" ], "experiments": { - "typedRoutes": true + "typedRoutes": true, + "baseUrl": "/mobile" } } } \ No newline at end of file