Skip to content

Commit

Permalink
Fix engine detection on old Qwant iOS versions. (#7567)
Browse files Browse the repository at this point in the history
* Fix engine detection on old Qwant iOS versions.
* Fix a test case I missed.
* Add a separate regex for Chromium Qwant.
* Set Qwant family to null since it could be either Chrome or Firefox.
---------
Co-authored-by: Tutik Alexsandr <sanchezzzhak@ya.ru>
  • Loading branch information
JBYoshi authored Feb 9, 2024
1 parent 2fc30be commit 1ee6ef1
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Parser/Client/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -640,8 +640,8 @@ class Browser extends AbstractClientParser
'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
16 changes: 8 additions & 8 deletions Tests/Parser/Client/fixtures/browser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1852,7 +1852,7 @@
version: "2.5"
engine: Gecko
engine_version: "63.0"
family: Firefox
family: null
-
user_agent: Mozilla/5.0 (Macintosh; PPC Mac OS X 10.5; FPR10; rv:45.0) Gecko/20100101 Firefox/45.0 TenFourFox/G5
client:
Expand Down Expand Up @@ -2012,9 +2012,9 @@
type: browser
name: Qwant Mobile
version: "1.3"
engine: Gecko
engine_version: ""
family: Firefox
engine: WebKit
engine_version: "604.1.38"
family: null
-
user_agent: Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) OPiOS/8.0.1.80062 Mobile/11D201 Safari/9537.53
client:
Expand Down Expand Up @@ -2786,9 +2786,9 @@
type: browser
name: Qwant Mobile
version: "1.1"
engine: Gecko
engine_version: ""
family: Firefox
engine: Blink
engine_version: "53.0.2785.143"
family: null
-
user_agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Sizzy/0.0.21 Chrome/73.0.3683.121 Electron/5.0.2 Safari/537.36
client:
Expand Down Expand Up @@ -3553,7 +3553,7 @@
version: 2.4.1
engine: WebKit
engine_version: 603.3.8
family: Firefox
family: null
-
user_agent: Mozilla/5.0 (X11; HasCodingOs 1.0; Linux x64) AppleWebKit/637.36 (KHTML, like Gecko) Chrome/70.0.3112.101 Safari/637.36 HasBrowser/5.0
client:
Expand Down
2 changes: 1 addition & 1 deletion Tests/fixtures/smartphone-2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
brand: Apple
model: iPhone
os_family: iOS
browser_family: Firefox
browser_family: Unknown
-
user_agent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; de-de) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7D11 Safari/528.16
os:
Expand Down
4 changes: 2 additions & 2 deletions Tests/fixtures/smartphone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
brand: ""
model: ""
os_family: Android
browser_family: Firefox
browser_family: Unknown
-
user_agent: Mozilla/5.0 (Linux; Android 6.0.1) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Web Explorer/2.6.1 Chrome/74.0.3729.157 Mobile Safari/537.36
os:
Expand Down Expand Up @@ -178,7 +178,7 @@
brand: ""
model: ""
os_family: Android
browser_family: Firefox
browser_family: Unknown
-
user_agent: Mozilla/5.0 (Linux; Android 9) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.92 Mobile Safari/537.36 DuckDuckGo/5
os:
Expand Down
7 changes: 6 additions & 1 deletion regexes/client/browsers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1150,11 +1150,16 @@
version: '$1'
engine:
default: 'WebKit'
- regex: 'Chrome/.*QwantMobile(?:/(\d+[\.\d]+))?'
name: 'Qwant Mobile'
version: '$1'
engine:
default: 'Blink'
- regex: 'QwantMobile(?:/(\d+[\.\d]+))?'
name: 'Qwant Mobile'
version: '$1'
engine:
default: 'Gecko'
default: '' # multiple (Gecko on Android, WebKit on iOS)
- regex: 'Qwant/(\d+[\.\d]+)'
name: 'Qwant Mobile'
version: '$1'
Expand Down

0 comments on commit 1ee6ef1

Please sign in to comment.