feat: Implement dynamic QR code redirection with comprehensive scan tracking, device/OS detection, and geo-location.

This commit is contained in:
Timo
2026-01-02 19:47:43 +01:00
parent d0a114c1c3
commit 49673e84b6
2 changed files with 48 additions and 7 deletions

View File

@@ -24,10 +24,15 @@ export function parseUserAgent(userAgent: string | null): { device: string | nul
let device: string | null = null;
let os: string | null = null;
// Detect device - check tablet FIRST since iPad can match mobile patterns
if (/Tablet|iPad/i.test(userAgent)) {
// Detect device
// iPadOS 13+ sends "Macintosh" user agent.
// Without referrer info here, we fall back to checking for Safari-only Mac UAs (common for iPad)
const isIPad = /iPad/i.test(userAgent) ||
(/Macintosh/i.test(userAgent) && /Safari/i.test(userAgent) && !/Chrome/i.test(userAgent));
if (isIPad || /Tablet|PlayBook|Silk/i.test(userAgent)) {
device = 'tablet';
} else if (/Mobile|Android|iPhone/i.test(userAgent)) {
} else if (/Mobile|Android|iPhone/i.test(userAgent) && !isIPad) {
device = 'mobile';
} else {
device = 'desktop';