browser 3.0.1 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,11 +8,13 @@ Gem::Specification.new do |s|
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Nando Vieira"]
10
10
  s.email = ["fnando.vieira@gmail.com"]
11
- s.homepage = "http://github.com/fnando/browser"
11
+ s.homepage = "https://github.com/fnando/browser"
12
12
  s.summary = "Do some browser detection with Ruby."
13
13
  s.description = s.summary
14
14
  s.license = "MIT"
15
15
 
16
+ s.metadata["changelog_uri"] = "https://github.com/fnando/browser/blob/master/CHANGELOG.md"
17
+
16
18
  s.files = `git ls-files`.split("\n")
17
19
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
20
  s.executables = `git ls-files -- exe/*`
@@ -50,11 +50,6 @@ module Browser
50
50
  @device ||= Device.new(ua)
51
51
  end
52
52
 
53
- # Return true if browser is modern (Webkit, Firefox 17+, IE9+, Opera 12+).
54
- def modern?
55
- Browser.modern_rules.any? {|rule| rule === self } # rubocop:disable Style/CaseEquality
56
- end
57
-
58
53
  # Detect if browser is Microsoft Internet Explorer.
59
54
  def ie?(expected_version = nil)
60
55
  InternetExplorer.new(ua).match? &&
@@ -192,6 +187,16 @@ module Browser
192
187
  ua =~ /Opera Mini/ && detect_version?(full_version, expected_version)
193
188
  end
194
189
 
190
+ # Detect if browser is DuckDuckGo.
191
+ def duck_duck_go?(expected_version = nil)
192
+ ua =~ /DuckDuckGo/ && detect_version?(full_version, expected_version)
193
+ end
194
+
195
+ # Detect if browser is Samsung.
196
+ def samsung_browser?(expected_version = nil)
197
+ ua =~ /SamsungBrowser/ && detect_version?(full_version, expected_version)
198
+ end
199
+
195
200
  def webkit_full_version
196
201
  ua[%r{AppleWebKit/([\d.]+)}, 1] || "0.0"
197
202
  end
@@ -30,6 +30,8 @@ require_relative "instagram"
30
30
  require_relative "yandex"
31
31
  require_relative "sputnik"
32
32
  require_relative "snapchat"
33
+ require_relative "duck_duck_go"
34
+ require_relative "samsung_browser"
33
35
 
34
36
  require_relative "bot"
35
37
  require_relative "bot/empty_user_agent_matcher"
@@ -65,41 +67,20 @@ module Browser
65
67
  Instagram, # must be placed before Chrome and Safari
66
68
  Snapchat, # must be placed before Chrome and Safari
67
69
  Weibo, # must be placed before Chrome and Safari
70
+ MicroMessenger, # must be placed before QQ
68
71
  QQ, # must be placed before Chrome and Safari
69
72
  Alipay, # must be placed before Chrome and Safari
70
73
  Electron, # must be placed before Chrome and Safari
71
74
  Yandex, # must be placed before Chrome and Safari
72
75
  Sputnik, # must be placed before Chrome and Safari
76
+ DuckDuckGo, # must be placed before Chrome and Safari
77
+ SamsungBrowser, # must be placed before Chrome and Safari
73
78
  Chrome,
74
79
  Safari,
75
- MicroMessenger,
76
80
  Generic
77
81
  ]
78
82
  end
79
83
 
80
- # Define the rules which define a modern browser.
81
- # A rule must be a proc/lambda or any object that implements the method
82
- # === and accepts the browser object.
83
- #
84
- # To redefine all rules, clear the existing rules before adding your own.
85
- #
86
- # # Only Chrome Canary is considered modern.
87
- # Browser.modern_rules.clear
88
- # Browser.modern_rules << -> b { b.chrome? && b.version >= "37" }
89
- #
90
- def self.modern_rules
91
- @modern_rules ||= []
92
- end
93
-
94
- modern_rules.tap do |rules|
95
- rules << ->(b) { b.chrome? && b.version.to_i >= 65 }
96
- rules << ->(b) { b.safari? && b.version.to_i >= 10 }
97
- rules << ->(b) { b.firefox? && b.version.to_i >= 52 }
98
- rules << ->(b) { b.ie? && b.version.to_i >= 11 && !b.compatibility_view? }
99
- rules << ->(b) { b.edge? && b.version.to_i >= 15 }
100
- rules << ->(b) { b.opera? && b.version.to_i >= 50 }
101
- end
102
-
103
84
  def self.new(user_agent, **kwargs)
