mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-27 07:58:45 +03:00
Improve OS detection: fix Linux arch mistakenly detected as version
This commit is contained in:
parent
9e64f34e72
commit
3ca23193dd
@ -965,7 +965,7 @@
|
||||
/(mageia|vectorlinux)[; ]/i, // Mageia/VectorLinux
|
||||
/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,
|
||||
// Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire
|
||||
/(hurd|linux) ?([\w\.]*)/i, // Hurd/Linux
|
||||
/(hurd|linux)(?: arm\w*| x86\w*| ?)([\w\.]*)/i, // Hurd/Linux
|
||||
/(gnu) ?([\w\.]*)/i, // GNU
|
||||
/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i, // FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly
|
||||
/(haiku) (\w+)/i // Haiku
|
||||
|
@ -5,7 +5,16 @@
|
||||
"expect" :
|
||||
{
|
||||
"name" : "Linux",
|
||||
"version" : "x86_64"
|
||||
"version" : "undefined"
|
||||
}
|
||||
},
|
||||
{
|
||||
"desc" : "Linux",
|
||||
"ua" : "Mozilla/5.0 (X11; U; Linux armv61; en-US; rv:1.9.1b2pre) Gecko/20081015 Fennec/1.0a1",
|
||||
"expect" :
|
||||
{
|
||||
"name" : "Linux",
|
||||
"version" : "undefined"
|
||||
}
|
||||
}
|
||||
]
|
@ -68,7 +68,7 @@ describe('Map UA-CH headers', () => {
|
||||
assert.strictEqual(uap.engine.name, 'Blink');
|
||||
assert.strictEqual(uap.engine.version, '110.0.0.0');
|
||||
assert.strictEqual(uap.os.name, "Linux");
|
||||
assert.strictEqual(uap.os.version, "x86_64");
|
||||
assert.strictEqual(uap.os.version, undefined);
|
||||
});
|
||||
|
||||
it('Fallback to user-agent header when using `withClientHints()` but found no client hints-related headers', () => {
|
||||
@ -90,7 +90,7 @@ describe('Map UA-CH headers', () => {
|
||||
assert.strictEqual(uap.engine.name, 'Blink');
|
||||
assert.strictEqual(uap.engine.version, '110.0.0.0');
|
||||
assert.strictEqual(uap.os.name, "Linux");
|
||||
assert.strictEqual(uap.os.version, "x86_64");
|
||||
assert.strictEqual(uap.os.version, undefined);
|
||||
});
|
||||
|
||||
it('Can detect Apple silicon from client hints data', () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user