This repository was archived by the owner on Feb 17, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +26
-8
lines changed Expand file tree Collapse file tree 2 files changed +26
-8
lines changed Original file line number Diff line number Diff line change @@ -333,6 +333,19 @@ var uastrings = []struct {
333
333
expected : "Platform:Windows OS:Windows 7 Localization:en Browser:Opera-9.80 Engine:Presto-2.9.168 Bot:false Mobile:false" ,
334
334
},
335
335
336
+ // Yandex Browser
337
+ {
338
+ title : "YandexBrowserLinux" ,
339
+ ua : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.99 YaBrowser/19.1.0.2494 (beta) Yowser/2.5 Safari/537.36" ,
340
+ expected : "Mozilla:5.0 Platform:X11 OS:Linux x86_64 Browser:YaBrowser-19.1.0.2494 Engine:AppleWebKit-537.36 Bot:false Mobile:false" ,
341
+ expectedOS : & OSInfo {"Linux x86_64" , "Linux" , "" },
342
+ },
343
+
344
+ {
345
+ title : "YandexBrowserWindows" ,
346
+ ua : "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 YaBrowser/17.3.1.840 Yowser/2.5 Safari/537.36" ,
347
+ expected : "Mozilla:5.0 Platform:Windows OS:Windows 7 Browser:YaBrowser-17.3.1.840 Engine:AppleWebKit-537.36 Bot:false Mobile:false" ,
348
+ },
336
349
// Other
337
350
{
338
351
title : "Empty" ,
Original file line number Diff line number Diff line change @@ -69,14 +69,19 @@ func (p *UserAgent) detectBrowser(sections []section) {
69
69
p .browser .Name = "Opera"
70
70
p .browser .Version = sections [slen - 1 ].version
71
71
default :
72
- if sections [sectionIndex ].name == "Chrome" {
73
- p .browser .Name = "Chrome"
74
- } else if sections [sectionIndex ].name == "Chromium" {
75
- p .browser .Name = "Chromium"
76
- } else if sections [sectionIndex ].name == "CriOS" {
77
- p .browser .Name = "Chrome"
78
- } else {
79
- p .browser .Name = "Safari"
72
+ switch sections [slen - 3 ].name {
73
+ case "YaBrowser" :
74
+ p .browser .Name = "YaBrowser"
75
+ p .browser .Version = sections [slen - 3 ].version
76
+ default :
77
+ switch sections [sectionIndex ].name {
78
+ case "Chrome" , "CriOS" :
79
+ p .browser .Name = "Chrome"
80
+ case "Chromium" :
81
+ p .browser .Name = "Chromium"
82
+ default :
83
+ p .browser .Name = "Safari"
84
+ }
80
85
}
81
86
}
82
87
} else if engine .name == "Gecko" {
You can’t perform that action at this time.
0 commit comments