Skip to content

Commit

Permalink
Merge branch 'master' into merge-apr-24
Browse files Browse the repository at this point in the history
  • Loading branch information
matAtWork authored May 2, 2024
2 parents 1c320be + cd52910 commit 1565137
Show file tree
Hide file tree
Showing 7 changed files with 449 additions and 53 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
# For more information see: https://github.com/marketplace/actions/setup-node-js-environment

name: CI

Expand All @@ -11,18 +11,15 @@ on:

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [16.x, 18.x, 20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
# cache: 'npm'
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "uap-core",
"description": "The regex file necessary to build language ports of Browserscope's user agent parser.",
"version": "0.16.0",
"version": "0.18.0",
"maintainers": [
{
"name": "Tobie Langel",
Expand All @@ -25,7 +25,7 @@
}
],
"devDependencies": {
"mocha": "^9.2.2",
"mocha": "^10.2.0",
"safe-regex": "^2.1.1",
"uap-ref-impl": "git+https://github.com/ua-parser/uap-ref-impl#master",
"yamlparser": "^0.0.2"
Expand Down
147 changes: 122 additions & 25 deletions regexes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ user_agent_parsers:
# 'Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko) PingdomTMS/0.8.5 Safari/534.34'
- regex: '(PingdomTMS)/(\d+)\.(\d+)\.(\d+)'
family_replacement: 'PingdomBot'
# 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/61.0.3163.100 Chrome/61.0.3163.100 Safari/537.36 PingdomPageSpeed/1.0 (pingbot/2.0; +http://www.pingdom.com/)'
- regex: '(PingdomPageSpeed)/(\d+)\.(\d+)'
family_replacement: 'PingdomBot'

# PTST / WebPageTest.org crawlers
- regex: ' (PTST)/(\d+)(?:\.(\d+)|)$'
Expand Down Expand Up @@ -214,14 +217,14 @@ user_agent_parsers:
family_replacement: 'Twitter'

# Phantom app
- regex: 'Mozilla.{1,200}Mobile.{1,100}(Phantom\/ios|android).(\d+)\.(\d+)\.(\d+)'
- regex: 'Mozilla.{1,200}Mobile.{1,100}(Phantom\/ios|Phantom\/android).(\d+)\.(\d+)\.(\d+)'
family_replacement: 'Phantom'

# aspiegel.com spider (owned by Huawei)
- regex: 'Mozilla.{1,100}Mobile.{1,100}AspiegelBot'
# aspiegel.com spider (owned by Huawei, later called PetalBot)
- regex: 'Mozilla.{1,100}Mobile.{1,100}(AspiegelBot|PetalBot)'
family_replacement: 'Spider'

- regex: 'AspiegelBot'
- regex: 'AspiegelBot|PetalBot'
family_replacement: 'Spider'

# Basilisk
Expand Down Expand Up @@ -375,6 +378,29 @@ user_agent_parsers:
- regex: '(Nintendo 3DS)'
family_replacement: 'NetFront NX'

# Huawei Browser, should go before Safari and Chrome Mobile
- regex: '(HuaweiBrowser)/(\d+)\.(\d+)\.(\d+)\.\d+'
family_replacement: 'Huawei Browser'

# AVG
- regex: '(AVG)/(\d+)\.(\d+)\.(\d+)\.\d+'
family_replacement: 'AVG'

# Avast
- regex: '(AvastSecureBrowser|Avast)/(\d+)\.(\d+)\.(\d+)'
family_replacement: 'Avast Secure Browser'

# Instabridge
- regex: '(Instabridge)/(\d+)(?:\.(\d+)|)(?:\.(\d+)|)'

# Aloha Browser
- regex: '(AlohaBrowser)/(\d+)\.(\d+)\.(\d+)(?:\.(\d+)|)'
family_replacement: 'Aloha Browser'

# Brave Browser https://brave.com/ , should go before Safari and Chrome Mobile
- regex: '((?:B|b)rave(?:\sChrome)?)/(\d+)(?:\.(\d+)|)(?:\.(\d+)|)(?:\.(\d+)|)'
family_replacement: 'Brave'

# Amazon Silk, should go before Safari and Chrome Mobile
- regex: '(Silk)/(\d+)\.(\d+)(?:\.([0-9\-]+)|)'
family_replacement: 'Amazon Silk'
Expand All @@ -385,9 +411,13 @@ user_agent_parsers:
# Edge Mobile
- regex: 'Windows Phone .{0,200}(Edge)/(\d+)\.(\d+)'
family_replacement: 'Edge Mobile'
- regex: '(EdgiOS|EdgA)/(\d+)\.(\d+)\.(\d+)(?:\.(\d+)|)'
- regex: '(EdgiOS|EdgA)/(\d+)(?:\.(\d+)|)(?:\.(\d+)|)(?:\.(\d+)|)'
family_replacement: 'Edge Mobile'

# Oculus Browser, should go before Samsung Internet
- regex: '(OculusBrowser)/(\d+)\.(\d+).0.0(?:\.([0-9\-]+)|)'
family_replacement: 'Oculus Browser'

# Samsung Internet (based on Chrome, but lacking some features)
- regex: '(SamsungBrowser)/(\d+)\.(\d+)'
family_replacement: 'Samsung Internet'
Expand Down Expand Up @@ -447,21 +477,33 @@ user_agent_parsers:
family_replacement: 'QQ Browser'

# DuckDuckGo
- regex: 'Mobile.{0,200}(DuckDuckGo)/(\d+)'
- regex: 'Mozilla.{1,200}Mobile.{1,100}(DuckDuckGo)/(\d+)'
family_replacement: 'DuckDuckGo Mobile'
- regex: 'Mozilla.{1,200}(DuckDuckGo)/(\d+)'
family_replacement: 'DuckDuckGo'
- regex: 'Mozilla.{1,200}Mobile.{1,100}(Ddg)/(\d+)(?:\.(\d+)|)'
family_replacement: 'DuckDuckGo Mobile'
- regex: 'Mozilla.{1,200}(Ddg)/(\d+)(?:\.(\d+)|)'
family_replacement: 'DuckDuckGo'

# Tenta Browser
- regex: '(Tenta/)(\d+)\.(\d+)\.(\d+)'
family_replacement: 'Tenta Browser'

# Ecosia on iOS / Android
- regex: '(Ecosia) ios@(\d+)\.(\d+)\.(\d+)\.(\d+)'
family_replacement: 'Ecosia iOS'
- regex: '(Ecosia) android@(\d+)\.(\d+)\.(\d+)\.(\d+)'
family_replacement: 'Ecosia Android'

# Chrome Mobile
- regex: 'Version/.{1,300}(Chrome)/(\d+)\.(\d+)\.(\d+)\.(\d+)'
family_replacement: 'Chrome Mobile WebView'
- regex: '; wv\).{1,300}(Chrome)/(\d+)\.(\d+)\.(\d+)\.(\d+)'
family_replacement: 'Chrome Mobile WebView'
- regex: '(CrMo)/(\d+)\.(\d+)\.(\d+)\.(\d+)'
family_replacement: 'Chrome Mobile'
- regex: '(CriOS)/(\d+)\.(\d+)\.(\d+)\.(\d+)'
- regex: '(CriOS)/(\d+)(?:\.(\d+)|)(?:\.(\d+)|)(?:\.(\d+)|)'
family_replacement: 'Chrome Mobile iOS'
- regex: '(Chrome)/(\d+)\.(\d+)\.(\d+)\.(\d+) Mobile(?:[ /]|$)'
family_replacement: 'Chrome Mobile'
Expand Down Expand Up @@ -493,6 +535,8 @@ user_agent_parsers:
# Yandex Browser
- regex: '(YaBrowser)/(\d+)\.(\d+)\.(\d+)'
family_replacement: 'Yandex Browser'
- regex: '(YaSearchBrowser)/(\d+)\.(\d+)\.(\d+)'
family_replacement: 'Yandex Browser'

# Mail.ru Amigo/Internet Browser (Chromium-based)
- regex: '(Chrome)/(\d+)\.(\d+)\.(\d+).{0,100} MRCHROME'
Expand Down Expand Up @@ -597,18 +641,14 @@ user_agent_parsers:
- regex: 'Superhuman'
family_replacement: 'Superhuman'

# Vivaldi uses "Vivaldi"
- regex: '(Vivaldi)/(\d+)\.(\d+)\.(\d+)'
# Vivaldi
- regex: '(Vivaldi)/(\d+)(?:\.(\d+)|)(?:\.(\d+)|)'

# Edge/major_version.minor_version
# Edge with chromium Edg/major_version.minor_version.patch.minor_patch
- regex: '(Edge?)/(\d+)(?:\.(\d+)|)(?:\.(\d+)|)(?:\.(\d+)|)'
family_replacement: 'Edge'

# Brave Browser https://brave.com/
- regex: '(brave)/(\d+)\.(\d+)\.(\d+) Chrome'
family_replacement: 'Brave'

# Iron Browser ~since version 50
- regex: '(Chrome)/(\d+)\.(\d+)\.(\d+)[\d.]{0,100} Iron[^/]'
family_replacement: 'Iron'
Expand Down Expand Up @@ -925,7 +965,7 @@ user_agent_parsers:
# AFTER THE EDGE CASES ABOVE!
# AFTER IE11
# BEFORE all other IE
- regex: '(Firefox)/(\d+)\.(\d+)\.(\d+)'
- regex: '(Firefox)/(\d+)\.(\d+)(?:\.(\d+)|$)'
- regex: '(Firefox)/(\d+)\.(\d+)(pre|[ab]\d+[a-z]*|)'


Expand Down Expand Up @@ -965,7 +1005,9 @@ user_agent_parsers:
- regex: '(Python/3\.\d{1,3} aiohttp)/(\d+)\.(\d+)\.(\d+)'
family_replacement: 'Python aiohttp'

- regex: '(Java)[/ ]?\d+\.(\d+)\.(\d+)[_-]*([a-zA-Z0-9]+|)'
- regex: '(Java)[/ ]?\d{1}\.(\d+)\.(\d+)[_-]*([a-zA-Z0-9]+|)'

- regex: '(Java)[/ ]?(\d+)\.(\d+)\.(\d+)'

# minio-go (https://github.com/minio/minio-go)
- regex: '(minio-go)/v(\d+)\.(\d+)\.(\d+)'
Expand Down Expand Up @@ -1017,10 +1059,12 @@ user_agent_parsers:
# HTTrack crawler
- regex: '\b(HTTrack) (\d+)\.(\d+)(?:[\.\-](\d+)|)'

# SerenityOS (https://serenityos.org)
# https://github.com/SerenityOS/serenity/blob/2e1bbcb0faeae92d7595b8e0b022a8cdcecca07e/Userland/Libraries/LibWeb/Loader/ResourceLoader.h#L27
- regex: 'SerenityOS'
family_replacement: 'SerenityOS Browser'
# Ladybird Browser (https://ladybird.dev)
# https://github.com/SerenityOS/serenity/blob/6a662e0d43810c1dbd56fbf0c123f258aa1d694e/Userland/Libraries/LibWeb/Loader/ResourceLoader.h#L64
- regex: '(Ladybird)\/(\d+)\.(\d+)'

# MullvadBrowser (https://mullvad.net/en/browser)
- regex: '(MullvadBrowser)/(\d+)(?:\.(\d+)|)(?:\.(\d+)|)'

os_parsers:
##########
Expand Down Expand Up @@ -1081,8 +1125,8 @@ os_parsers:
# generic HbbTV, hoping to catch manufacturer name (always after 2nd comma) and the first string that looks like a 2011-2019 year
- regex: 'HbbTV/\d+\.\d+\.\d+ \(.{0,30}; ?([a-zA-Z]+) ?;.{0,30}(201[1-9]).{0,30}\)'

# aspiegel.com spider (owned by Huawei)
- regex: 'AspiegelBot'
# aspiegel.com spider (owned by Huawei, later renamed PetalBot)
- regex: 'AspiegelBot|PetalBot'
os_replacement: 'Other'

##########
Expand Down Expand Up @@ -1149,6 +1193,12 @@ os_parsers:
- regex: '(android)\s(?:mobile\/)(\d+)(?:\.(\d+)(?:\.(\d+)|)|)'
os_replacement: 'Android'

##########
# Meta Quest
##########
- regex: 'Quest'
os_replacement: 'Android'

##########
# Kindle Android
##########
Expand Down Expand Up @@ -1599,6 +1649,29 @@ os_parsers:
- regex: 'CFNetwork/.{0,100} Darwin/(21)\.\d+'
os_replacement: 'iOS'
os_v1_replacement: '15'
- regex: 'CFNetwork/.{0,100} Darwin/22\.0\.\d+'
os_replacement: 'iOS'
os_v1_replacement: '16'
os_v2_replacement: '0'
- regex: 'CFNetwork/.{0,100} Darwin/22\.1\.\d+'
os_replacement: 'iOS'
os_v1_replacement: '16'
os_v2_replacement: '1'
- regex: 'CFNetwork/.{0,100} Darwin/22\.2\.\d+'
os_replacement: 'iOS'
os_v1_replacement: '16'
os_v2_replacement: '2'
- regex: 'CFNetwork/.{0,100} Darwin/22\.3\.\d+'
os_replacement: 'iOS'
os_v1_replacement: '16'
os_v2_replacement: '3'
- regex: 'CFNetwork/.{0,100} Darwin/22\.4\.\d+'
os_replacement: 'iOS'
os_v1_replacement: '16'
os_v2_replacement: '4'
- regex: 'CFNetwork/.{0,100} Darwin/(22)\.\d+'
os_replacement: 'iOS'
os_v1_replacement: '16'
- regex: 'CFNetwork/.{0,100} Darwin/'
os_replacement: 'iOS'

Expand Down Expand Up @@ -1827,11 +1900,11 @@ device_parsers:
brand_replacement: 'Spider'

# aspiegel.com spider (owned by Huawei)
- regex: 'Mozilla.{1,100}Mobile.{1,100}AspiegelBot'
- regex: 'Mozilla.{1,100}Mobile.{1,100}(AspiegelBot|PetalBot)'
device_replacement: 'Spider'
brand_replacement: 'Spider'
model_replacement: 'Smartphone'
- regex: 'Mozilla.{0,200}AspiegelBot'
- regex: 'Mozilla.{0,200}(AspiegelBot|PetalBot)'
device_replacement: 'Spider'
brand_replacement: 'Spider'
model_replacement: 'Desktop'
Expand Down Expand Up @@ -3544,6 +3617,30 @@ device_parsers:
brand_replacement: 'Meizu'
model_replacement: '$1'

#########
# Meta
# @ref: https://www.meta.com
#########
- regex: 'Quest 3'
device_replacement: 'Quest'
brand_replacement: 'Meta'
model_replacement: 'Quest 3'

- regex: 'Quest 2'
device_replacement: 'Quest'
brand_replacement: 'Meta'
model_replacement: 'Quest 2'

- regex: 'Quest Pro'
device_replacement: 'Quest'
brand_replacement: 'Meta'
model_replacement: 'Quest Pro'

- regex: 'Quest'
device_replacement: 'Quest'
brand_replacement: 'Meta'
model_replacement: 'Quest'

#########
# Micromax
# @ref: http://www.micromaxinfo.com
Expand Down Expand Up @@ -5553,7 +5650,7 @@ device_parsers:
device_replacement: 'Motorola$2'
brand_replacement: 'Motorola'
model_replacement: '$2'


##########
# nintendo
Expand All @@ -5562,7 +5659,7 @@ device_parsers:
device_replacement: 'Nintendo Wii U'
brand_replacement: 'Nintendo'
model_replacement: 'Wii U'
- regex: 'Nintendo (DS|3DS|DSi|Wii);'
- regex: 'Nintendo (Switch|DS|3DS|DSi|Wii);'
device_replacement: 'Nintendo $1'
brand_replacement: 'Nintendo'
model_replacement: '$1'
Expand Down
6 changes: 6 additions & 0 deletions test_resources/firefox_user_agent_strings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,12 @@ test_cases:
minor: '0'
patch: '1'

- user_agent_string: 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0'
family: 'Firefox'
major: '104'
minor: '0'
patch:

- user_agent_string: 'Mozilla/5.0 (X11; Linux armv7l; rv:2.1.1) Gecko/ Firefox/5.0.1'
family: 'Firefox'
major: '5'
Expand Down
Loading

0 comments on commit 1565137

Please sign in to comment.