104
85
  matchers
105
86
  .map {|klass| klass.new(user_agent || EMPTY_STRING, **kwargs) }
@@ -21,9 +21,13 @@ module Browser
21
21
 
22
22
  def match?
23
23
  ua =~ /Chrome|CriOS/ &&
24
- ua !~ /PhantomJS|FxiOS|YaBrowser|SputnikBrowser|ArchiveBot/ &&
24
+ ua !~ /PhantomJS|FxiOS|ArchiveBot/ &&
25
25
  !opera? &&
26
- !edge?
26
+ !edge? &&
27
+ !duck_duck_go? &&
28
+ !yandex? &&
29
+ !sputnik? &&
30
+ !samsung_browser?
27
31
  end
28
32
  end
29
33
  end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Browser
4
+ class DuckDuckGo < Base
5
+ def id
6
+ :duckduckgo
7
+ end
8
+
9
+ def name
10
+ "DuckDuckGo"
11
+ end
12
+
13
+ def full_version
14
+ ua[%r{DuckDuckGo/([\d.]+)}, 1] ||
15
+ "0.0"
16
+ end
17
+
18
+ def match?
19
+ ua =~ /DuckDuckGo/
20
+ end
21
+ end
22
+ end
@@ -11,11 +11,11 @@ module Browser
11
11
  end
12
12
 
13
13
  def full_version
14
- ua[%r{(?:Edge|Edg)/([\d.]+)}, 1] || super
14
+ ua[%r{(?:Edge|Edg|EdgiOS|EdgA)/([\d.]+)}, 1] || super
15
15
  end
16
16
 
17
17
  def match?
18
- ua =~ %r{((?:Edge|Edg)/[\d.]+|Trident/8)}
18
+ ua =~ %r{((?:Edge|Edg|EdgiOS|EdgA)/[\d.]+|Trident/8)}
19
19
  end
20
20
 
21
21
  def chrome_based?
@@ -6,7 +6,6 @@ require_relative "meta/id"
6
6
  require_relative "meta/ie"
7
7
  require_relative "meta/ios"
8
8
  require_relative "meta/mobile"
9
- require_relative "meta/modern"
10
9
  require_relative "meta/platform"
11
10
  require_relative "meta/proxy"
12
11
  require_relative "meta/safari"
@@ -10,7 +10,6 @@ module Browser
10
10
  IE,
11
11
  IOS,
12
12
  Mobile,
13
- Modern,
14
13
  Platform,
15
14
  Proxy,
16
15
  Safari,
@@ -45,7 +45,7 @@ module Browser
45
45
 
46
46
  def subject
47
47
  @subject ||= self.class.matchers
48
- .map {|matcher| matcher.new(ua) }
48
+ .map {|matcher| matcher.new(ua, self) }
49
49
  .find(&:match?)
50
50
  end
51
51
 
@@ -3,10 +3,11 @@
3
3
  module Browser
4
4
  class Platform
5
5
  class Base
6
- attr_reader :ua
6
+ attr_reader :ua, :platform
7
7
 
8
- def initialize(ua)
8
+ def initialize(ua, platform = nil)
9
9
  @ua = ua
10
+ @platform = platform
10
11
  end
11
12
 
12
13
  def match?
@@ -8,7 +8,9 @@ module Browser
8
8
  end
9
9
 
10
10
  def name
11
- "Macintosh"
11
+ return "macOS" if platform.mac?(">= 10.12")
12
+
13
+ "Mac OS X"
12
14
  end
13
15
 
14
16
  def id
@@ -18,7 +18,14 @@ module Browser
18
18
  end
19
19
 
20
20
  def match?
21
- ua =~ /Safari/ && ua !~ /Chrome|CriOS|PhantomJS|FxiOS|YaBrowser/
21
+ ua =~ /Safari/ &&
22
+ ua !~ /PhantomJS|FxiOS/ &&
23
+ !edge? &&
24
+ !chrome? &&
25
+ !samsung_browser? &&
26
+ !duck_duck_go? &&
27
+ !yandex? &&
28
+ !sputnik?
22
29
  end
23
30
  end
24
31
  end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Browser
