Skip to content

Commit

Permalink
Improves detection for Android, Chrome OS, iOS and macOS, improves de…
Browse files Browse the repository at this point in the history
…tection for Mobile Safari and Safari (#7981)

* Improves version detection for Android and Chrome OS
* Improves version detection for iOS and macOS
* Improves detection for Safari and Mobile Safari

ref #7979
  • Loading branch information
liviuconcioiu authored Jan 30, 2025
1 parent 05a87ab commit e3779d7
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 9 deletions.
18 changes: 18 additions & 0 deletions Tests/Parser/Client/fixtures/browser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10390,3 +10390,21 @@
engine: WebKit
engine_version: "536.25"
family: ""
-
user_agent: NetworkingExtension/8619.1.26.30.5 Network/4277.2.5 iOS/18.0
client:
type: browser
name: Mobile Safari
version: "18.0"
engine: WebKit
engine_version: ""
family: Safari
-
user_agent: NetworkingExtension/8619.2.8.10.9 CFNetwork/1568.200.51 Darwin/24.1.0
client:
type: browser
name: Safari
version: 8619.2.8.10
engine: WebKit
engine_version: ""
family: Safari
112 changes: 108 additions & 4 deletions Tests/Parser/fixtures/oss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4961,11 +4961,11 @@
-
user_agent: NetworkingExtension/8619.1.10.2 CFNetwork/1555.1 Darwin/24.0.0
os:
name: iOS
short_name: IOS
version: "18.0"
name: Mac
short_name: MAC
version: "15.0"
platform: ""
family: iOS
family: Mac
-
user_agent: Mozilla/5.0 (Linux; U; Android 2.3.4; xx; Baidu Yi on Passion Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) FlyFlow/2.2 Version/4.0 Mobile Safari/533.1
os:
Expand Down Expand Up @@ -5877,3 +5877,107 @@
version: "18.3"
platform: ""
family: iOS
-
user_agent: Mozilla/5.0 (Linux; U; Android-4.0.3; en-us; Galaxy Nexus Build/IML74K) AppleWebKit/535.7 (KHTML, like Gecko) CrMo/16.0.912.75 Mobile Safari/535.7
os:
name: Android
short_name: AND
version: 4.0.3
platform: ""
family: Android
-
user_agent: Mozilla/5.0 (Linux; Android 33; samsung SM-S911B) AppleWebKit/537.36 KHTML, like Gecko) Chrome/131.0.6778.135 Mobile Safari/537.36
os:
name: Android
short_name: AND
version: "13"
platform: ""
family: Android
-
user_agent: Mozilla/5.0 (Linux; Android 34; OPPO CPH2625) AppleWebKit/537.36 KHTML, like Gecko) Chrome/129.0.6668.100 Mobile Safari/537.36
os:
name: Android
short_name: AND
version: "14"
platform: ""
family: Android
-
user_agent: ArcMobile2/52159.2 CFNetwork/1498.700.2 Darwin/23.6.0
os:
name: iOS
short_name: IOS
version: "17.6"
platform: ""
family: iOS
-
user_agent: Safari/19618.3.11.11.5 CFNetwork/1498.700.2 Darwin/23.6.0
os:
name: Mac
short_name: MAC
version: "14.6"
platform: ""
family: Mac
-
user_agent: NetworkingExtension/8618.3.11.10.5 CFNetwork/1498.700.2 Darwin/23.6.0
os:
name: Mac
short_name: MAC
version: "14.6"
platform: ""
family: Mac
-
user_agent: NetworkingExtension/8619.2.8.10.9 CFNetwork/1568.200.51 Darwin/24.1.0
os:
name: Mac
short_name: MAC
version: "15.1"
platform: ""
family: Mac
-
user_agent: NetworkingExtension/8619.1.26.30.5 Network/4277.2.5 iOS/18.0
os:
name: iOS
short_name: IOS
version: "18.0"
platform: ""
family: iOS
-
user_agent: NetworkingExtension/8619.1.26.30.7 Network/4277.2.6 iOS/18.0.1
os:
name: iOS
short_name: IOS
version: 18.0.1
platform: ""
family: iOS
-
user_agent: NetworkingExtension/8619.2.8.10.7 Network/4277.42.2 iOS/18.1
os:
name: iOS
short_name: IOS
version: "18.1"
platform: ""
family: iOS
-
user_agent: NetworkingExtension/8619.2.8.10.9 Network/4277.42.2 iOS/18.1.1
os:
name: iOS
short_name: IOS
version: 18.1.1
platform: ""
family: iOS
-
user_agent: NetworkingExtension/8620.2.4.10.7 Network/4277.82.1 iOS/18.3
os:
name: iOS
short_name: IOS
version: "18.3"
platform: ""
family: iOS
-
user_agent: NetworkingExtension/8620.1.16.10.11 Network/4277.60.255 iOS/18.2.1
os:
name: iOS
short_name: IOS
version: 18.2.1
platform: ""
family: iOS
2 changes: 1 addition & 1 deletion Tests/fixtures/tablet-4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7608,7 +7608,7 @@
user_agent: Mozilla/5.0 Linux; U; Android Android-2.2.1; ru-ru; TB-711A Build/FROYO AppleWebKit/533.1 KHTML, like Gecko Version/4.0 Mobile Safari/533.1
os:
name: Android
version: ""
version: 2.2.1
platform: ""
client:
type: browser
Expand Down
10 changes: 10 additions & 0 deletions regexes/client/browsers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3340,6 +3340,11 @@
version: '$1'
engine:
default: 'WebKit'
- regex: 'NetworkingExtension/.+ Network/.+ iOS/(\d+[.\d]+)'
name: 'Mobile Safari'
version: '$1'
engine:
default: 'WebKit'
- regex: '(?:Version/(\d+\.[.\d]+) .*)?Mobile.*Safari/'
name: 'Mobile Safari'
version: '$1'
Expand All @@ -3355,6 +3360,11 @@
version: '$1'
engine:
default: 'WebKit'
- regex: 'NetworkingExtension/(\d+[.\d]+).+ CFNetwork'
name: 'Safari'
version: '$1'
engine:
default: 'WebKit'

