Compare commits

...

6 Commits

Author SHA1 Message Date
Faisal Salman
a1cfca47ab Fix #815 - Improve device detection: OnePlus device misidentified as LG tablet 2025-12-16 18:06:14 +07:00
Faisal Salman
1816450040 Add new browser: Opera Neon - https://www.operaneon.com/ 2025-12-15 21:57:00 +07:00
Faisal Salman
634e13f627 [extensions] Add new CLI: Windows' PowerShell 2025-12-15 21:13:13 +07:00
Faisal Salman
37d9b3c981 Improve OS detection: Firefox OS 2025-12-15 18:13:45 +07:00
Faisal Salman
9fc460ed40 Add new engine: Dillo - https://dillo-browser.org/ 2025-12-15 14:00:11 +07:00
Faisal Salman
41dd83f27a Fix #814 - Resolve syntax error related to import renaming in ESM version build 2025-12-10 11:27:02 +07:00
13 changed files with 138 additions and 11 deletions

View File

@@ -232,9 +232,9 @@
"fuzz": "jazzer ./test/fuzz/redos.js --sync",
"test": "./script/test-all.sh",
"test:dts-lint": "tsd --typings src/main/ua-parser.d.ts --files test/static/dts-lint.ts",
"test:eslint": "eslint src && eslint script",
"test:eslint": "eslint --no-config-lookup src",
"test:jshint": "jshint src/main",
"test:lockfile-lint": "npx lockfile-lint -p package-lock.json",
"test:lockfile-lint": "lockfile-lint -p package-lock.json",
"test:mocha": "mocha --recursive test/unit",
"test:playwright": "npx playwright install && playwright test test/e2e --browser all"
},
@@ -247,7 +247,9 @@
"@babel/parser": "7.15.8",
"@babel/traverse": "7.23.2",
"@playwright/test": "^1.57.0",
"eslint": "^9.39.1",
"jshint": "~2.13.6",
"lockfile-lint": "^4.14.1",
"mocha": "~8.2.0",
"requirejs": "2.3.2",
"safe-regex": "^2.1.1",

View File

