From e141b16f1f64a638560d0b4764fd7c42ca33fafe Mon Sep 17 00:00:00 2001 From: Arlind Ukshini Date: Mon, 27 Apr 2026 10:47:54 +0200 Subject: [PATCH] events: source MOBILE_UA_RE from src/ua.js Co-Authored-By: Claude Sonnet 4.6 --- server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.js b/server.js index fe9c78d..25a1c9b 100644 --- a/server.js +++ b/server.js @@ -13,6 +13,7 @@ import { fileURLToPath } from 'node:url'; import authRouter from './src/auth.js'; import { requireAuth, requireAdmin } from './src/middleware.js'; import { q } from './src/db.js'; // also side-effect: opens DB + runs schema +import { MOBILE_UA_RE } from './src/ua.js'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const app = express(); @@ -182,7 +183,6 @@ app.get('/', (req, res) => { // screen. The `?view=mobile` / `?view=desktop` query override exists // for cases where the guess is wrong or someone wants to preview the // other version — it takes precedence over the UA regex. -const MOBILE_UA_RE = /\b(iPhone|iPod|Android.*Mobile|Mobile.*Firefox|IEMobile|BlackBerry|Opera Mini)\b/i; function wantsMobileView(req) { const forced = (req.query.view || '').toLowerCase(); if (forced === 'mobile') return true;