4
+ class SamsungBrowser < Chrome
5
+ def id
6
+ :samsung_browser
7
+ end
8
+
9
+ def name
10
+ "Samsung Browser"
11
+ end
12
+
13
+ def full_version
14
+ ua[%r{SamsungBrowser/([\d.]+)}, 1] || super
15
+ end
16
+
17
+ def match?
18
+ ua =~ /SamsungBrowser/
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Browser
4
- VERSION = "3.0.1"
4
+ VERSION = "4.2.0"
5
5
  end
@@ -24,3 +24,11 @@ module Minitest
24
24
  end
25
25
  end
26
26
  end
27
+
28
+ # Override Browser::Base#warn, so we don't output deprecation messages.
29
+ module Browser
30
+ class Base
31
+ def warn(*)
32
+ end
33
+ end
34
+ end
@@ -32,6 +32,8 @@ CHROME: "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/53
32
32
  CHROME_OS: "Mozilla/5.0 (X11; CrOS x86_64 3701.81.0) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.57 Safari/537.31."
33
33
  COREMEDIA: "Apple Mac OS X v10.6.4 CoreMedia v1.0.0.10F569"
34
34
  CUSTOM_APP: "Our App 0.0.1 (Linux; Android 4.0.3; HTC Ruby Build/IML74K; en_CA)"
35
+ DUCKDUCKGO_BROWSER_IOS: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 DuckDuckGo/7"
36
+ DUCKDUCKGO_BROWSER_ANDROID: Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.96 Mobile Safari/537.36 DuckDuckGo/5"
35
37
  ELECTRON: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Electron/1.4.12 Safari/537.36"
36
38
  FACEBOOK: Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60 [FBAN/FBIOS;FBAV/135.0.0.45.90;FBBV/66877072;FBDV/iPhone9,3;FBMD/iPhone;FBSN/iOS;FBSV/10.3.3;FBSS/2;FBCR/AT&T;FBID/phone;FBLC/en_US;FBOP/5;FBRV/0]
37
39
  FACEBOOK_ANDROID: "Mozilla/5.0 (Linux; Android 9; ONEPLUS A6003 Build/PKQ1.180716.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/73.0.3683.90 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/214.0.0.43.83;]"
@@ -77,13 +79,18 @@ KINDLE_FIRE: "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Kindle Fire Build/GIN
77
79
  KINDLE_FIRE_HD: "Mozilla/5.0 (Linux; U; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.4 Safari/535.19 Silk-Accelerated=true"
78
80
  KINDLE_FIRE_HD_MOBILE: "Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.4 Mobile Safari/535.19 Silk-Accelerated=true"
79
81
  LUMIA800: "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; XBLWP7; ZuneWP7"
80
- MICRO_MESSENGER: "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13E238 MicroMessenger/6.3.15 NetType/3G+ Language/zh_CN"
82
+ MAC_OS: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15"
83
+ MAC_OSX: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9"
84
+ MICRO_MESSENGER_IOS: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.10(0x17000a21) NetType/4G Language/zh_CN"
85
+ MICRO_MESSENGER_ANDROID: "Mozilla/5.0 (Linux; Android 7.1.2; Redmi 4X Build/N2G47H; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045131 Mobile Safari/537.36 MMWEBID/9286 MicroMessenger/7.0.13.1640(0x27000D37) Process/tools NetType/WIFI Language/zh_CN ABI/arm64 WeChat/arm64"
81
86
  MIDP: MIDP-2.0
82
87
  MOBILE_CHROME: "Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3"
83
88
  MS_EDGE: "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0"
84
89
  MS_EDGE_CHROME: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.29 Safari/537.36 Edg/79.0.309.18"
85
90
  MS_EDGE_COMPAT: "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; WOW64; Trident/8.0; .NET4.0C; .NET4.0E; Tablet PC 2.0; Microsoft Outlook 15.0.4433; ms-office; MSOffice 15)"
86
91
  MS_EDGE_MOBILE: "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; DEVICE INFO) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Mobile Safari/537.36 Edge/12.0"
