Skip to content

Commit

Permalink
feat: add multiple new browsers (#576)
Browse files Browse the repository at this point in the history
* update vivaldi browser regex to match multiple versioning structures

* feat: add Huawei Browser

* feat: add AVG

* feat: add Avast Secure Browser

* feat: add Instabridge browser

* feat: add Aloha Browser

* fix AVG browser test

* fix: remove unnecessary capturing group

---------

Co-authored-by: Carlos Azevedo <cazevedo@cloudflare.com>
  • Loading branch information
csazevedo and Carlos Azevedo authored Apr 9, 2024
1 parent c10ae3f commit 959e106
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 1 deletion.
21 changes: 20 additions & 1 deletion regexes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,25 @@ 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'
Expand Down Expand Up @@ -619,7 +638,7 @@ user_agent_parsers:
family_replacement: 'Superhuman'

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

# Edge/major_version.minor_version
# Edge with chromium Edg/major_version.minor_version.patch.minor_patch
Expand Down
67 changes: 67 additions & 0 deletions tests/test_ua.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8795,3 +8795,70 @@ test_cases:
major: '102'
minor:
patch:

- user_agent_string: 'Mozilla/5.0 (Linux; Android 13; LGE-AN00; HMSCore 6.12.2.302) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 HuaweiBrowser/14.0.5.301 Mobile Safari/537.36'
family: 'Huawei Browser'
major: '14'
minor: '0'
patch: '5'

- user_agent_string: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 AVG/121.0.0.0'
family: 'AVG'
major: '121'
minor: '0'
patch: '0'

- user_agent_string: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Avast/120.0.0.0'
family: 'Avast Secure Browser'
major: '120'
minor: '0'
patch: '0'

- user_agent_string: 'Mozilla/5.0 (Linux; Android 8.1.0; B43du7I2fV; U; in) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.5563.115 Mobile AvastSecureBrowser/7.5.2 Safari/537.36'
family: 'Avast Secure Browser'
major: '7'
minor: '5'
patch: '2'


- user_agent_string: 'Mozilla/5.0 (Linux; Android 13; 0LpRiWjrpo; U; en) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.5938.153 Mobile Avast/7.7.5 Safari/537.36'
family: 'Avast Secure Browser'
major: '7'
minor: '7'
patch: '5'

- user_agent_string: 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_2_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) AvastSecureBrowser/5.3.1 Mobile/15E148 Version/17.0 Safari/605.1.15'
family: 'Avast Secure Browser'
major: '5'
minor: '3'
patch: '1'

- user_agent_string: 'Mozilla/5.0 (Linux; Android 11; SM-A225M) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/85.0.4183.127 Mobile Safari/537.36 Instabridge/22'
family: 'Instabridge'
major: '22'
minor:
patch:

- user_agent_string: 'Mozilla/5.0 (Linux; Android 11; SM-J400F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.127 Mobile Safari/537.36 Instabridge/21.9.0'
family: 'Instabridge'
major: '21'
minor: '9'
patch: '0'

- user_agent_string: 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Mobile Safari/537.36 AlohaBrowser/5.6.1'
family: 'Aloha Browser'
major: '5'
minor: '6'
patch: '1'

- user_agent_string: 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_2_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 Version/17.2.1 Safari/605.1.15 AlohaBrowser/5.4.1'
family: 'Aloha Browser'
major: '5'
minor: '4'
patch: '1'

- user_agent_string: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 AlohaBrowser/1.3.0.0 Safari/537.36'
family: 'Aloha Browser'
major: '1'
minor: '3'
patch: '0'

0 comments on commit 959e106

Please sign in to comment.