@@ -4,6 +4,7 @@ const fs = require('fs');
const defaultReplacements = {
mjs: [
[/(?<=const.+)(:)(?=.+require)/ig, ' as'],
[/const (.+?)\s*=\s*require\(\'\.(.+)\'\)/ig, 'import $1 from \'\.$2.mjs\''],
[/const (.+?)\s*=\s*require\(\'(.+)\'\)/ig, 'import $1 from \'$2\''],
[/module\.exports =/ig, 'export']

View File

@@ -9,7 +9,7 @@ echo '
- lint js code
'
npm run test:jshint || exit 1
#npm run test:eslint || exit 1
npm run test:eslint || exit 1
echo '
- test using mocha

View File

@@ -112,6 +112,7 @@ const BrowserName = Object.freeze({
OPERA_GX: 'Opera GX',
OPERA_MINI: 'Opera Mini',
OPERA_MOBI: 'Opera Mobi',
OPERA_NEON: 'Opera Neon',
OPERA_TABLET: 'Opera Tablet',
OPERA_TOUCH: 'Opera Touch',
OTTER: 'Otter',
@@ -312,6 +313,7 @@ const EngineName = Object.freeze({
AMAYA: 'Amaya',
ARKWEB: 'ArkWeb',
BLINK: 'Blink',
DILLO: 'Dillo',
EDGEHTML: 'EdgeHTML',
FLOW: 'Flow',
GECKO: 'Gecko',
@@ -447,6 +449,7 @@ const Extension = Object.freeze({
ELINKS: 'ELinks',
HTTPIE: 'HTTPie',
LYNX: 'Lynx',
POWERSHELL: 'PowerShell',
WGET: 'Wget'
},
Crawler: {

View File

@@ -28,8 +28,8 @@ const LIBRARY = 'library';
const CLIs = Object.freeze({
browser : [
// wget / curl / Lynx / ELinks / HTTPie
[/(wget|curl|lynx|elinks|httpie)[\/ ]\(?([\w\.-]+)/i], [NAME, VERSION, [TYPE, CLI]]
// wget / curl / Lynx / ELinks / HTTPie / PowerShell
[/(wget|curl|lynx|elinks|httpie|powershell)[\/ ]\(?([\w\.-]+)/i], [NAME, VERSION, [TYPE, CLI]]
]
});

View File

@@ -404,7 +404,9 @@
], [[NAME, /(.+)/, '$1 Secure' + SUFFIX_BROWSER], VERSION], [
/\bfocus\/([\w\.]+)/i // Firefox Focus
], [VERSION, [NAME, FIREFOX+' Focus']], [
/\bopt\/([\w\.]+)/i // Opera Touch
/ mms\/([\w\.]+)$/i // Opera Neon
], [VERSION, [NAME, OPERA+' Neon']], [
/ opt\/([\w\.]+)$/i // Opera Touch
], [VERSION, [NAME, OPERA+' Touch']], [
/coc_coc\w+\/([\w\.]+)/i // Coc Coc Browser
], [VERSION, [NAME, 'Coc Coc']], [
@@ -608,7 +610,7 @@
], [[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, MOBILE]], [
// OnePlus
/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,
/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-l]\w[1m]10)\b/i,
/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i
], [MODEL, [VENDOR, ONEPLUS], [TYPE, MOBILE]], [
@@ -648,7 +650,7 @@
], [MODEL, [VENDOR, MOTOROLA], [TYPE, TABLET]], [
// LG
/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i
/\b(?:lg)?([vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i
], [MODEL, [VENDOR, LG], [TYPE, TABLET]], [
/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,
/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,
@@ -939,7 +941,7 @@
/(presto)\/([\w\.]+)/i, // Presto
/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna/Servo
/ekioh(flow)\/([\w\.]+)/i, // Flow
/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i, // KHTML/Tasman/Links
/(khtml|tasman|links|dillo)[\/ ]\(?([\w\.]+)/i, // KHTML/Tasman/Links/Dillo
/(icab)[\/ ]([23]\.[\d\.]+)/i, // iCab
/\b(libweb)/i // LibWeb
@@ -1001,7 +1003,7 @@
], [VERSION, [NAME, BLACKBERRY]], [
/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i // Symbian
], [VERSION, [NAME, 'Symbian']], [
/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i // Firefox OS
/mozilla\/[\d\.]+ \((?:mobile[;\w ]*|tablet|tv|[^\)]*(?:viera|lg(?:l25|-d300)|alcatel ?o.+|y300-f1)); rv:([\w\.]+)\).+gecko\//i // Firefox OS
], [VERSION, [NAME, FIREFOX+' OS']], [
/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i, // WebOS
/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i
@@ -1017,7 +1019,6 @@
], [[NAME, "Chrome OS"], VERSION],[
// Smart TVs
/panasonic;(viera)/i, // Panasonic Viera
/(netrange)mmh/i, // Netrange
/(nettv)\/(\d+\.[\w\.]+)/i, // NetTV

View File

@@ -1608,6 +1608,16 @@
"major" : "60"
}
},
{
"desc" : "Opera Neon",
"ua" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.21 Safari/537.36 MMS/1.0.2531.0",
"expect" :
{
"name" : "Opera Neon",
"version" : "1.0.2531.0",
"major" : "1"
}
},
{
"desc" : "Opera Tablet",
"ua" : "Opera/9.80 (Windows NT 6.1; Opera Tablet/15165; U; en) Presto/2.8.149 Version/11.1",

View File

@@ -188,6 +188,15 @@
"type": "tablet"
}
},
{
"desc": "LG G Pad F2",
"ua": "Mozilla/5.0 (Linux; Android 7.1.1; LG-LK460 Build/NMF26X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.98 Safari/537.36",
"expect": {
"vendor": "LG",
"model": "LK460",
"type": "tablet"
}
},
{
"desc": "LG Watch Urbane",
"ua": "Mozilla/5.0 Linux; Android 7.1.1; LG Watch Urbane Build/NWD1.180306.004 AppleWebKit/537.36 KHTML, like Gecko Chrome/19.77.34.5 Mobile Safari/537.36",

View File

@@ -170,6 +170,15 @@
"type": "mobile"
}
},
{
"desc": "OnePlus 15",
"ua": "Mozilla/5.0 (Linux; Android 16; PLK110 Build/BP2A.250605.015; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/134.0.6998.135 Mobile Safari/537.36",
"expect": {
"vendor": "OnePlus",
"model": "PLK110",
"type": "mobile"
}
},
{
"desc": "OnePlus Ace",
"ua": "Mozilla/5.0 (Linux; U; Android 15; zh-cn; PGKM10 Build/AP3A.240617.008) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/115.0.5790.168 Mobile Safari/537.36 HeyTapBrowser/40.9.6.2",

View File

@@ -17,6 +17,15 @@
"version" : "57.0.2987.146"
}
},
{
"desc" : "Dillo",
"ua" : "Dillo/3.1.0",
"expect" :
{
"name" : "Dillo",
"version" : "3.1.0"
}
},
{
"desc" : "EdgeHTML",
"ua" : "Mozilla/5.0 (Windows NT 6.4; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36 Edge/12.0",

View File

@@ -59,6 +59,26 @@
"type" : "cli"
}
},
{
"desc" : "PowerShell",
"ua" : "Mozilla/5.0 (Windows NT 10.0; Microsoft Windows 10.0.15063; en-US) PowerShell/6.0.0",
"expect" :
{
"name" : "PowerShell",
"version" : "6.0.0",
"type" : "cli"
}
},
{
"desc" : "PowerShell",
"ua" : "Mozilla/5.0 (Windows NT; Windows NT 10.0; de-DE) WindowsPowerShell/5.1.19041.5737",
"expect" :
{
"name" : "PowerShell",
"version" : "5.1.19041.5737",
"type" : "cli"
}
},
{
"desc" : "wget",
"ua" : "Wget/1.21.1",

View File

@@ -25,5 +25,59 @@
"name" : "Firefox OS",
"version" : "44.0"
}
},
{
"desc" : "Firefox OS on Alcatel One Touch Fire",
"ua" : "Mozilla/5.0 (Mobile; ALCATELOneTouch4012X; rv:18.1) Gecko/18.1 Firefox/18.1",
"expect" :
{
"name" : "Firefox OS",
"version" : "18.1"
}
},
{
"desc" : "Firefox OS on Huawei Y300II",
"ua" : "Mozilla/5.0 (Mobile; HUAWEIY300-F1; rv:18.1) Gecko/18.1 Firefox/18.1",
"expect" :
{
"name" : "Firefox OS",
"version" : "18.1"
}
},
{
"desc" : "Firefox OS on LG Fireweb",
"ua" : "Mozilla/5.0 (Mobile; LG-D300; rv:18.1) Gecko/18.1 Firefox/18.1",
"expect" :
{
"name" : "Firefox OS",
"version" : "18.1"
}
},
{
"desc" : "Firefox OS on LG FX0",
"ua" : "Mozilla/5.0 (Mobile; LGL25; rv:32.0) Gecko/32.0 Firefox/32.0",
"expect" :
{
"name" : "Firefox OS",
"version" : "32.0"
}
},
{
"desc" : "Firefox OS on Panasonic Viera TV",
"ua" : "Mozilla/5.0 (Linux; Viera; rv:34.0) Gecko/20100101 Firefox/34.0",
"expect" :
{
"name" : "Firefox OS",
"version" : "34.0"
}
},
{
"desc" : "Firefox OS on ZTE Open",
"ua" : "Mozilla/5.0 (Mobile; ZTEOPEN; rv:18.1) Gecko/18.1 Firefox/18.1",
"expect" :
{
"name" : "Firefox OS",
"version" : "18.1"
}
}
]

View File

@@ -7,5 +7,14 @@
"name" : "FreeBSD",
"version" : "undefined"
}
},
{
"desc" : "FreeBSD",
"ua" : "Mozilla/5.0 (X11; FreeBSD; U; Viera; pl-PL) AppleWebKit/537.11 (KHTML, like Gecko) Viera/3.3.3 Chrome/23.0.1271.97 Safari/537.11",
"expect" :
{
"name" : "FreeBSD",
"version" : "undefined"
}
}
]