92
+ MS_EDGE_IOS: "Mozilla/5.0 (iPhone; CPU iPhone OS 12_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 EdgiOS/44.5.0.10 Mobile/15E148 Safari/604.1"
93
+ MS_EDGE_ANDROID: "Mozilla/5.0 (Linux; Android 7.1.2; Redmi 4X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.0 Mobile Safari/537.36 EdgA/44.11.2.4122"
87
94
  NEXUS7: "Mozilla/5.0 (Linux; Android 4.3; Nexus 7 Build/JWR66Y) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.72 Safari/537.36"
88
95
  NEXUS_TABLET: "Mozilla/5.0 (Linux; Android 4.1.1; Nexus 7 Build/JRO03D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19"
89
96
  NINTENDO_SWITCH: "Mozilla/5.0 (Nintendo Switch; WifiWebAuthApplet) AppleWebKit/601.6 (KHTML, like Gecko) NF/4.0.0.7.9 NintendoBrowser/5.1.0.15785"
@@ -119,6 +126,7 @@ SAFARI: "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) AppleWebKit/53
119
126
  SAFARI_IPAD_WEBAPP_MODE: "Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405"
120
127
  SAFARI_IPHONE_WEBAPP_MODE: "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.20 (KHTML, like Gecko) Mobile/7B298g"
121
128
  SAMSUNG: "Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; SAMSUNG-SGH-I497 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30"
129
+ SAMSUNG_BROWSER: "Mozilla/5.0 (Linux; Android 10; SAMSUNG SM-N960U) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/11.1 Chrome/75.0.3770.143 Mobile Safari/537.36"
122
130
  SAMSUNG_CHROME: "Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG GT-I9195/I9195XXUCNEA Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36"
123
131
  SMART_TV: "Mozilla/5.0 (SmartHub; SMART-TV; U; Linux/SmartTV) AppleWebKit/531.2+ (KHTML, like Gecko) WebBrowser/1.0 SmartTV Safari/531.2+"
124
132
  SNAPCHAT: Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Snapchat/10.69.5.72 (iPhone10,3; iOS 13.2.2; gzip)
@@ -4,15 +4,16 @@ ADS_TXT_CRAWLER: "AdsTxtCrawler/1.0"
4
4
  ANDERSPINK: "Mozilla/5.0 (compatible; AndersPinkBot/1.0; +http://anderspink.com/bot.html)"
5
5
  APIS_GOOGLE: "APIs-Google; (+https://developers.google.com/webmasters/APIs-Google.html)"
6
6
  APPLE_BOT: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/600.2.5 (KHTML, like Gecko) Version/8.0.2 Safari/600.2.5 (Applebot/0.1)"
7
+ ARCHIVEBOT: "ArchiveTeam ArchiveBot/20190617.01 (wpull 2.0.3) and not Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36"
7
8
  ASK: "Mozilla/2.0 (compatible; Ask Jeeves/Teoma; +http://sp.ask.com/docs/about/tech_crawling.html)"
8
9
  AWS_ELB: ELB-HealthChecker/1.0
9
- ARCHIVEBOT: "ArchiveTeam ArchiveBot/20190617.01 (wpull 2.0.3) and not Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36"
10
10
  BAIDU: "Baiduspider+(+http://www.baidu.com/search/spider.htm)"
11
11
  BARKROWLER: "Barkrowler/0.7 (+http://www.exensa.com/crawl)"
12
12
  BINGBOT: "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"
13
13
  BINGPREVIEW: "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534+ (KHTML, like Gecko) BingPreview/1.0b"
14
14
  BUBING: "BUbiNG (+http://law.di.unimi.it/BUbiNG.html)"
15
15
  BUZZBOT: "Buzzbot/1.0 (Buzzbot; http://www.buzzstream.com; buzzbot@buzzstream.com)"
16
+ CHROME_LIGHTHOUSE: "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3694.0 Mobile Safari/537.36 Chrome-Lighthouse"
16
17
  CIPACRAWLER: "CipaCrawler/3.0 (info@domaincrawler.com; http://www.domaincrawler.com/www.example.com)"
17
18
  CLOUDFLARE: "Mozilla/5.0 (compatible; CloudFlare-AlwaysOnline/1.0; +http://www.cloudflare.com/always-online) AppleWebKit/534.34"
18
19
  COMMONCRAWL: "CCBot/2.0 (http://commoncrawl.org/faq/)"
@@ -30,7 +31,9 @@ FYREBOT: "Fyrebot/1.0"
30
31
  GARLIK: "GarlikCrawler/1.2 (http://garlik.com/, crawler@garlik.com)"
