From 4bec497b25230cb09e1d96c134bbb1d8462d8d82 Mon Sep 17 00:00:00 2001 From: Liviu-Mihail Concioiu Date: Mon, 7 Mar 2022 18:13:10 +0100 Subject: [PATCH] Adds detection for China OS, PocketBook Browser, improves detection for Linux, Android Browser, Tizen Browser (#7032) * Adds detection for COS (China Operating System) * Improves Linux detection * Fix os family * Improves detection for Android Browser * Rename COS to China OS * Adds detection for PocketBook Browser * Improves detection for Tizen Browser * Add browser test Co-authored-by: Tutik Alexsandr --- Parser/Client/Browser.php | 3 +- Parser/OperatingSystem.php | 3 +- Tests/Parser/Client/fixtures/browser.yml | 9 +++ Tests/Parser/fixtures/oss.yml | 16 +++++ Tests/fixtures/smartphone-24.yml | 6 +- Tests/fixtures/tablet-3.yml | 79 +++++++++++++----------- regexes/client/browsers.yml | 11 +++- regexes/oss.yml | 11 +++- 8 files changed, 92 insertions(+), 46 deletions(-) diff --git a/Parser/Client/Browser.php b/Parser/Client/Browser.php index 21644f7746..038ed765fc 100644 --- a/Parser/Client/Browser.php +++ b/Parser/Client/Browser.php @@ -293,6 +293,7 @@ class Browser extends AbstractClientParser 'PX' => 'Phoenix', 'PB' => 'Phoenix Browser', 'PF' => 'PlayFree Browser', + 'PK' => 'PocketBook Browser', 'PO' => 'Polaris', 'PT' => 'Polarity', 'LY' => 'PolyBrowser', @@ -456,7 +457,7 @@ class Browser extends AbstractClientParser 'PE', 'QU', 'RE', 'S0', 'S7', 'SA', 'SB', 'SG', 'SK', 'ST', 'SU', 'T1', 'UH', 'UM', 'UT', 'VE', 'VV', 'WI', 'WP', 'YN', 'IO', 'IS', 'HQ', 'RW', 'HI', 'NA', 'BW', - 'YO', + 'YO', 'PK', ]; /** diff --git a/Parser/OperatingSystem.php b/Parser/OperatingSystem.php index d07fdf86b4..68e3310740 100644 --- a/Parser/OperatingSystem.php +++ b/Parser/OperatingSystem.php @@ -54,6 +54,7 @@ class OperatingSystem extends AbstractParser 'CES' => 'CentOS', 'CLR' => 'ClearOS Mobile', 'COS' => 'Chrome OS', + 'CHN' => 'China OS', 'CYN' => 'CyanogenMod', 'DEB' => 'Debian', 'DEE' => 'Deepin', @@ -184,7 +185,7 @@ class OperatingSystem extends AbstractParser 'RHT', 'VLN', 'MDR', 'GNT', 'SAB', 'SLW', 'SSE', 'CES', 'BTR', 'SAF', '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', + 'FOR', 'MON', 'KAN', 'ZEN', 'LND', 'LNS', 'CHN', ], 'Mac' => ['MAC'], 'Mobile Gaming Console' => ['PSP', 'NDS', 'XBX'], diff --git a/Tests/Parser/Client/fixtures/browser.yml b/Tests/Parser/Client/fixtures/browser.yml index 08e11102b6..69b8a9dc02 100644 --- a/Tests/Parser/Client/fixtures/browser.yml +++ b/Tests/Parser/Client/fixtures/browser.yml @@ -4445,3 +4445,12 @@ engine: Blink engine_version: "" family: Chrome +- + user_agent: Mozilla/5.0 (Linux; en_US) AppleWebKit/534.34 PocketBook/801 (screen 600x800; FW W801.4.1.886) + client: + type: browser + name: PocketBook Browser + version: "" + engine: WebKit + engine_version: "534.34" + family: diff --git a/Tests/Parser/fixtures/oss.yml b/Tests/Parser/fixtures/oss.yml index d0392547b6..5df3f51561 100644 --- a/Tests/Parser/fixtures/oss.yml +++ b/Tests/Parser/fixtures/oss.yml @@ -3271,3 +3271,19 @@ version: "10" platform: family: Android +- + user_agent: Mozilla/5.0 (Linux; U; COS like Android 4.1.2; zh_CN; 909d Build/JRO03C) AppleWebKit/537.17 (KHTML, like Gecko) COSBrowser/1.0.0 Version/4.0 Mobile Safari/537.17 + os: + name: China OS + short_name: CHN + version: "" + platform: + family: GNU/Linux +- + user_agent: Mozilla/5.0 (Linux; Ubuntu 15.04 like Android 4.4) AppleWebKit/537.36 Chromium/35.0.1870.2 Mobile Safari/537.36 + os: + name: Ubuntu + short_name: UBT + version: "15.04" + platform: + family: GNU/Linux diff --git a/Tests/fixtures/smartphone-24.yml b/Tests/fixtures/smartphone-24.yml index 8edbd8a3f7..0d0dc2c09b 100644 --- a/Tests/fixtures/smartphone-24.yml +++ b/Tests/fixtures/smartphone-24.yml @@ -2402,8 +2402,8 @@ platform: "" client: type: browser - name: Android Browser - version: "" + name: Tizen Browser + version: "2.2" engine: WebKit engine_version: "537.3" device: @@ -2411,7 +2411,7 @@ brand: Samsung model: SM-Z9005 os_family: Other Mobile - browser_family: Android Browser + browser_family: Unknown - user_agent: Mozilla/5.0 (Linux; Android 9; LEX820) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36 OPR/56.1.2780.51589 os: diff --git a/Tests/fixtures/tablet-3.yml b/Tests/fixtures/tablet-3.yml index 55b0416742..2f2b28cf83 100644 --- a/Tests/fixtures/tablet-3.yml +++ b/Tests/fixtures/tablet-3.yml @@ -9533,12 +9533,12 @@ - user_agent: Mozilla/5.0 (Linux like Android; en_US) AppleWebkit/538.1 PocketBook/641 (screen 758x1024; FW U641.5.18.72) Mobile os: - name: Android + name: GNU/Linux version: "" platform: "" client: type: browser - name: Android Browser + name: PocketBook Browser version: "" engine: WebKit engine_version: "538.1" @@ -9546,17 +9546,17 @@ type: tablet brand: PocketBook model: "641" - os_family: Android - browser_family: Android Browser + os_family: GNU/Linux + browser_family: Unknown - user_agent: Mozilla/5.0 (Linux like Android; ru_RU) AppleWebKit/534.34 PocketBook/630 (screen 758x1024; FW R630.5.2.375) Mobile os: - name: Android + name: GNU/Linux version: "" platform: "" client: type: browser - name: Android Browser + name: PocketBook Browser version: "" engine: WebKit engine_version: "534.34" @@ -9564,17 +9564,17 @@ type: tablet brand: PocketBook model: "630" - os_family: Android - browser_family: Android Browser + os_family: GNU/Linux + browser_family: Unknown - user_agent: Mozilla/5.0 (Linux like Android; ru_RU) AppleWebKit/534.34 PocketBook/622 (screen 600x800; FW E622.4.4.566) Mobile os: - name: Android + name: GNU/Linux version: "" platform: "" client: type: browser - name: Android Browser + name: PocketBook Browser version: "" engine: WebKit engine_version: "534.34" @@ -9582,17 +9582,17 @@ type: tablet brand: PocketBook model: "622" - os_family: Android - browser_family: Android Browser + os_family: GNU/Linux + browser_family: Unknown - user_agent: Mozilla/5.0 (Linux like Android; en_US) AppleWebKit/534.34 PocketBook/650 (screen 758x1024; FW E650.5.0.329) Mobile os: - name: Android + name: GNU/Linux version: "" platform: "" client: type: browser - name: Android Browser + name: PocketBook Browser version: "" engine: WebKit engine_version: "534.34" @@ -9600,17 +9600,17 @@ type: tablet brand: PocketBook model: "650" - os_family: Android - browser_family: Android Browser + os_family: GNU/Linux + browser_family: Unknown - user_agent: Mozilla/5.0 (Linux like Android; en_US) AppleWebKit/534.34 PocketBook/640 (screen 600x800; FW W640.4.4.530) Mobile os: - name: Android + name: GNU/Linux version: "" platform: "" client: type: browser - name: Android Browser + name: PocketBook Browser version: "" engine: WebKit engine_version: "534.34" @@ -9618,17 +9618,17 @@ type: tablet brand: PocketBook model: "640" - os_family: Android - browser_family: Android Browser + os_family: GNU/Linux + browser_family: Unknown - user_agent: Mozilla/5.0 (Linux like Android; en_US) AppleWebKit/534.34 PocketBook/624 (screen 600x800; FW W624.4.4.468) Mobile os: - name: Android + name: GNU/Linux version: "" platform: "" client: type: browser - name: Android Browser + name: PocketBook Browser version: "" engine: WebKit engine_version: "534.34" @@ -9636,17 +9636,17 @@ type: tablet brand: PocketBook model: "624" - os_family: Android - browser_family: Android Browser + os_family: GNU/Linux + browser_family: Unknown - user_agent: Mozilla/5.0 (Linux like Android; en_US) AppleWebKit/534.34 PocketBook/623 (screen 758x1024; FW T623.4.4.616) Mobile os: - name: Android + name: GNU/Linux version: "" platform: "" client: type: browser - name: Android Browser + name: PocketBook Browser version: "" engine: WebKit engine_version: "534.34" @@ -9654,17 +9654,17 @@ type: tablet brand: PocketBook model: "623" - os_family: Android - browser_family: Android Browser + os_family: GNU/Linux + browser_family: Unknown - user_agent: Mozilla/5.0 (Linux like Android; en_US) AppleWebKit/534.34 PocketBook/614 (screen 600x800; FW W515.4.4.540) Mobile os: - name: Android + name: GNU/Linux version: "" platform: "" client: type: browser - name: Android Browser + name: PocketBook Browser version: "" engine: WebKit engine_version: "534.34" @@ -9672,17 +9672,17 @@ type: tablet brand: PocketBook model: "614" - os_family: Android - browser_family: Android Browser + os_family: GNU/Linux + browser_family: Unknown - user_agent: Mozilla/5.0 (Linux like Android; en_US) AppleWebKit/534.34 PocketBook/515 (screen 600x800; FW W515.4.4.540) Mobile os: - name: Android + name: GNU/Linux version: "" platform: "" client: type: browser - name: Android Browser + name: PocketBook Browser version: "" engine: WebKit engine_version: "534.34" @@ -9690,15 +9690,20 @@ type: tablet brand: PocketBook model: "515" - os_family: Android - browser_family: Android Browser + os_family: GNU/Linux + browser_family: Unknown - user_agent: Mozilla/5.0 (Linux; en_US) AppleWebKit/534.34 PocketBook/801 (screen 600x800; FW W801.4.1.886) os: name: GNU/Linux version: "" platform: "" - client: null + client: + type: browser + name: PocketBook Browser + version: "" + engine: WebKit + engine_version: "534.34" device: type: tablet brand: PocketBook diff --git a/regexes/client/browsers.yml b/regexes/client/browsers.yml index f642f85f98..ecf4922f2a 100644 --- a/regexes/client/browsers.yml +++ b/regexes/client/browsers.yml @@ -2062,11 +2062,18 @@ versions: 28: 'Blink' +# PocketBook Browser +- regex: 'PocketBook/' + name: 'PocketBook Browser' + version: '' + engine: + default: 'WebKit' + #Tizen Browser - regex: '(?:Tizen|SLP) ?Browser(?:/(\d+[\.\d]+))?' name: 'Tizen Browser' version: '$1' -- regex: 'Tizen (?:\d+[\.\d]+).+ Version/(\d+[\.\d]+) (?:TV|Mobile)' +- regex: 'Tizen (?:\d+[\.\d]+).+ Version/(\d+[\.\d]+) (?:TV|Mobile|like)' name: 'Tizen Browser' version: '$1' engine: @@ -2444,7 +2451,7 @@ version: '' #Android Browser -- regex: '(?