useragent 0.16.7 → 0.16.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/user_agent/browsers/base.rb +2 -3
- data/lib/user_agent/browsers/edge.rb +1 -3
- data/lib/user_agent/browsers/vivaldi.rb +63 -0
- data/lib/user_agent/browsers/webkit.rb +1 -1
- data/lib/user_agent/browsers/wechat_browser.rb +44 -0
- data/lib/user_agent/browsers.rb +4 -0
- data/lib/user_agent/operating_systems.rb +2 -2
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 774dec0fef9df469fd9a9f612242cecc728c1b0e
|
4
|
+
data.tar.gz: e0cbcc3f2f1bf8f9f9aa884f2bbc8fc8d70f88af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da563b140191a37af5e8f1414c092bc79ed54f130b8e232820b55bee4f39ef52db74af6caed3057369989d2740912e8e5feee8773e9d68fc4674e741143508b9
|
7
|
+
data.tar.gz: b678b858e3d2ec88797fe6822589e751b6dce1466d8d456ca53d6f66d409e5424d303ca32c73553f1b482b2c89af88937076733d5a9863f7d8901f9b37b3316b
|
@@ -69,7 +69,6 @@ class UserAgent
|
|
69
69
|
# shitty bot.
|
70
70
|
if application.nil?
|
71
71
|
true
|
72
|
-
|
73
72
|
# Match common case when bots refer to themselves as bots in
|
74
73
|
# the application comment. There are no standards for how bots
|
75
74
|
# should call themselves so its not an exhaustive method.
|
@@ -77,8 +76,8 @@ class UserAgent
|
|
77
76
|
# If you want to expand the scope, override the method and
|
78
77
|
# provide your own regexp. Any patches to future extend this
|
79
78
|
# list will be rejected.
|
80
|
-
elsif
|
81
|
-
|
79
|
+
elsif detect_comment_match(/bot/i)
|
80
|
+
true
|
82
81
|
elsif product = application.product
|
83
82
|
product.include?('bot')
|
84
83
|
else
|
@@ -0,0 +1,63 @@
|
|
1
|
+
class UserAgent
|
2
|
+
module Browsers
|
3
|
+
class Vivaldi < Base
|
4
|
+
def self.extend?(agent)
|
5
|
+
agent.detect { |useragent| useragent.product == 'Vivaldi' }
|
6
|
+
end
|
7
|
+
|
8
|
+
def browser
|
9
|
+
'Vivaldi'
|
10
|
+
end
|
11
|
+
|
12
|
+
def build
|
13
|
+
webkit.version
|
14
|
+
end
|
15
|
+
|
16
|
+
def version
|
17
|
+
last.version
|
18
|
+
end
|
19
|
+
|
20
|
+
def application
|
21
|
+
self.reject { |agent| agent.comment.nil? || agent.comment.empty? }.first
|
22
|
+
end
|
23
|
+
|
24
|
+
def platform
|
25
|
+
return unless application
|
26
|
+
|
27
|
+
if application.comment[0] =~ /Windows/
|
28
|
+
'Windows'
|
29
|
+
elsif application.comment.any? { |c| c =~ /CrOS/ }
|
30
|
+
'ChromeOS'
|
31
|
+
elsif application.comment.any? { |c| c =~ /Android/ }
|
32
|
+
'Android'
|
33
|
+
else
|
34
|
+
application.comment[0]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def webkit
|
39
|
+
detect_product("AppleWebKit")
|
40
|
+
end
|
41
|
+
|
42
|
+
def os
|
43
|
+
return unless application
|
44
|
+
|
45
|
+
if application.comment[0] =~ /Windows NT/
|
46
|
+
OperatingSystems.normalize_os(application.comment[0])
|
47
|
+
elsif application.comment[2].nil?
|
48
|
+
OperatingSystems.normalize_os(application.comment[1])
|
49
|
+
elsif application.comment[1] =~ /Android/
|
50
|
+
OperatingSystems.normalize_os(application.comment[1])
|
51
|
+
else
|
52
|
+
OperatingSystems.normalize_os(application.comment[2])
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def localization
|
57
|
+
return unless application
|
58
|
+
|
59
|
+
application.comment[3]
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
class UserAgent
|
2
|
+
module Browsers
|
3
|
+
class WechatBrowser < Base
|
4
|
+
def self.extend?(agent)
|
5
|
+
agent.detect { |useragent| useragent.product =~ /MicroMessenger/i }
|
6
|
+
end
|
7
|
+
|
8
|
+
def browser
|
9
|
+
'Wechat Browser'
|
10
|
+
end
|
11
|
+
|
12
|
+
def version
|
13
|
+
micro_messenger = detect_product("MicroMessenger")
|
14
|
+
Version.new(micro_messenger.version)
|
15
|
+
end
|
16
|
+
|
17
|
+
def platform
|
18
|
+
return unless application && application.comment
|
19
|
+
|
20
|
+
if application.comment[0] =~ /iPhone/
|
21
|
+
'iPhone'
|
22
|
+
elsif application.comment.any? { |c| c =~ /Android/ }
|
23
|
+
'Android'
|
24
|
+
else
|
25
|
+
application.comment[0]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def os
|
30
|
+
return unless application && application.comment
|
31
|
+
|
32
|
+
if application.comment[0] =~ /Windows NT/
|
33
|
+
OperatingSystems.normalize_os(application.comment[0])
|
34
|
+
elsif application.comment[2].nil?
|
35
|
+
OperatingSystems.normalize_os(application.comment[1])
|
36
|
+
elsif application.comment[1] =~ /Android/
|
37
|
+
OperatingSystems.normalize_os(application.comment[1])
|
38
|
+
else
|
39
|
+
OperatingSystems.normalize_os(application.comment[2])
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/user_agent/browsers.rb
CHANGED
@@ -5,12 +5,14 @@ require 'user_agent/browsers/gecko'
|
|
5
5
|
require 'user_agent/browsers/internet_explorer'
|
6
6
|
require 'user_agent/browsers/opera'
|
7
7
|
require 'user_agent/browsers/webkit'
|
8
|
+
require 'user_agent/browsers/wechat_browser'
|
8
9
|
require 'user_agent/browsers/windows_media_player'
|
9
10
|
require 'user_agent/browsers/itunes'
|
10
11
|
require 'user_agent/browsers/apple_core_media'
|
11
12
|
require 'user_agent/browsers/libavformat'
|
12
13
|
require 'user_agent/browsers/playstation'
|
13
14
|
require 'user_agent/browsers/podcast_addict'
|
15
|
+
require 'user_agent/browsers/vivaldi'
|
14
16
|
|
15
17
|
class UserAgent
|
16
18
|
module Browsers
|
@@ -24,6 +26,8 @@ class UserAgent
|
|
24
26
|
Edge,
|
25
27
|
InternetExplorer,
|
26
28
|
Opera,
|
29
|
+
WechatBrowser,
|
30
|
+
Vivaldi,
|
27
31
|
Chrome,
|
28
32
|
ITunes,
|
29
33
|
PlayStation,
|
@@ -39,7 +39,7 @@ class UserAgent
|
|
39
39
|
if $1.nil?
|
40
40
|
"iOS"
|
41
41
|
else
|
42
|
-
version = $1.
|
42
|
+
version = $1.tr('_', '.')
|
43
43
|
"iOS #{version}"
|
44
44
|
end
|
45
45
|
end
|
@@ -50,7 +50,7 @@ class UserAgent
|
|
50
50
|
if $1.nil?
|
51
51
|
"OS X"
|
52
52
|
else
|
53
|
-
version = $1.
|
53
|
+
version = $1.tr('_', '.')
|
54
54
|
"OS X #{version}"
|
55
55
|
end
|
56
56
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: useragent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.16.
|
4
|
+
version: 0.16.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Peek
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-02-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -39,8 +39,7 @@ dependencies:
|
|
39
39
|
- - ~>
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '3.0'
|
42
|
-
description:
|
43
|
-
HTTP User Agent parser
|
42
|
+
description: HTTP User Agent parser
|
44
43
|
email: garry@robustsoftware.co.uk
|
45
44
|
executables: []
|
46
45
|
extensions: []
|
@@ -61,13 +60,15 @@ files:
|
|
61
60
|
- lib/user_agent/browsers/opera.rb
|
62
61
|
- lib/user_agent/browsers/playstation.rb
|
63
62
|
- lib/user_agent/browsers/podcast_addict.rb
|
63
|
+
- lib/user_agent/browsers/vivaldi.rb
|
64
64
|
- lib/user_agent/browsers/webkit.rb
|
65
|
+
- lib/user_agent/browsers/wechat_browser.rb
|
65
66
|
- lib/user_agent/browsers/windows_media_player.rb
|
66
67
|
- lib/user_agent/comparable.rb
|
67
68
|
- lib/user_agent/operating_systems.rb
|
68
69
|
- lib/user_agent/version.rb
|
69
70
|
- lib/useragent.rb
|
70
|
-
homepage:
|
71
|
+
homepage: https://github.com/gshutler/useragent
|
71
72
|
licenses:
|
72
73
|
- MIT
|
73
74
|
metadata: {}
|