Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
Add detection for Chromium and fix inaccurate Ubuntu detection.
Browse files Browse the repository at this point in the history
Closes #157.
  • Loading branch information
bnjmnt4n committed Jun 24, 2020
1 parent c66b547 commit 8c56eeb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@
{ 'label': 'Opera Mini', 'pattern': 'OPiOS' },
'Opera',
{ 'label': 'Opera', 'pattern': 'OPR' },
'Chromium',
'Chrome',
{ 'label': 'Chrome Mobile', 'pattern': '(?:CriOS|CrMo)' },
{ 'label': 'Firefox', 'pattern': '(?:Firefox|Minefield)' },
Expand Down Expand Up @@ -972,6 +973,10 @@
ua.indexOf('/' + data + '-') > -1) {
os = trim(os.replace(data, ''));
}
// Ensure OS does not include the browser name.
if (os && os.indexOf(name) != -1) && !RegExp(name + ' OS').test(os)) {
os = os.replace(RegExp(' *' + qualify(name) + ' *'), '');
}
// Add layout engine.
if (layout && !/\b(?:Avant|Nook)\b/.test(name) && (
/Browser|Lunascape|Maxthon/.test(name) ||
Expand Down
8 changes: 8 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,14 @@
'os': 'iOS 4.3+'
},

'Chromium 66.0.3359.181 on Ubuntu 64-bit': {
'ua': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/66.0.3359.181 Chrome/66.0.3359.181 Safari/537.36',
'layout': 'Blink',
'name': 'Chromium',
'os': 'Ubuntu 64-bit',
'version': '66.0.3359.181'
},

'Electron 1.4.5 (Chromium 53.0.2785.113; Node 6.5.0) on Windows 10 64-bit': {
'ua': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) electron-app/1.0.0 Chrome/53.0.2785.113 Electron/1.4.5 Safari/537.36',
'global': {},
Expand Down

0 comments on commit 8c56eeb

Please sign in to comment.