# Dorado
- regex: '(?:\w{1,5}[_ ])?Dorado(?: WAP-Browser)?(?:[/ ]?(\d+[.\d]+))?'
Expand Down
18 changes: 14 additions & 4 deletions regexes/oss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@
version: '$1'

# https://chromiumdash.appspot.com/serving-builds?deviceCategory=ChromeOS
- regex: '(?:Android (?:9|1[0-5])[.\d]*|Linux x86_64); (?:asurada|atlas|brask|brya|cherry|coral|corsola|dedede|drallion|elm|eve|fizz|geralt|grunt|guybrush|hana|hatch|jacuzzi|kalista|kukui|nami|nautilus|nissa|nocturne|octopus|puff|pyro|rammus|reef|rex|sand|sarien|skyrim|snappy|soraka|staryu|strongbad|trogdor|volteer|zork)\)'
- regex: '(?:Android (?:9|1[0-6])[.\d]*|Linux x86_64); (?:asurada|atlas|brask|brya|cherry|coral|corsola|dedede|drallion|elm|eve|fizz|geralt|grunt|guybrush|hana|hatch|jacuzzi|kalista|kukui|nami|nautilus|nissa|nocturne|octopus|puff|pyro|rammus|reef|rex|sand|sarien|skyrim|snappy|soraka|staryu|strongbad|trogdor|volteer|zork)\)'
name: 'Chrome OS'
version: ''

Expand All @@ -748,9 +748,11 @@
##########
# Android SDK Level Api
##########
- regex: '(?:Android API \d+|\d+/tclwebkit(?:\d+[.\d]*)|(?:(?<!\d )Android/\d{2}|(?<!; |\d{4}/)Android (?!1[0-5])\d{2})(?![^ ]))'
- regex: '(?:Android API \d+|\d+/tclwebkit(?:\d+[.\d]*)|(?:(?<!\d )Android/\d{2}|Android (?!1[0-6])\d{2})(?![^; ]))'
name: 'Android'
versions:
- regex: 'Android API 36|36/tclwebkit|Android[ /]36'
version: '16'
- regex: 'Android API 35|35/tclwebkit|Android[ /]35'
version: '15'
- regex: 'Android API 34|34/tclwebkit|Android[ /]34'
Expand Down Expand Up @@ -845,6 +847,10 @@
name: 'Android'
version: '$1'

- regex: 'Android-(\d+[.\d]*);'
name: 'Android'
version: '$1'

- regex: ' Adr |.*(?<!like |/ )Android|Silk-Accelerated=[a-z]{4,5}'
name: 'Android'
version: ''
Expand Down Expand Up @@ -1361,7 +1367,7 @@
name: 'iOS'
version: '$1'

- regex: '^(?!com\.apple\.Safari\.SearchHelper|Safari).*(?:CFNetwork|Mana)/.+ Darwin/(\d+[.\d]+)(?!.*(?:x86_64|i386|PowerMac|Power%20Macintosh))'
- regex: '^(?!com\.apple\.Safari\.SearchHelper|Safari|NetworkingExtension).*(?:CFNetwork|Mana)/.+ Darwin/(\d+[.\d]+)(?!.*(?:x86_64|i386|PowerMac|Power%20Macintosh))'
name: 'iOS'
versions:
- regex: 'Darwin/24\.3\.0'
Expand All @@ -1372,6 +1378,8 @@
version: '18.1'
- regex: 'Darwin/24\.0\.0'
version: '18.0'
- regex: 'Darwin/23\.6\.0'
version: '17.6'
- regex: 'Darwin/23\.5\.0'
version: '17.5'
- regex: 'Darwin/23\.4\.0'
Expand Down Expand Up @@ -1594,7 +1602,7 @@
##########
# Mac
##########
- regex: '(?:CFNetwork|Mana|StudioDisplay)/.+Darwin(?:/|; )(?:[\d.]+).+(?:x86_64|i386|Power%20Macintosh)|(?:x86_64-apple-)?darwin(?:[\d.]+)|C?Python.*Darwin|PowerMac|com\.apple\.Safari\.SearchHelper|^Safari'
- regex: '(?:CFNetwork|Mana|StudioDisplay)/.+Darwin(?:/|; )(?:[\d.]+).+(?:x86_64|i386|Power%20Macintosh)|(?:x86_64-apple-)?darwin(?:[\d.]+)|C?Python.*Darwin|PowerMac|com\.apple\.Safari\.SearchHelper|^(?:NetworkingExtension|Safari)'
name: 'Mac'
versions:
- regex: '(?:x86_64-apple-)?Darwin(?:/|; )?24\.3\.0'
Expand All @@ -1605,6 +1613,8 @@
version: '15.1'
- regex: '(?:x86_64-apple-)?Darwin(?:/|; )?24\.0\.0'
version: '15.0'
- regex: '(?:x86_64-apple-)?Darwin(?:/|; )?23\.6\.0'
version: '14.6'
- regex: '(?:x86_64-apple-)?Darwin(?:/|; )?23\.5\.0'
version: '14.5'
- regex: '(?:x86_64-apple-)?Darwin(?:/|; )?23\.4\.0'
Expand Down

0 comments on commit e3779d7

Please sign in to comment.