Skip to content

Commit 1cb643d

Browse files
committed
Update Browsers detection
1 parent 830bfa8 commit 1cb643d

1 file changed

Lines changed: 33 additions & 3 deletions

File tree

src/Analyser/Header/Useragent/Browser.js

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ class Browser {
278278
this.data.device.manufacturer = 'Samsung';
279279
this.data.device.model = 'DeX';
280280
this.data.device.identifier = '';
281+
this.data.device.identified |= Constants.id.PATTERN;
281282
this.data.device.type = Constants.deviceType.DESKTOP;
282283
} else {
283284
const channel = Chrome.getChannel('desktop', version);
@@ -1182,6 +1183,15 @@ class Browser {
11821183
this.data.browser.channel = null;
11831184
}
11841185

1186+
if ((match = /UCLite\/([0-9.]*)/u.exec(ua))) {
1187+
this.data.browser.stock = false;
1188+
this.data.browser.name = 'UC Browser';
1189+
this.data.browser.version = new Version({value: match[1], details: 2});
1190+
this.data.browser.type = Constants.browserType.BROWSER;
1191+
1192+
this.data.browser.channel = null;
1193+
}
1194+
11851195
/* U2 is the Proxy service used by UC Browser on low-end phones */
11861196
if (/U2\//u.test(ua)) {
11871197
this.data.browser.stock = false;
@@ -1380,7 +1390,7 @@ class Browser {
13801390

13811391
/* Netfront NX */
13821392

1383-
if ((match = /NX\/([0-9.]*)/u.exec(ua))) {
1393+
if ((match = /NX[/ ]([0-9.]+)/u.exec(ua))) {
13841394
this.data.browser.name = 'NetFront NX';
13851395
this.data.browser.version = new Version({value: match[1], details: 2});
13861396
this.data.browser.type = Constants.browserType.BROWSER;
@@ -1988,14 +1998,28 @@ class Browser {
19881998

19891999
static detectMobileBrowsers(ua) {
19902000
if (
1991-
!/(Ninesky|Skyfire|Dolphin|QQ|360|QHBrowser|Mercury|iBrowser|Puffin|MiniB|MxNitro|Sogou|Xiino|Palmscape|WebPro|Vision)/iu.test(
2001+
!/(Ninesky|Skyfire|Dolphin|QQ|360|QHBrowser|Mercury|iBrowser|Puffin|MiniB|MxNitro|Sogou|Xiino|Palmscape|WebPro|Vision|MiuiBrowser)/iu.test(
19922002
ua
19932003
)
19942004
) {
19952005
return;
19962006
}
19972007

19982008
let match;
2009+
/* Xiaomi MIUI Browser */
2010+
if ((match = /MiuiBrowser\/([0-9.]*)/u.exec(ua))) {
2011+
this.data.browser.name = 'MIUI Browser';
2012+
this.data.browser.version = new Version({value: match[1]});
2013+
this.data.browser.type = Constants.browserType.BROWSER;
2014+
if (!this.data.os.isFamily('Android')) {
2015+
this.data.os.reset();
2016+
this.data.os.name = 'Android';
2017+
this.data.device.manufacturer = 'Xiaomi';
2018+
this.data.device.model = null;
2019+
this.data.device.type = Constants.deviceType.MOBILE;
2020+
}
2021+
}
2022+
19992023
/* NineSky */
20002024

20012025
if ((match = /Ninesky(?:-android-mobile(?:-cn)?)?\/([0-9.]*)/u.exec(ua))) {
@@ -2031,7 +2055,7 @@ class Browser {
20312055

20322056
/* Dolphin HD */
20332057

2034-
if ((match = /Dolphin(?:HDCN)?\/(?:INT|CN)?-?([0-9.]*)/u.exec(ua))) {
2058+
if ((match = /Dolphin(?:HD|Browser)?(?:INT|CN)?\/(?:INT|CN)?-?([0-9.]*)/u.exec(ua))) {
20352059
this.data.browser.name = 'Dolphin';
20362060
this.data.browser.version = new Version({value: match[1]});
20372061
this.data.browser.type = Constants.browserType.BROWSER;
@@ -2108,6 +2132,12 @@ class Browser {
21082132
}
21092133

21102134
/* 360 Phone Browser */
2135+
if (/360 (?:Aphone|Android Phone) Browser/u.test(ua)) {
2136+
this.data.browser.name = 'Qihoo 360 Browser';
2137+
this.data.browser.family = null;
2138+
this.data.browser.channel = '';
2139+
this.data.browser.type = Constants.browserType.BROWSER;
2140+
}
21112141

21122142
if ((match = /360 (?:Aphone|Android Phone) Browser \((?:Version |V)?([0-9.]*)(?:beta)?\)/u.exec(ua))) {
21132143
this.data.browser.name = 'Qihoo 360 Browser';

0 commit comments

Comments
 (0)