Skip to content

Commit

Permalink
Adds detection for China OS, PocketBook Browser, improves detection f…
Browse files Browse the repository at this point in the history
…or 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 <[email protected]>
  • Loading branch information
liviuconcioiu and sanchezzzhak authored Mar 7, 2022
1 parent fb0398a commit 4bec497
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 46 deletions.
3 changes: 2 additions & 1 deletion Parser/Client/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
];

/**
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
'CES' => 'CentOS',
'CLR' => 'ClearOS Mobile',
'COS' => 'Chrome OS',
'CHN' => 'China OS',
'CYN' => 'CyanogenMod',
'DEB' => 'Debian',
'DEE' => 'Deepin',
Expand Down Expand Up @@ -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'],
Expand Down
9 changes: 9 additions & 0 deletions Tests/Parser/Client/fixtures/browser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
16 changes: 16 additions & 0 deletions Tests/Parser/fixtures/oss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions Tests/fixtures/smartphone-24.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2402,16 +2402,16 @@
platform: ""
client:
type: browser
name: Android Browser
version: ""
name: Tizen Browser
version: "2.2"
engine: WebKit
engine_version: "537.3"
device:
type: smartphone
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:
Expand Down
79 changes: 42 additions & 37 deletions Tests/fixtures/tablet-3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9533,172 +9533,177 @@
-
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"
device:
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"
device:
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"
device:
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"
device:
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"
device:
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"
device:
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"
device:
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"
device:
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"
device:
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
Expand Down
11 changes: 9 additions & 2 deletions regexes/client/browsers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -2444,7 +2451,7 @@
version: ''

#Android Browser
- regex: '(?<!FreeBSD; U; Viera; like )Android'
- regex: '(?<! like )Android'
name: 'Android Browser'
version: ''
engine:
Expand Down
11 changes: 9 additions & 2 deletions regexes/oss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
# @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
###############

##########
# COS (China Operating System - https://web.archive.org/web/20170825001023/http://www.china-cos.com/)
##########
- regex: ' COS like Android'
name: 'China OS'
version: ''

##########
# ClearOS Mobile (https://www.clearos.com/products/clearos-editions/clearos-mobile)
##########
Expand Down Expand Up @@ -222,7 +229,7 @@
name: 'Android'
version: '$1'

- regex: '(?:(?:Orca-)?Android|Adr|AOSP)[ /]?(?:[a-z]+ )?(\d+[\.\d]*)'
- regex: '(?:(?:Orca-)?(?<!like )Android|Adr|AOSP)[ /]?(?:[a-z]+ )?(\d+[\.\d]*)'
name: 'Android'
version: '$1'

Expand All @@ -238,7 +245,7 @@
name: 'Android'
version: '$1'

- regex: ' Adr |Android|Silk-Accelerated=[a-z]{4,5}'
- regex: ' Adr |(?<!like )Android|Silk-Accelerated=[a-z]{4,5}'
name: 'Android'
version: ''

Expand Down

0 comments on commit 4bec497

Please sign in to comment.