31
32
  GERMCRAWLER: "GermCrawler"
32
33
  GO_1.1_PACKAGE_HTTP: "Go 1.1 package http"
34
+ GO_HTTP_CLIENT: "Go-http-client"
33
35
  GOOGLE_BOT: "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
36
+ GOOGLE_IMAGE_PROXY: "Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)"
34
37
  GOOGLE_PAGE_SPEED_INSIGHTS: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.4 (KHTML, like Gecko; Google Page Speed Insights) Chrome/22.0.1229 Safari/537.4"
35
38
  GOOGLE_SHOPPING: "google-xrawler"
36
39
  GOOGLE_SITE_VERIFICATION: Mozilla/5.0 (compatible; Google-Site-Verification/1.0)
@@ -43,6 +46,7 @@ IMPLISENSEBOT: "ImplisenseBot 1.0"
43
46
  JAUNT: "Jaunt/1.5"
44
47
  JOBSEEKER: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/538.1 (KHTML, like Gecko) JobBot/5.0 (compatible; +http://www.jobseeker.com.au/bot.html) Safari/538.1"
45
48
  JOOBLE: "Mozilla/5.0 (compatible; Jooblebot/2.0; Windows NT 6.1; WOW64; +http://jooble.org/jooble-bot) Mobile"
49
+ KNOWLEDGE_AI: "The Knowledge AI"
46
50
  LINKDEXBOT: "Mozilla/5.0 (compatible; linkdexbot/2.0; +http://www.linkdex.com/bots/)"
47
51
  LINKEDIN: "LinkedInBot/1.0 (compatible; Mozilla/5.0; Jakarta Commons-HttpClient/3.1 +http://www.linkedin.com)"
48
52
  LOAD_TIME_BOT: "Mozilla/5.0 (compatible; LoadTimeBot/0.9; +http://www.loadtime.net/bot.html)"
@@ -68,10 +72,12 @@ SCOUT_URL_MONITOR: ScoutURLMonitor/6.2.2
68
72
  SCRAPY: "Scrapy/0.18.4 (+http://scrapy.org)"
69
73
  SEMANTICBOT: "Mozilla/5.0 (compatible; Semanticbot/1.0; +http://sempi.tech/bot.html)"
70
74
  SEO_AUDIT: "Mozilla/5.0 (compatible; seo-audit-check-bot/1.0)"
75
+ SEOBILITYBOT: "SeobilityBot (SEO Tool; https://www.seobility.net/sites/bot.html)"
71
76
  SEODIVER: "Mozilla/5.0 (compatible; SEOdiver/1.0; +http://www.seodiver.com/bot)"
72
77
  SEOKICKS: "Mozilla/5.0 (compatible; SEOkicks-Robot; +http://www.seokicks.de/robot.html)"
73
78
  SISTRIX: "Mozilla/5.0 (compatible; SISTRIX Crawler; http://crawler.sistrix.net/)"
74
- SITECHECK: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.0) SiteCheck-sitecrawl by Siteimprove.com'
79
+ SITECHECK: "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.0) SiteCheck-sitecrawl by Siteimprove.com"
80
+ SKYPE: "Mozilla/5.0 (Windows NT 6.1; WOW64) SkypeUriPreview Preview/0.5"
75
81
  SOCIALRANKIO: SocialRankIOBot; http://socialrank.io/about
76
82
  SQUIDER: "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36 Squider/0.01"
77
83
  STRIPE: "Stripe/1.0 (+https://stripe.com/docs/webhooks)"
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "test_helper"
4
+
5
+ class DuckDuckGoTest < Minitest::Test
6
+ test "detects DuckDuckGo on iOS device" do
7
+ browser = Browser.new(Browser["DUCKDUCKGO_BROWSER_IOS"])
8
+ assert browser.duck_duck_go?
9
+ refute browser.safari?
10
+ refute browser.chrome?
11
+ assert browser.webkit?
12
+ assert_equal "DuckDuckGo", browser.name
13
+ assert_equal :duckduckgo, browser.id
14
+ end
15
+
16
+ test "detects DuckDuckGo on Android device" do
17
+ browser = Browser.new(Browser["DUCKDUCKGO_BROWSER_ANDROID"])
18
+ assert browser.duck_duck_go?
19
+ refute browser.safari?
20
+ refute browser.chrome?
21
+ assert_equal "DuckDuckGo", browser.name
22
+ assert_equal :duckduckgo, browser.id
23
+ end
24
+
25
+ test "detects correct version" do
26
+ browser = Browser.new(Browser["DUCKDUCKGO_BROWSER_IOS"])
27
+ assert_equal "7", browser.full_version
28
+ assert_equal "7", browser.version
29
+ end
30
+
31
+ test "detects version by range" do
32
+ browser = Browser.new(Browser["DUCKDUCKGO_BROWSER_IOS"])
33
+ assert browser.duck_duck_go?(%w[>=7 <8])
34
+ end
35
+ end
@@ -65,8 +65,40 @@ class EdgeTest < ActionController::TestCase
65
65
  refute browser.safari?
