Skip to content

Commit

Permalink
Improves version detection for iOS, macOS and Iridium (#7572)
Browse files Browse the repository at this point in the history
* Improves version detection for Iridium
* Improves version detection for iOS and macOS
  • Loading branch information
liviuconcioiu committed Feb 1, 2024
1 parent cee4101 commit 59fb555
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 9 deletions.
12 changes: 3 additions & 9 deletions Parser/Client/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -816,15 +816,9 @@ public function parse(): ?array
// 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 (0 === \strpos($version, '2020')
|| 0 === \strpos($version, '2021')
|| 0 === \strpos($version, '2022')
|| 0 === \strpos($version, '2023')
) {
$name = 'Iridium';
$short = 'I1';
$engine = $browserFromUserAgent['engine'];
$engineVersion = $browserFromUserAgent['engine_version'];
if (\preg_match('/^202[0-4]/', $version)) {
$name = 'Iridium';
$short = 'I1';
}

if ('Atom' === $name || 'Huawei Browser' === $name) {
Expand Down
11 changes: 11 additions & 0 deletions Tests/Parser/Client/fixtures/browser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7926,3 +7926,14 @@
family: Chrome
headers:
Sec-CH-UA: '"Not_A Brand";v="8.0.0.0", "Chromium";v="120.0.6099.230", "DuckDuckGo";v="120.0.6099.230"'
-
user_agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.224 Safari/537.36
client:
type: browser
name: Iridium
version: "2024.01"
engine: Blink
engine_version: 120.0.6099.224
family: Chrome
headers:
Sec-CH-UA: '" Not A;Brand";v="99.0.0.0", "Chromium";v="2024.01"'
16 changes: 16 additions & 0 deletions Tests/Parser/fixtures/oss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4126,3 +4126,19 @@
version: "14.3"
platform:
family: Mac
-
user_agent: Aloha/1 CFNetwork/1494.0.5 Darwin/23.4.0
os:
name: iOS
short_name: IOS
version: "17.4"
platform:
family: iOS
-
user_agent: Safari/19617.7.20.11.12 CFNetwork/1494.0.5 Darwin/23.4.0
os:
name: Mac
short_name: MAC
version: "14.4"
platform:
family: Mac
4 changes: 4 additions & 0 deletions regexes/oss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,8 @@
- regex: '^(?!com.apple.Safari.SearchHelper|Safari).*CFNetwork/.+ Darwin/(\d+[\.\d]+)(?!.*(?:x86_64|i386|PowerMac|Power%20Macintosh))'
name: 'iOS'
versions:
- regex: 'Darwin/23.4.0'
version: '17.4'
- regex: 'Darwin/23.3.0'
version: '17.3'
- regex: 'Darwin/23.2.0'
Expand Down Expand Up @@ -1100,6 +1102,8 @@
- regex: '(?:CFNetwork|StudioDisplay)/.+Darwin(?:/|; )(?:[\d\.]+).+(?:x86_64|i386|Power%20Macintosh)|(?:x86_64-apple-)?darwin(?:[\d\.]+)|PowerMac|com.apple.Safari.SearchHelper|^Safari'
name: 'Mac'
versions:
- regex: '(?:x86_64-apple-)?Darwin(?:/|; )?23.4.0'
version: '14.4'
- regex: '(?:x86_64-apple-)?Darwin(?:/|; )?23.3.0'
version: '14.3'
- regex: '(?:x86_64-apple-)?Darwin(?:/|; )?23.2.0'
Expand Down

0 comments on commit 59fb555

Please sign in to comment.