fix: enhance user agent detection to support custom user agent

This commit is contained in:
Harvey Zack committed 2025-05-17 22:16:08 +08:00
1 parent dd57cc2a03
commit 6c4e9f7e78
27 files changed
+324 -283

No files matched your search

@@ -1,4 +1,4 @@
export const userAgent = typeof navigator !== 'undefined' ? navigator.userAgent : '';
export const userAgent = globalThis?.CUSTOM_USER_AGENT ?? (typeof navigator !== 'undefined' ? navigator.userAgent : '');
export const isSafari = /^((?!chrome|android).)*safari/i.test(userAgent);
export const isWechat = /MicroMessenger/i.test(userAgent);
export const isIE = /MSIE|Trident/i.test(userAgent);