66
66
  end
67
67
 
68
+ test "detects Microsoft Edge Mobile on iOS" do
69
+ browser = Browser.new(Browser["MS_EDGE_IOS"])
70
+
71
+ assert_equal :edge, browser.id
72
+ assert_equal "Microsoft Edge", browser.name
73
+ assert_equal "44.5.0.10", browser.full_version
74
+ assert_equal "44", browser.version
75
+ refute browser.platform.windows10?
76
+ refute browser.platform.windows_phone?
77
+ assert browser.platform.ios?
78
+ assert browser.edge?
79
+ refute browser.webkit?
80
+ refute browser.chrome?
81
+ refute browser.safari?
82
+ end
83
+
84
+ test "detects Microsoft Edge Mobile on Android" do
85
+ browser = Browser.new(Browser["MS_EDGE_ANDROID"])
86
+
87
+ assert_equal :edge, browser.id
88
+ assert_equal "Microsoft Edge", browser.name
89
+ assert_equal "44.11.2.4122", browser.full_version
90
+ assert_equal "44", browser.version
91
+ refute browser.platform.windows10?
92
+ refute browser.platform.windows_phone?
93
+ assert browser.platform.android?
94
+ assert browser.edge?
95
+ refute browser.webkit?
96
+ refute browser.chrome?
97
+ refute browser.safari?
98
+ end
99
+
68
100
  test "detects version by range" do
69
- browser = Browser.new(Browser["MS_EDGE"])
70
- assert browser.edge?(%w[>=12 <13])
101
+ browser = Browser.new(Browser["MS_EDGE_IOS"])
102
+ assert browser.edge?(%w[>=43 <45])
71
103
  end
72
104
  end
@@ -3,18 +3,33 @@
3
3
  require "test_helper"
4
4
 
5
5
  class MicroMessengerTest < Minitest::Test
6
- test "detects micro messenger 6.3.15" do
7
- browser = Browser.new(Browser["MICRO_MESSENGER"])
6
+ test "detects micro messenger 7.0.10 on iOS" do
7
+ browser = Browser.new(Browser["MICRO_MESSENGER_IOS"])
8
8
 
9
9
  assert browser.micro_messenger?
10
10
  assert browser.wechat?
11
- assert_equal "6.3.15", browser.full_version
11
+ assert_equal "7.0.10", browser.full_version
12
12
  assert_equal "MicroMessenger", browser.name
13
13
  assert_equal :micro_messenger, browser.id
14
14
  end
15
15
 
16
- test "detects version by range" do
17
- browser = Browser.new(Browser["MICRO_MESSENGER"])
18
- assert browser.wechat?(%w[>=6 <7])
16
+ test "detects version by range on iOS" do
17
+ browser = Browser.new(Browser["MICRO_MESSENGER_IOS"])
18
+ assert browser.wechat?(%w[>=7 <8])
19
+ end
20
+
21
+ test "detects micro messenger 7.0.13.1640 on Android" do
22
+ browser = Browser.new(Browser["MICRO_MESSENGER_ANDROID"])
23
+
24
+ assert browser.micro_messenger?
25
+ assert browser.wechat?
26
+ assert_equal "7.0.13.1640", browser.full_version
27
+ assert_equal "MicroMessenger", browser.name
28
+ assert_equal :micro_messenger, browser.id
29
+ end
30
+
31
+ test "detects version by range on Android" do
32
+ browser = Browser.new(Browser["MICRO_MESSENGER_ANDROID"])
33
+ assert browser.wechat?(%w[>=7 <8])
19
34
  end
20
35
  end