Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Adds detection for PICO OS, PICO Browser and Pico 4 device #7477

Merged
merged 5 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions DeviceDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,13 @@ protected function parseDevice(): void
$this->brand = 'Apple';
}

/**
* All devices containing VR fragment are assumed to be a wearable
*/
if (null === $this->device && $this->matchUserAgent(' VR ')) {
$this->device = AbstractDeviceParser::DEVICE_TYPE_WEARABLE;
}

/**
* Chrome on Android passes the device type based on the keyword 'Mobile'
* If it is present the device should be a smartphone, otherwise it's a tablet
Expand Down
5 changes: 3 additions & 2 deletions Parser/Client/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ class Browser extends AbstractClientParser
'PH' => 'Phantom Browser',
'PX' => 'Phoenix',
'PB' => 'Phoenix Browser',
'P8' => 'PICO Browser',
'PF' => 'PlayFree Browser',
'PK' => 'PocketBook Browser',
'PO' => 'Polaris',
Expand Down Expand Up @@ -598,7 +599,7 @@ class Browser extends AbstractClientParser
'HO', 'A5', 'X1', '18', 'B5', 'B6', 'TC', 'A6', '2X',
'F4', 'YG', 'WR', 'NA', 'DM', '1M', 'A7', 'XN', 'XT',
'XB', 'W1', 'HT', 'B8', 'F5', 'B9', 'WA', 'T0', 'HC',
'O6', 'P7', 'LJ', 'LC', 'O7', 'N2', 'A8',
'O6', 'P7', 'LJ', 'LC', 'O7', 'N2', 'A8', 'P8',
],
'Firefox' => [
'AX', 'BI', 'BF', 'BH', 'BN', 'C0', 'CU', 'EI', 'F1',
Expand Down Expand Up @@ -636,7 +637,7 @@ class Browser extends AbstractClientParser
'O4', 'XO', 'U0', 'B0', 'VA', 'X0', 'A5', 'X1', '18',
'B5', 'B6', 'TC', 'A6', '2X', 'F4', 'YG', 'WR', 'NA',
'DM', '1M', 'A7', 'XN', 'XT', 'XB', 'W1', 'HT', 'B7',
'B9', 'T0', 'I8', 'O6', 'P7', 'O8', '4B', 'A8',
'B9', 'T0', 'I8', 'O6', 'P7', 'O8', '4B', 'A8', 'P8',
];

/**
Expand Down
3 changes: 2 additions & 1 deletion Parser/OperatingSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class OperatingSystem extends AbstractParser
'ORD' => 'Ordissimo',
'PAR' => 'Pardus',
'PCL' => 'PCLinuxOS',
'PIC' => 'PICO OS',
'PLA' => 'Plasma Mobile',
'PSP' => 'PlayStation Portable',
'PS3' => 'PlayStation',
Expand Down Expand Up @@ -183,7 +184,7 @@ class OperatingSystem extends AbstractParser
protected static $osFamilies = [
'Android' => [
'AND', 'CYN', 'FIR', 'REM', 'RZD', 'MLD', 'MCD', 'YNS', 'GRI', 'HAR',
'ADR', 'CLR', 'BOS', 'REV', 'LEN', 'SIR', 'RRS', 'WER',
'ADR', 'CLR', 'BOS', 'REV', 'LEN', 'SIR', 'RRS', 'WER', 'PIC',
],
'AmigaOS' => ['AMG', 'MOR'],
'BlackBerry' => ['BLB', 'QNX'],
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 @@ -7603,3 +7603,12 @@
family:
headers:
Sec-CH-UA: '"Chromium";v="110.0.5481.208", "Not A(Brand";v="24.0.0.0", "YaBrowser";v="23.3.1.895"'
-
user_agent: Mozilla/5.0 (X11; Linux x86_64; PICO 4 OS5.4.0 like Quest) AppleWebKit/537.36 (KHTML, like Gecko) PicoBrowser/3.3.22 Chrome/105.0.5195.68 VR Safari/537.36 OculusBrowser/7.0
client:
type: browser
name: PICO Browser
version: 3.3.22
engine: Blink
engine_version: 105.0.5195.68
family: Chrome
8 changes: 8 additions & 0 deletions Tests/Parser/fixtures/oss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3910,3 +3910,11 @@
version: "11"
platform:
family: Android
-
user_agent: Mozilla/5.0 (X11; Linux x86_64; PICO 4 OS5.4.0 like Quest) AppleWebKit/537.36 (KHTML, like Gecko) PicoBrowser/3.3.22 Chrome/105.0.5195.68 VR Safari/537.36 OculusBrowser/7.0
os:
name: PICO OS
short_name: PIC
version: 5.4.0
platform: x64
family: Android
18 changes: 18 additions & 0 deletions Tests/fixtures/wearable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2022,3 +2022,21 @@
model: TicWatch S
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (X11; Linux x86_64; PICO 4 OS5.4.0 like Quest) AppleWebKit/537.36 (KHTML, like Gecko) PicoBrowser/3.3.22 Chrome/105.0.5195.68 VR Safari/537.36 OculusBrowser/7.0
os:
name: PICO OS
version: 5.4.0
platform: x64
client:
type: browser
name: PICO Browser
version: 3.3.22
engine: Blink
engine_version: 105.0.5195.68
device:
type: wearable
brand: Pico
model: "4"
os_family: Android
browser_family: Chrome
7 changes: 7 additions & 0 deletions regexes/client/browsers.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
###############

# PICO Browser (https://www.picoxr.com/)
- regex: 'PicoBrowser/(\d+\.[\.\d]+)'
name: 'PICO Browser'
version: '$1'
engine:
default: 'Blink'

# ALVA (https://oyealva.com/)
- regex: 'Alva/(\d+\.[\.\d]+)'
name: 'ALVA'
Expand Down
8 changes: 4 additions & 4 deletions regexes/device/mobiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6171,7 +6171,7 @@ Cube:

# Meta (https://about.facebook.com/), former Oculus (https://www.oculus.com/)
Meta:
regex: '(?:Pacific|Quest).+OculusBrowser|Standalone HMD'
regex: '(?:Pacific|(?<!like )Quest).+OculusBrowser|Standalone HMD'
device: 'wearable'
models:
- regex: 'Pacific'
Expand All @@ -6183,7 +6183,7 @@ Meta:

# CUBOT (www.cubot.net)
CUBOT:
regex: 'CUBOT|(?<!QUMO )QUEST(?!(?:[0-9]|\s[0-9]))(?: LITE)?|(?:(?<!(?:Redmi|Tegra) )NOTE 7|(?<!Galaxy )NOTE 20(?: PRO)?|RAINBOW 2|KING_KONG_3|KINGKONG [5679]|KINGKONG 5 Pro|ZORRO 001|KINGKONG[_ ](?:MINI2?|POWER)|KING KONG CS|R15_PRO|S550 Pro| CHEETAH| [RX]19|X19 S|(?<!MI )MAX 3|Android 9;(?: [\w-]+;)? (?:J5|MAX 2)|Android [89](?:[\d.]*);(?: [\w-]+;)? R15(?! Dream Mirror)|Android 11;(?: [\w-]+;)? (?:Pocket|NOTE 9|P50)|POCKET 3)(?:[);/ ]|$)'
regex: 'CUBOT|(?<!QUMO |like )QUEST(?!(?:[0-9]|\s[0-9]))(?: LITE)?|(?:(?<!(?:Redmi|Tegra) )NOTE 7|(?<!Galaxy )NOTE 20(?: PRO)?|RAINBOW 2|KING_KONG_3|KINGKONG [5679]|KINGKONG 5 Pro|ZORRO 001|KINGKONG[_ ](?:MINI2?|POWER)|KING KONG CS|R15_PRO|S550 Pro| CHEETAH| [RX]19|X19 S|(?<!MI )MAX 3|Android 9;(?: [\w-]+;)? (?:J5|MAX 2)|Android [89](?:[\d.]*);(?: [\w-]+;)? R15(?! Dream Mirror)|Android 11;(?: [\w-]+;)? (?:Pocket|NOTE 9|P50)|POCKET 3)(?:[);/ ]|$)'
device: 'smartphone'
models:
- regex: 'POCKET (3)'
Expand Down Expand Up @@ -33198,9 +33198,9 @@ Axioo:
device: 'tablet'
model: 'PicoPad $1 3G'

# Pico (pico-interactive.com)
# Pico (https://www.picoxr.com)
Pico:
regex: 'Pico (G2 4K|Neo 3)(?:[);/ ]|$)'
regex: 'Pico (G2 4K|Neo 3|4)(?:[);/ ]|$)'
device: 'wearable'
model: '$1'

Expand Down
7 changes: 7 additions & 0 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
###############

##########
# PICO OS (https://www.picoxr.com/global/software/pico-os)
##########
- regex: 'PICO.+OS(\d+[\.\d]*)'
name: 'PICO OS'
version: '$1'

##########
# RedOS (https://redos.red-soft.ru/)
##########
Expand Down