events: source MOBILE_UA_RE from src/ua.js
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a756a1dcc3
commit
e141b16f1f
1 changed files with 1 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue