Skip to content

Commit

Permalink
Merge branch 'master' into pr/7549
Browse files Browse the repository at this point in the history
  • Loading branch information
liviuconcioiu committed Feb 12, 2024
2 parents 9dc9bda + 0bebea5 commit 8bb0102
Show file tree
Hide file tree
Showing 45 changed files with 4,609 additions and 413 deletions.
6 changes: 3 additions & 3 deletions DeviceDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -948,9 +948,9 @@ protected function parseDevice(): void
if (null === $this->device && 'Android' === $osFamily
&& $this->matchUserAgent('Chrome/[\.0-9]*')
) {
if ($this->matchUserAgent('(?:Mobile|eliboM) Safari/')) {
if ($this->matchUserAgent('(?:Mobile|eliboM)')) {
$this->device = AbstractDeviceParser::DEVICE_TYPE_SMARTPHONE;
} elseif ($this->matchUserAgent('(?!Mobile )Safari/')) {
} else {
$this->device = AbstractDeviceParser::DEVICE_TYPE_TABLET;
}
}
Expand Down Expand Up @@ -1052,7 +1052,7 @@ protected function parseDevice(): void
*/
if (\in_array($clientName, [
'Kylo', 'Espial TV Browser', 'LUJO TV Browser', 'LogicUI TV Browser', 'Open TV Browser', 'Seraphic Sraf',
'Opera Devices',
'Opera Devices', 'Crow Browser', 'Vewd Browser',
])
) {
$this->device = AbstractDeviceParser::DEVICE_TYPE_TV;
Expand Down
61 changes: 45 additions & 16 deletions Parser/Client/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class Browser extends AbstractClientParser
'AB' => 'ABrowse',
'BW' => 'AdBlock Browser',
'A7' => 'Adult Browser',
'A9' => 'Airfind Secure Browser',
'AF' => 'ANT Fresco',
'AG' => 'ANTGalio',
'AL' => 'Aloha Browser',
Expand All @@ -101,6 +102,7 @@ class Browser extends AbstractClientParser
'AV' => 'Amiga Voyager',
'AW' => 'Amiga Aweb',
'PN' => 'APN Browser',
'RA' => 'Arc',
'AI' => 'Arvin',
'AK' => 'Ask.com',
'AU' => 'Asus Browser',
Expand All @@ -113,6 +115,7 @@ class Browser extends AbstractClientParser
'A1' => 'AwoX',
'BA' => 'Beaker Browser',
'BM' => 'Beamrise',
'F7' => 'BF Browser',
'BB' => 'BlackBerry Browser',
'H1' => 'BrowseHere',
'B8' => 'Browser Hup Pro',
Expand All @@ -135,14 +138,15 @@ class Browser extends AbstractClientParser
'BN' => 'Borealis Navigator',
'BR' => 'Brave',
'BK' => 'BriskBard',
'K2' => 'BroKeep Browser',
'B3' => 'Browspeed Browser',
'BX' => 'BrowseX',
'BZ' => 'Browzar',
'B7' => 'Browlser',
'4B' => 'BrowsBit',
'BY' => 'Biyubi',
'BF' => 'Byffox',
'B4' => 'BF Browser',
'B4' => 'BXE Browser',
'CA' => 'Camino',
'0C' => 'Cave Browser',
'CL' => 'CCleaner',
Expand Down Expand Up @@ -177,6 +181,7 @@ class Browser extends AbstractClientParser
'C5' => 'Chromium GOST',
'CY' => 'Cyberfox',
'CS' => 'Cheshire',
'RC' => 'Crow Browser',
'CT' => 'Crusta',
'CG' => 'Craving Explorer',
'CZ' => 'Crazy Browser',
Expand All @@ -193,6 +198,7 @@ class Browser extends AbstractClientParser
'DT' => 'Delta Browser',
'D0' => 'Desi Browser',
'DS' => 'DeskBrowse',
'D2' => 'DoCoMo',
'DF' => 'Dolphin',
'DZ' => 'Dolphin Zero',
'DO' => 'Dorado',
Expand All @@ -215,6 +221,7 @@ class Browser extends AbstractClientParser
'EP' => 'GNOME Web',
'G1' => 'G Browser',
'ES' => 'Espial TV Browser',
'FG' => 'fGet',
'FA' => 'Falkon',
'FX' => 'Faux Browser',
'F4' => 'Fiery Browser',
Expand All @@ -240,13 +247,15 @@ class Browser extends AbstractClientParser
'F5' => 'Flyperlink',
'FU' => 'FreeU',
'F6' => 'Freedom Browser',
'FT' => 'Frost',
'F3' => 'Frost+',
'FI' => 'Fulldive',
'GA' => 'Galeon',
'G8' => 'Gener8',
'GH' => 'Ghostery Privacy Browser',
'GI' => 'GinxDroid Browser',
'GB' => 'Glass Browser',
'GD' => 'Godzilla Browser',
'GE' => 'Google Earth',
'GP' => 'Google Earth Pro',
'GO' => 'GOG Galaxy',
Expand Down Expand Up @@ -278,6 +287,7 @@ class Browser extends AbstractClientParser
'IV' => 'Isivioo',
'I8' => 'IVVI Browser',
'IW' => 'Iceweasel',
'N3' => 'Incognito Browser',
'IN' => 'Inspect Browser',
'I9' => 'Insta Browser',
'IE' => 'Internet Explorer',
Expand Down Expand Up @@ -369,6 +379,8 @@ class Browser extends AbstractClientParser
'WR' => 'NextWord Browser',
'NT' => 'NTENT Browser',
'NU' => 'Nuanti Meta',
'NI' => 'Nuviu',
'O9' => 'Ocean Browser',
'OC' => 'Oculus Browser',
'O6' => 'Odd Browser',
'O1' => 'Opera Mini iOS',
Expand Down Expand Up @@ -428,12 +440,14 @@ class Browser extends AbstractClientParser
'LY' => 'PolyBrowser',
'PI' => 'PrivacyWall',
'P4' => 'Privacy Explorer Fast Safe',
'P3' => 'Private Internet Browser',
'P2' => 'Pi Browser',
'P0' => 'PronHub Browser',
'PC' => 'PSI Secure Browser',
'RW' => 'Reqwireless WebViewer',
'PS' => 'Microsoft Edge',
'QA' => 'Qazweb',
'Q3' => 'Qmamu',
'Q2' => 'QQ Browser Lite',
'Q1' => 'QQ Browser Mini',
'QQ' => 'QQ Browser',
Expand Down Expand Up @@ -478,6 +492,7 @@ class Browser extends AbstractClientParser
'S7' => 'SP Browser',
'9S' => 'Sony Small Browser',
'8S' => 'Secure Private Browser',
'X2' => 'SecureX',
'T1' => 'Stampy Browser',
'7S' => '7Star',
'SQ' => 'Smart Browser',
Expand Down Expand Up @@ -508,6 +523,7 @@ class Browser extends AbstractClientParser
'TR' => 'T-Browser',
'TO' => 't-online.de Browser',
'TA' => 'Tao Browser',
'TH' => 'Thor',
'1T' => 'Tor Browser',
'TF' => 'TenFourFox',
'TB' => 'Tenta Browser',
Expand All @@ -532,6 +548,7 @@ class Browser extends AbstractClientParser
'V0' => 'vBrowser',
'VA' => 'Vast Browser',
'VE' => 'Venus Browser',
'WD' => 'Vewd Browser',
'N0' => 'Nova Video Downloader Pro',
'VS' => 'Viasat Browser',
'VI' => 'Vivaldi',
Expand Down Expand Up @@ -616,14 +633,15 @@ class Browser extends AbstractClientParser
'XB', 'W1', 'HT', 'B8', 'F5', 'B9', 'WA', 'T0', 'HC',
'O6', 'P7', 'LJ', 'LC', 'O7', 'N2', 'A8', 'P8', 'RB',
'1W', 'EV', 'I9', 'V4', 'H4', '1T', 'M5', '0S', '0C',
'ZR', 'D6', 'F6',
'ZR', 'D6', 'F6', 'RC', 'WD', 'P3', 'FT', 'A9', 'X2',
'N3', 'GD', 'O9', 'Q3', 'F7', 'K2',
],
'Firefox' => [
'AX', 'BI', 'BF', 'BH', 'BN', 'C0', 'CU', 'EI', 'F1',
'FB', 'FE', 'FF', 'FM', 'FR', 'FY', 'GZ', 'I4', 'IF',
'IW', 'LH', 'LY', 'MB', 'MN', 'MO', 'MY', 'OA', 'OS',
'PI', 'PX', 'QA', 'QM', 'S5', 'SX', 'TF', 'TO', 'WF',
'ZV', 'FP', 'AD', 'WL',
'PI', 'PX', 'QA', 'S5', 'SX', 'TF', 'TO', 'WF', 'ZV',
'FP', 'AD', 'WL',
],
'Internet Explorer' => ['BZ', 'CZ', 'IE', 'IM', 'PS'],
'Konqueror' => ['KO'],
Expand Down Expand Up @@ -656,7 +674,8 @@ class Browser extends AbstractClientParser
'DM', '1M', 'A7', 'XN', 'XT', 'XB', 'W1', 'HT', 'B7',
'B9', 'T0', 'I8', 'O6', 'P7', 'O8', '4B', 'A8', 'P8',
'1W', 'EV', 'Z0', 'I9', 'V4', 'H4', 'M5', '0S', '0C',
'ZR', 'D6', 'F6',
'ZR', 'D6', 'F6', 'P3', 'FT', 'A9', 'X2', 'NI', 'FG',
'TH', 'N3', 'GD', 'O9', 'Q3', 'F7', 'K2',
];

/**
Expand All @@ -665,7 +684,9 @@ class Browser extends AbstractClientParser
* @var array<string, array<string>>
*/
protected static $clientHintMapping = [
'Chrome' => ['Google Chrome'],
'Chrome' => ['Google Chrome'],
'Vewd Browser' => ['Vewd Core'],
'DuckDuckGo Privacy Browser' => ['DuckDuckGo'],
];

/**
Expand Down Expand Up @@ -807,19 +828,27 @@ public function parse(): ?array
$engine = '';
$engineVersion = '';

// If version from client hints report 2022 or 2022.04, then is the Iridium browser
// https://iridiumbrowser.de/news/2022/05/16/version-2022-04-released
if ('2021.12' === $version || '2022' === $version || '2022.04' === $version) {
$name = 'Iridium';
$short = 'I1';
$engine = $browserFromUserAgent['engine'];
$engineVersion = $browserFromUserAgent['engine_version'];
// If the version reported from the client hints is YYYY or YYYY.MM (e.g., 2022 or 2022.04),
// then it is the Iridium browser
// https://iridiumbrowser.de/news/
if (\preg_match('/^202[0-4]/', $version)) {
$name = 'Iridium';
$short = 'I1';
}

if ('Atom' === $name || 'Huawei Browser' === $name) {
$version = $browserFromUserAgent['version'];
}

if ('DuckDuckGo Privacy Browser' === $name) {
$version = '';
}

if ('Vewd Browser' === $name) {
$engine = $browserFromUserAgent['engine'] ?? '';
$engineVersion = $browserFromUserAgent['engine_version'] ?? '';
}

// If client hints report Chromium, but user agent detects a Chromium based browser, we favor this instead
if ('Chromium' === $name
&& !empty($browserFromUserAgent['name'])
Expand All @@ -836,7 +865,7 @@ public function parse(): ?array
$short = $browserFromUserAgent['short_name'];
}

// If useragent detects another browser, but the family matches, we use the detected engine from useragent
// If user agent detects another browser, but the family matches, we use the detected engine from user agent
if ($name !== $browserFromUserAgent['name']
&& self::getBrowserFamily($name) === self::getBrowserFamily($browserFromUserAgent['name'])
) {
Expand Down Expand Up @@ -943,7 +972,7 @@ protected function parseBrowserFromClientHints(): array
}
}

// If we detected a brand, that is not chromium, we will use it, otherwise we will look further
// If we detected a brand, that is not Chromium, we will use it, otherwise we will look further
if ('' !== $name && 'Chromium' !== $name) {
break;
}
Expand All @@ -960,7 +989,7 @@ protected function parseBrowserFromClientHints(): array
}

/**
* Returns the browser that can be detected from useragent
* Returns the browser that can be detected from user agent
*
* @return array
*
Expand Down
7 changes: 7 additions & 0 deletions Parser/Device/AbstractDeviceParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ abstract class AbstractDeviceParser extends AbstractParser
'B1' => 'Bush',
'4Q' => 'Bundy',
'Y8' => 'Bubblegum',
'BMW' => 'BMW',
'C9' => 'CAGI',
'CT' => 'Capitel',
'G3' => 'CG Mobile',
Expand Down Expand Up @@ -734,6 +735,7 @@ abstract class AbstractDeviceParser extends AbstractParser
'IM' => 'i-mate',
'IO' => 'i-mobile',
'INN' => 'I-INN',
'IPL' => 'I-Plus',
'OF' => 'iOutdoor',
'IB' => 'iBall',
'IY' => 'iBerry',
Expand Down Expand Up @@ -815,6 +817,7 @@ abstract class AbstractDeviceParser extends AbstractParser
'JA' => 'JAY-Tech',
'KJ' => 'Jiake',
'JD' => 'Jedi',
'JEE' => 'Jeep',
'J6' => 'Jeka',
'JF' => 'JFone',
'JI' => 'Jiayu',
Expand Down Expand Up @@ -992,6 +995,7 @@ abstract class AbstractDeviceParser extends AbstractParser
'M3' => 'Mecer',
'M3M' => 'M3 Mobile',
'0M' => 'Mecool',
'MEM' => 'MeMobile',
'MC' => 'Mediacom',
'MK' => 'MediaTek',
'MD' => 'Medion',
Expand Down Expand Up @@ -1545,6 +1549,7 @@ abstract class AbstractDeviceParser extends AbstractParser
'T2' => 'Telenor',
'TE' => 'Telit',
'65' => 'Telia',
'TLY' => 'Telly',
'TEL' => 'Telma',
'PW' => 'Telpo',
'TLS' => 'TeloSystems',
Expand Down Expand Up @@ -1722,6 +1727,8 @@ abstract class AbstractDeviceParser extends AbstractParser
'VY' => 'Voyo',
'VOL' => 'Völfen',
'VO1' => 'Volt',
'VOP' => 'Volla',
'V02' => 'VOLIA',
'VH' => 'Vsmart',
'V9' => 'Vsun',
'VU' => 'Vulcan',
Expand Down
3 changes: 2 additions & 1 deletion Parser/OperatingSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class OperatingSystem extends AbstractParser
'QNX' => 'BlackBerry Tablet OS',
'BOS' => 'Bliss OS',
'BMP' => 'Brew',
'BSN' => 'BrightSignOS',
'CAI' => 'Caixa Mágica',
'CES' => 'CentOS',
'CST' => 'CentOS Stream',
Expand Down Expand Up @@ -208,7 +209,7 @@ class OperatingSystem extends AbstractParser
'ORD', 'TOS', 'RSO', 'DEE', 'FRE', 'MAG', 'FEN', 'CAI', 'PCL', 'HAS',
'LOS', 'DVK', 'ROK', 'OWR', 'OTV', 'KTV', 'PUR', 'PLA', 'FUC', 'PAR',
'FOR', 'MON', 'KAN', 'ZEN', 'LND', 'LNS', 'CHN', 'AMZ', 'TEN', 'CST',
'NOV', 'ROU', 'ZOR', 'RED', 'KAL', 'ORA', 'VID', 'TIV',
'NOV', 'ROU', 'ZOR', 'RED', 'KAL', 'ORA', 'VID', 'TIV', 'BSN',
],
'Mac' => ['MAC'],
'Mobile Gaming Console' => ['PSP', 'NDS', 'XBX'],
Expand Down
Loading

0 comments on commit 8bb0102

Please sign in to comment.