Skip to content

Commit

Permalink
Merge branch 'pr/DaniruKun/46'
Browse files Browse the repository at this point in the history
  • Loading branch information
mileusna committed Sep 13, 2024
2 parents af0d3cb + 704ef69 commit bff4f0e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ua.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const (
NetFront = "NetFront"
Mozilla = "Mozilla"
Msie = "MSIE"
SamsungBrowser = "Samsung Browser"

GoogleAdsBot = "Google Ads Bot"
Googlebot = "Googlebot"
Expand Down Expand Up @@ -250,9 +251,10 @@ func Parse(userAgent string) UserAgent {
ua.Bot = true

case tokens.get("SamsungBrowser") != "":
ua.Name = "Samsung Browser"
ua.Name = SamsungBrowser
ua.Version = tokens.get("SamsungBrowser")
ua.Mobile = tokens.existsAny(Mobile, MobileSafari)
ua.OS = Android

case tokens.get("HeadlessChrome") != "":
ua.Name = HeadlessChrome
Expand Down
1 change: 1 addition & 0 deletions ua_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ var testTable = [][]string{
{"Mozilla/5.0 (Linux; U; Android 11; ru-ru; Redmi Note 10S Build/RP1A.200720.011) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.116 Mobile Safari/537.36 XiaoMi/MiuiBrowser/12.13.2-gn", "Miui Browser", "12.13.2-gn", "mobile", ua.Android, "Redmi Note 10S"},

{"Mozilla/5.0 (Linux; Android 10; MED-LX9N; HMSCore 6.6.0.311) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.105 HuaweiBrowser/12.1.0.303 Mobile Safari/537.36", "Huawei Browser", "12.1.0.303", "mobile", "Android"},
{"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/22.0 Chrome/111.0.5563.116 Safari/537.36", ua.SamsungBrowser, "22.0", "mobile", ua.Android},

// useragent, name, version, mobile, os
{"Mozilla/5.0 (Linux; Android 9; ONEPLUS A6003) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.99 Mobile Safari/537.36", ua.Chrome, "71.0.3578.99", "mobile", ua.Android},
Expand Down

0 comments on commit bff4f0e

Please sign in to comment.