-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
290 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"title": "UAParser.js", | ||
"name": "ua-parser-js", | ||
"version": "2.0.0-beta.1", | ||
"version": "2.0.0-beta.2", | ||
"author": "Faisal Salman <[email protected]> (http://faisalman.com)", | ||
"description": "Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent & Client Hints data. Supports browser & node.js environment", | ||
"keywords": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/////////////////////////////////////////////// | ||
/* Enums for UAParser.js v2.0.0-beta.1 | ||
/* Enums for UAParser.js v2.0.0-beta.2 | ||
https://github.com/faisalman/ua-parser-js | ||
Author: Faisal Salman <[email protected]> | ||
AGPLv3 License */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
// Source: /src/enums/ua-parser-enums.js | ||
|
||
/////////////////////////////////////////////// | ||
/* Enums for UAParser.js v2.0.0-beta.1 | ||
/* Enums for UAParser.js v2.0.0-beta.2 | ||
https://github.com/faisalman/ua-parser-js | ||
Author: Faisal Salman <[email protected]> | ||
AGPLv3 License */ | ||
|
@@ -12,54 +12,165 @@ | |
/*jshint esversion: 6 */ | ||
|
||
const Browser = Object.freeze({ | ||
_2345_EXPLORER: '2345Explorer', | ||
_360: '360 Browser', | ||
ALIPAY: 'Alipay', | ||
AMAYA: 'Amaya', | ||
ANDROID: 'Android Browser', | ||
ARORA: 'Arora', | ||
AVANT: 'Avant', | ||
AVAST: 'Avast Secure Browser', | ||
AVG: 'AVG Secure Browser', | ||
BAIDU: 'Baidu Browser', | ||
BASILISK: 'Basilisk', | ||
BLAZER: 'Blazer', | ||
BOLT: 'Bolt', | ||
BOWSER: 'Bowser', | ||
BRAVE: 'Brave', | ||
CAMINO: 'Camino', | ||
CHIMERA: 'Chimera', | ||
CHROME: 'Chrome', | ||
CHROME_HEADLESS: 'Chrome Headless', | ||
CHROME_MOBILE: 'Mobile Chrome', | ||
CHROME_WEBVIEW: 'Chrome WebView', | ||
CHROMIUM: 'Chromium', | ||
COBALT: 'Cobalt', | ||
COC_COC: 'Coc Coc', | ||
COMODO_DRAGON: 'Comodo Dragon', | ||
CONKEROR: 'Conkeror', | ||
DILLO: 'Dillo', | ||
DOLPHIN: 'Dolphin', | ||
DORIS: 'Doris', | ||
DUCKDUCKGO: 'DuckDuckGo', | ||
EDGE: 'Edge', | ||
EPIPHANY: 'Epiphany', | ||
FACEBOOK: 'Facebook', | ||
FALKON: 'Falkon', | ||
FIREBIRD: 'Firebird', | ||
FIREFOX: 'Firefox', | ||
FOCUS: 'Focus', | ||
FIREFOX_FOCUS: 'Firefox Focus', | ||
FIREFOX_MOBILE: 'Mobile Firefox', | ||
FIREFOX_REALITY: 'Firefox Reality', | ||
FENNEC: 'Fennec', | ||
FLOCK: 'Flock', | ||
FLOW: 'Flow', | ||
GO: 'Go Browser', | ||
GOOGLE_SEARCH: 'GSA', | ||
HEYTAP: 'HeyTap', | ||
HUAWEI: 'Huawei Browser', | ||
ICAB: 'iCab', | ||
ICE: 'ICE Browser', | ||
ICEAPE: 'IceApe', | ||
ICECAT: 'IceCat', | ||
ICEDRAGON: 'IceDragon', | ||
ICEWEASEL: 'IceWeasel', | ||
IE: 'IE', | ||
INSTAGRAM: 'Instagram', | ||
IRIDIUM: 'Iridium', | ||
IRON: 'Iron', | ||
JASMINE: 'Jasmine', | ||
KONQUEROR: 'Konqueror', | ||
MOBILE_CHROME: 'Mobile Chrome', | ||
MOBILE_FIREFOX: 'Mobile Firefox', | ||
MOBILE_SAFARI: 'Mobile Safari', | ||
KAKAO: 'KakaoTalk', | ||
KHTML: 'KHTML', | ||
K_MELEON: 'K-Meleon', | ||
KLAR: 'Klar', | ||
KLARNA: 'Klarna', | ||
KINDLE: 'Kindle', | ||
LENOVO: 'Smart Lenovo Browser', | ||
LIEBAO: 'LBBROWSER', | ||
LINE: 'Line', | ||
LINKEDIN: 'LinkedIn', | ||
LINKS: 'Links', | ||
LUNASCAPE: 'Lunascape', | ||
LYNX: 'Lynx', | ||
MAEMO: 'Maemo Browser', | ||
MAXTHON: 'Maxthon', | ||
MIDORI: 'Midori', | ||
MINIMO: 'Minimo', | ||
MIUI: 'MIUI Browser', | ||
MOZILLA: 'Mozilla', | ||
MOSAIC: 'Mosaic', | ||
NAVER: 'Naver', | ||
NETFRONT: 'NetFront', | ||
NETSCAPE: 'Netscape', | ||
NETSURF: 'Netsurf', | ||
NOKIA: 'Nokia Browser', | ||
OBIGO: 'Obigo', | ||
OCULUS: 'Oculus Browser', | ||
OMNIWEB: 'OmniWeb', | ||
OPERA: 'Opera', | ||
OPERA_COAST: 'Opera Coast', | ||
OPERA_MINI: 'Opera Mini', | ||
OPERA_MOBI: 'Opera Mobi', | ||
OPERA_TABLET: 'Opera Tablet', | ||
OPERA_TOUCH: 'Opera Touch', | ||
OVI: 'OviBrowser', | ||
PALEMOON: 'PaleMoon', | ||
PHANTOMJS: 'PhantomJS', | ||
PHOENIX: 'Phoenix', | ||
POLARIS: 'Polaris', | ||
PUFFIN: 'Puffin', | ||
QQ: 'QQ Browser', | ||
QQ: 'QQBrowser', | ||
QQ_LITE: 'QQBrowserLite', | ||
QUARK: 'Quark', | ||
QUPZILLA: 'QupZilla', | ||
REKONQ: 'rekonq', | ||
ROCKMELT: 'Rockmelt', | ||
SAFARI: 'Safari', | ||
SAFARI_MOBILE: 'Mobile Safari', | ||
SAILFISH: 'Sailfish Browser', | ||
SAMSUNG: 'Samsung Internet', | ||
UC: 'UC Browser', | ||
SEAMONKEY: 'SeaMonkey', | ||
SILK: 'Silk', | ||
SKYFIRE: 'Skyfire', | ||
SLEIPNIR: 'Sleipnir', | ||
SLIMBROWSER: 'SlimBrowser', | ||
SNAPCHAT: 'Snapchat', | ||
SOGOU_EXPLORER: 'Sogou Explorer', | ||
SOGOU_MOBILE: 'Sogou Mobile', | ||
SWIFTFOX: 'Swiftfox', | ||
TESLA: 'Tesla', | ||
TIKTOK: 'TikTok', | ||
TIZEN: 'Tizen Browser', | ||
UC: 'UCBrowser', | ||
UP: 'UP.Browser', | ||
VIERA: 'Viera', | ||
VIVALDI: 'Vivaldi', | ||
VIVO: 'Vivo Browser', | ||
W3M: 'w3m', | ||
WATERFOX: 'Waterfox', | ||
WEBKIT: 'WebKit', | ||
WECHAT: 'WeChat', | ||
WEIBO: 'Weibo', | ||
WHALE: 'Whale', | ||
YANDEX: 'Yandex' | ||
|
||
// TODO : test! | ||
}); | ||
|
||
const CPU = Object.freeze({ | ||
ARM : 'arm', | ||
ARM64: 'arm64', | ||
ARMHF: 'armhf', | ||
ARM_64: 'arm64', | ||
ARM_HF: 'armhf', | ||
AVR: 'avr', | ||
AVR_32: 'avr32', | ||
IA64: 'ia64', | ||
IRIX: 'irix', | ||
IRIX64: 'irix64', | ||
IRIX_64: 'irix64', | ||
MIPS: 'mips', | ||
MIPS64: 'mips64', | ||
MOTO_68K: '68k', | ||
MIPS_64: 'mips64', | ||
M68K: '68k', | ||
PA_RISC: 'pa-risc', | ||
PPC: 'ppc', | ||
SPARC: 'sparc', | ||
SPARC64: 'sparc64', | ||
SPARC_64: 'sparc64', | ||
X86: 'ia32', | ||
X86_64: 'amd64' | ||
}); | ||
|
||
const Device = Object.freeze({ | ||
CONSOLE: 'console', | ||
DEKSTOP: 'desktop', | ||
DESKTOP: 'desktop', | ||
EMBEDDED: 'embedded', | ||
MOBILE: 'mobile', | ||
SMARTTV: 'smarttv', | ||
|
@@ -114,6 +225,7 @@ const Vendor = Object.freeze({ | |
SIEMENS: 'Siemens', | ||
SONY: 'Sony', | ||
SPRINT: 'Sprint', | ||
TECHNISAT: 'TechniSAT', | ||
TECNO: 'Tecno', | ||
TESLA: 'Tesla', | ||
ULEFONE: 'Ulefone', | ||
|
@@ -159,14 +271,15 @@ const OS = Object.freeze({ | |
BLACKBERRY: 'BlackBerry', | ||
CENTOS: 'CentOS', | ||
CHROME_OS: 'Chrome OS', | ||
CHROMECAST: 'Chromecast', | ||
CONTIKI: 'Contiki', | ||
FEDORA: 'Fedora', | ||
FIREFOX_OS: 'Firefox OS', | ||
FREEBSD: 'FreeBSD', | ||
DEBIAN: 'Debian', | ||
DEEPIN: 'Deepin', | ||
DRAGONFLY: 'DragonFly', | ||
ELEMENTARY_OS: 'elementary OS', | ||
FEDORA: 'Fedora', | ||
FIREFOX_OS: 'Firefox OS', | ||
FREEBSD: 'FreeBSD', | ||
FUCHSIA: 'Fuchsia', | ||
GENTOO: 'Gentoo', | ||
GHOSTBSD: 'GhostBSD', | ||
|
@@ -225,6 +338,7 @@ const OS = Object.freeze({ | |
WINDOWS: 'Windows', | ||
WINDOWS_MOBILE: 'Windows Mobile', | ||
WINDOWS_PHONE: 'Windows Phone', | ||
XBOX: 'Xbox', | ||
ZENWALK: 'Zenwalk' | ||
|
||
// TODO : test! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/////////////////////////////////////////////// | ||
/* Extensions for UAParser.js v2.0.0-beta.1 | ||
/* Extensions for UAParser.js v2.0.0-beta.2 | ||
https://github.com/faisalman/ua-parser-js | ||
Author: Faisal Salman <[email protected]> | ||
AGPLv3 License */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
// Source: /src/extensions/ua-parser-extensions.js | ||
|
||
/////////////////////////////////////////////// | ||
/* Extensions for UAParser.js v2.0.0-beta.1 | ||
/* Extensions for UAParser.js v2.0.0-beta.2 | ||
https://github.com/faisalman/ua-parser-js | ||
Author: Faisal Salman <[email protected]> | ||
AGPLv3 License */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/////////////////////////////////////////////// | ||
/* Helpers for UAParser.js v2.0.0-beta.1 | ||
/* Helpers for UAParser.js v2.0.0-beta.2 | ||
https://github.com/faisalman/ua-parser-js | ||
Author: Faisal Salman <[email protected]> | ||
AGPLv3 License */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Generated ESM version of ua-parser-js/helpers | ||
// DO NOT EDIT THIS FILE! | ||
// Source: /src/helpers/ua-parser-helpers.js | ||
|
||
/////////////////////////////////////////////// | ||
/* Helpers for UAParser.js v2.0.0-beta.2 | ||
https://github.com/faisalman/ua-parser-js | ||
Author: Faisal Salman <[email protected]> | ||
AGPLv3 License */ | ||
////////////////////////////////////////////// | ||
|
||
/*jshint esversion: 6 */ | ||
|
||
import { CPU, OS, Engine } from '../enums/ua-parser-enums'; | ||
|
||
const isAppleSilicon = (res) => res.os.is(OS.MACOS) && res.cpu.is(CPU.ARM); | ||
|
||
const isChromiumBased = (res) => res.engine.is(Engine.BLINK); | ||
|
||
const isFrozenUA = (ua) => /^Mozilla\/5\.0 \((Windows NT 10\.0; Win64; x64|Macintosh; Intel Mac OS X 10_15_7|X11; Linux x86_64|X11; CrOS x86_64 14541\.0\.0|Fuchsia|Linux; Android 10; K)\) AppleWebKit\/537\.36 \(KHTML, like Gecko\) Chrome\/\d+\.0\.0\.0 (Mobile )?Safari\/537\.36/.test(ua); | ||
|
||
export { | ||
isAppleSilicon, | ||
isChromiumBased, | ||
isFrozenUA | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.