fix(mobile): move baseUrl config to experiments.baseUrl and filter static assets in express wildcard handler
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user