feat: Implement dynamic QR code redirection with comprehensive scan tracking, device/OS detection, and geo-location.
This commit is contained in:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user