browser 2.7.1 → 5.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE.md +1 -1
- data/.github/workflows/tests.yml +57 -0
- data/.gitignore +1 -0
- data/.prettierignore +1 -0
- data/.rubocop.yml +13 -1
- data/CHANGELOG.md +122 -13
- data/FUNDING.yml +3 -0
- data/README.md +134 -88
- data/Rakefile +8 -1
- data/bot_exceptions.yml +1 -0
- data/bots.yml +300 -293
- data/browser.gemspec +4 -1
- data/gemfiles/{rails5.gemfile → rails6_1.gemfile} +1 -1
- data/lib/browser/accept_language.rb +4 -4
- data/lib/browser/aliases.rb +1 -1
- data/lib/browser/alipay.rb +1 -1
- data/lib/browser/base.rb +82 -18
- data/lib/browser/blackberry.rb +1 -1
- data/lib/browser/bot/empty_user_agent_matcher.rb +11 -0
- data/lib/browser/bot/keyword_matcher.rb +11 -0
- data/lib/browser/bot/known_bots_matcher.rb +11 -0
- data/lib/browser/bot.rb +34 -26
- data/lib/browser/browser.rb +59 -56
- data/lib/browser/chrome.rb +13 -3
- data/lib/browser/device/android.rb +1 -1
- data/lib/browser/device/blackberry_playbook.rb +1 -1
- data/lib/browser/device/ipad.rb +1 -1
- data/lib/browser/device/iphone.rb +1 -1
- data/lib/browser/device/ipod_touch.rb +1 -1
- data/lib/browser/device/kindle.rb +1 -1
- data/lib/browser/device/kindle_fire.rb +1 -1
- data/lib/browser/device/playstation3.rb +1 -1
- data/lib/browser/device/playstation4.rb +1 -1
- data/lib/browser/device/psp.rb +1 -1
- data/lib/browser/device/psvita.rb +1 -1
- data/lib/browser/device/samsung.rb +33 -0
- data/lib/browser/device/surface.rb +1 -1
- data/lib/browser/device/switch.rb +1 -1
- data/lib/browser/device/tv.rb +1 -1
- data/lib/browser/device/unknown.rb +1 -1
- data/lib/browser/device/wii.rb +1 -1
- data/lib/browser/device/wiiu.rb +1 -1
- data/lib/browser/device/xbox_360.rb +1 -1
- data/lib/browser/device/xbox_one.rb +1 -1
- data/lib/browser/device.rb +37 -27
- data/lib/browser/duck_duck_go.rb +22 -0
- data/lib/browser/edge.rb +3 -3
- data/lib/browser/electron.rb +1 -1
- data/lib/browser/facebook.rb +1 -1
- data/lib/browser/firefox.rb +1 -1
- data/lib/browser/google_search_app.rb +21 -0
- data/lib/browser/huawei_browser.rb +21 -0
- data/lib/browser/instagram.rb +1 -1
- data/lib/browser/internet_explorer.rb +2 -2
- data/lib/browser/maxthon.rb +21 -0
- data/lib/browser/meta/base.rb +0 -1
- data/lib/browser/meta.rb +12 -13
- data/lib/browser/micro_messenger.rb +1 -1
- data/lib/browser/middleware/context/additions.rb +1 -1
- data/lib/browser/middleware.rb +1 -1
- data/lib/browser/miui_browser.rb +21 -0
- data/lib/browser/nokia.rb +1 -1
- data/lib/browser/opera.rb +1 -1
- data/lib/browser/otter.rb +1 -1
- data/lib/browser/phantom_js.rb +1 -1
- data/lib/browser/platform/adobe_air.rb +1 -1
- data/lib/browser/platform/android.rb +1 -1
- data/lib/browser/platform/base.rb +3 -2
- data/lib/browser/platform/blackberry.rb +1 -1
- data/lib/browser/platform/chrome_os.rb +1 -1
- data/lib/browser/platform/firefox_os.rb +1 -1
- data/lib/browser/platform/ios.rb +2 -2
- data/lib/browser/platform/kai_os.rb +23 -0
- data/lib/browser/platform/linux.rb +1 -1
- data/lib/browser/platform/mac.rb +5 -3
- data/lib/browser/platform/{other.rb → unknown.rb} +3 -3
- data/lib/browser/platform/windows.rb +2 -2
- data/lib/browser/platform/windows_mobile.rb +1 -1
- data/lib/browser/platform/windows_phone.rb +1 -1
- data/lib/browser/platform.rb +37 -28
- data/lib/browser/qq.rb +1 -1
- data/lib/browser/rails.rb +3 -3
- data/lib/browser/safari.rb +16 -1
- data/lib/browser/samsung_browser.rb +21 -0
- data/lib/browser/snapchat.rb +1 -1
- data/lib/browser/sougou_browser.rb +24 -0
- data/lib/browser/sputnik.rb +2 -5
- data/lib/browser/uc_browser.rb +1 -1
- data/lib/browser/{generic.rb → unknown.rb} +3 -3
- data/lib/browser/version.rb +1 -1
- data/lib/browser/weibo.rb +1 -1
- data/lib/browser/yandex.rb +1 -1
- data/lib/browser.rb +2 -2
- data/samsung.yml +138 -0
- data/test/browser_test.rb +37 -10
- data/test/test_helper.rb +8 -0
- data/test/ua.yml +26 -3
- data/test/ua_bots.yml +9 -2
- data/test/ua_search_engines.yml +1 -0
- data/test/unit/accept_language_test.rb +6 -0
- data/test/unit/adobe_air_test.rb +1 -1
- data/test/unit/alipay_test.rb +6 -0
- data/test/unit/blackberry_test.rb +0 -6
- data/test/unit/bots_test.rb +26 -39
- data/test/unit/chrome_test.rb +8 -3
- data/test/unit/console_test.rb +2 -2
- data/test/unit/device_test.rb +30 -3
- data/test/unit/duck_duck_go_test.rb +37 -0
- data/test/unit/edge_test.rb +34 -6
- data/test/unit/firefox_test.rb +0 -3
- data/test/unit/google_search_app_test.rb +54 -0
- data/test/unit/huawei_browser_test.rb +25 -0
- data/test/unit/internet_explorer_test.rb +0 -12
- data/test/unit/ios_test.rb +0 -5
- data/test/unit/kai_os_test.rb +31 -0
- data/test/unit/kindle_test.rb +0 -2
- data/test/unit/maxthon_test.rb +25 -0
- data/test/unit/meta_test.rb +10 -2
- data/test/unit/micro_messenger_test.rb +21 -6
- data/test/unit/miui_browser_test.rb +25 -0
- data/test/unit/opera_test.rb +1 -2
- data/test/unit/platform_test.rb +13 -8
- data/test/unit/qq_test.rb +12 -0
- data/test/unit/safari_test.rb +12 -7
- data/test/unit/samsung_browser_test.rb +23 -0
- data/test/unit/sougou_browser_test.rb +41 -0
- data/test/unit/sputnik_test.rb +1 -0
- metadata +46 -16
- data/.bundle/config +0 -2
- data/.travis.yml +0 -23
- data/lib/browser/meta/modern.rb +0 -11
- /data/gemfiles/{rails6.gemfile → rails6_0.gemfile} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 837e072e8544da56ee51cf187b35850444d17c931c535115cf50c679d2227a7c
|
4
|
+
data.tar.gz: b789e49dbd45164c42ff5a25c5bd5a5d0c54a32ac945bcbf97ee41682ca23693
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4adb59b646efa17033f385ad0b935f067c9b67a8718a1362f0c5ef49a3c28decd064ec788739c4d38f9969a2189ffc7090ae5d62d3979c249e3237f6b547bfe1
|
7
|
+
data.tar.gz: c0712d54d08e48522b26ce1c162a238711f20bced68b578e300657ec25ff313d9637a2a881dd2797cd8295b90d100a60789364b17cb9b008e4e3da092e071d0a
|
data/.github/ISSUE_TEMPLATE.md
CHANGED
@@ -0,0 +1,57 @@
|
|
1
|
+
name: Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
push:
|
8
|
+
branches:
|
9
|
+
- main
|
10
|
+
|
11
|
+
schedule:
|
12
|
+
- cron: "0 10 * * *"
|
13
|
+
|
14
|
+
jobs:
|
15
|
+
build:
|
16
|
+
name: Tests with Ruby ${{ matrix.ruby }} and ${{ matrix.gemfile }}
|
17
|
+
runs-on: "ubuntu-latest"
|
18
|
+
strategy:
|
19
|
+
fail-fast: false
|
20
|
+
matrix:
|
21
|
+
ruby: ["3.0.x", "2.7.x", "2.6.x", "2.5.x"]
|
22
|
+
gemfile:
|
23
|
+
- Gemfile
|
24
|
+
- gemfiles/rails6_1.gemfile
|
25
|
+
- gemfiles/rails6_0.gemfile
|
26
|
+
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v1
|
29
|
+
|
30
|
+
- uses: actions/cache@v2
|
31
|
+
with:
|
32
|
+
path: vendor/bundle
|
33
|
+
key: >
|
34
|
+
${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles(matrix.gemfile) }}
|
35
|
+
restore-keys: >
|
36
|
+
${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles(matrix.gemfile) }}
|
37
|
+
|
38
|
+
- name: Set up Ruby
|
39
|
+
uses: actions/setup-ruby@v1
|
40
|
+
with:
|
41
|
+
ruby-version: ${{ matrix.ruby }}
|
42
|
+
|
43
|
+
- name: Install gem dependencies
|
44
|
+
env:
|
45
|
+
RAILS_ENV: test
|
46
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
47
|
+
run: |
|
48
|
+
gem install bundler
|
49
|
+
bundle config path vendor/bundle
|
50
|
+
bundle update --jobs 4 --retry 3
|
51
|
+
|
52
|
+
- name: Run Tests
|
53
|
+
env:
|
54
|
+
RAILS_ENV: test
|
55
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
56
|
+
run: |
|
57
|
+
bundle exec rake
|
data/.gitignore
CHANGED
data/.prettierignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.yml
|
data/.rubocop.yml
CHANGED
@@ -16,7 +16,7 @@ AllCops:
|
|
16
16
|
Metrics/ClassLength:
|
17
17
|
Enabled: false
|
18
18
|
|
19
|
-
|
19
|
+
Layout/LineLength:
|
20
20
|
Max: 80
|
21
21
|
|
22
22
|
Metrics/MethodLength:
|
@@ -27,3 +27,15 @@ Style/Alias:
|
|
27
27
|
|
28
28
|
Lint/RedundantCopDisableDirective:
|
29
29
|
Enabled: false
|
30
|
+
|
31
|
+
Metrics/AbcSize:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Metrics/CyclomaticComplexity:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
Metrics/PerceivedComplexity:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
Naming/VariableNumber:
|
41
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -1,16 +1,118 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
##
|
3
|
+
## 5.3.1
|
4
4
|
|
5
|
-
-
|
5
|
+
- Remove Stripe webhooks from bot list.
|
6
|
+
|
7
|
+
## 5.3.0
|
8
|
+
|
9
|
+
- Bump up minimum required ruby version to 2.5.0. We're now relying on
|
10
|
+
`String#match?`, which was introduced by ruby-2.4, but given that ruby's
|
11
|
+
stable version is >= 2.5, seems reasonable.
|
12
|
+
|
13
|
+
## 5.2.0
|
14
|
+
|
15
|
+
- Add KaiOS detection.
|
16
|
+
- Replace `String#=~` with `String#match?` and other optimizations.
|
17
|
+
|
18
|
+
## 5.1.0
|
19
|
+
|
20
|
+
- Add Samsung device detection.
|
21
|
+
- Delay parsing `Accept-Language` until `Browser::Base#accept_language` is
|
22
|
+
called for the first time.
|
23
|
+
- Bump up default size limit for `Accept-Language` and `User-Agent` to 2048
|
24
|
+
bytes.
|
25
|
+
|
26
|
+
## 5.0.0
|
27
|
+
|
28
|
+
- Rename `Browser::Platform#other?` to `Browser::Platform#unknown?`.
|
29
|
+
- Unknown platforms now return `:unknown_platform` as the id.
|
30
|
+
- Unknown devices now return `:unknown_device` as the id.
|
31
|
+
- Unknown browsers now return `:unknown_browser` as the id.
|
32
|
+
- All the changes above affect how `browser.meta` is composed.
|
33
|
+
- Add method `Browser::Base#unknown?`.
|
34
|
+
- Fix issue with `Browser::Base#safari?` matching full version.
|
35
|
+
- Add Maxthon detection.
|
36
|
+
- Add Google Search App detection.
|
37
|
+
- Add Huawei Browser detection.
|
38
|
+
- Fix Duck Duck Go browser that was being recognized as a bot.
|
39
|
+
- Add Miui Browser detection.
|
40
|
+
- Add `Browser::Base#qq?`.
|
41
|
+
- Fix QQ detection.
|
42
|
+
- Fix Alipay detection.
|
43
|
+
- Add Sougou Browser detection.
|
44
|
+
- User agent has a size limit of 512 bytes. This can be customized through
|
45
|
+
`Browser.user_agent_size_limit`.
|
46
|
+
- Accept-Language has a size limit of 256 bytes. This can be customized through
|
47
|
+
`Browser.accept_language_size_limit`.
|
48
|
+
|
49
|
+
## 4.2.0
|
50
|
+
|
51
|
+
- Fix Chrome Lighthouse detection.
|
52
|
+
- Add Skype to bot list.
|
53
|
+
|
54
|
+
## 4.1.0
|
55
|
+
|
56
|
+
- Add Samsung browser.
|
57
|
+
- Add Google Image Proxy to the bot list.
|
58
|
+
- Add The Knowledge AI bot to the bot list.
|
59
|
+
- Add Go HttpClient to the bot list.
|
60
|
+
- Fix Microsoft Edge detection on Android and iOS.
|
61
|
+
- Fix MicroMessenger detection on Android
|
62
|
+
|
63
|
+
## 4.0.0
|
64
|
+
|
65
|
+
- Add Chrome Lighthouse to bot list.
|
66
|
+
- Add SeobilityBot to the bot list.
|
67
|
+
- Detect Mac-based platforms differently, depending on the version; "Mac OS X"
|
68
|
+
will be returned for versions prior to 10.12, and "macOS" for newer versions.
|
69
|
+
- Remove `Browser.modern_rules` and `Browser::Base#modern?`.
|
70
|
+
- Add DuckDuckGo browser.
|
71
|
+
|
72
|
+
# 3.0.3
|
73
|
+
|
74
|
+
- Deprecate `Browser.modern_rules` and `Browser::Base#modern?`. Theses methods
|
75
|
+
will be removed on the next major released, or by June 1st 2020.
|
76
|
+
|
77
|
+
## 3.0.2
|
78
|
+
|
79
|
+
- Remove .bundle directory from package.
|
80
|
+
|
81
|
+
## 3.0.1
|
82
|
+
|
83
|
+
- Fix issue with MS Edge detection as a modern browser.
|
84
|
+
|
85
|
+
## 3.0.0
|
86
|
+
|
87
|
+
- Add ArchiveTeam's ArchiveBot to the bot list.
|
88
|
+
- Fix QQ Browser detection.
|
89
|
+
- Update modern rules.
|
90
|
+
- You can now define new bot matchers by adding a callable object to
|
91
|
+
`Browser::Bot.matchers`.
|
92
|
+
- Fix `browser.yandex?` and `browser.sputnik?`.
|
93
|
+
- [BREAKING CHANGE] Removed methods to enable the bot's empty user agent
|
94
|
+
detection (`Browser::Bot.detect_empty_ua!` and
|
95
|
+
`Browser::Bot.detect_empty_ua?`).
|
96
|
+
- [BREAKING CHANGE] Bot detection is now more aggressive by default. It matches
|
97
|
+
empty user agents, anything that matches
|
98
|
+
`crawl|fetch|search|monitoring|spider|bot`, and anything listed under
|
99
|
+
https://github.com/fnando/browser/blob/master/bots.yml.
|
100
|
+
- Add Jaunt to the bot list.
|
101
|
+
|
102
|
+
## 2.7.1
|
103
|
+
|
104
|
+
- Handle Snapchat user agents that have a space or an empty string instead of a
|
105
|
+
slash before the version.
|
6
106
|
- Fix iOS 10+ version detection.
|
7
|
-
- Add fallback versions for instagram and snapchat to avoid NoMethodErrors on
|
107
|
+
- Add fallback versions for instagram and snapchat to avoid NoMethodErrors on
|
108
|
+
unexpected user agents.
|
8
109
|
|
9
110
|
## 2.7.0
|
10
111
|
|
11
112
|
- Add more Slack bots.
|
12
113
|
- Handle instagram user agents that have a slash instead of a space.
|
13
|
-
- Add `Browser::Bot.why?(ua)` to help debugging why a user agent is considered
|
114
|
+
- Add `Browser::Bot.why?(ua)` to help debugging why a user agent is considered
|
115
|
+
bot.
|
14
116
|
- Promote Snapchat to a browser (it was detected as a bot previously).
|
15
117
|
- Detect Edge based on Chrome correctly.
|
16
118
|
- Improve Yandex detection.
|
@@ -26,7 +128,8 @@
|
|
26
128
|
|
27
129
|
- Add GarlikCrawler, ImplisenseBot and WikiDo bots.
|
28
130
|
- Add Mastodon URL expander bot.
|
29
|
-
- Add eZ Publish Link Validator, GermCrawler, Pu_iN Crawler, ZoomBot, and
|
131
|
+
- Add eZ Publish Link Validator, GermCrawler, Pu_iN Crawler, ZoomBot, and
|
132
|
+
ZoominfoBot bots.
|
30
133
|
- Add Datanyze bot.
|
31
134
|
- Add support for Instagram in-app browser.
|
32
135
|
- Add Updown.io monitor bot.
|
@@ -48,13 +151,13 @@
|
|
48
151
|
- Add Jooble bot.
|
49
152
|
- Add Fyre bot.
|
50
153
|
- Drop Rails 4 official support.
|
51
|
-
- Fix accept-language sorting (If HTTP-header has value `en,fr`—without
|
154
|
+
- Fix accept-language sorting (If HTTP-header has value `en,fr`—without
|
155
|
+
qualities—the first language should be `en` instead of `fr`).
|
52
156
|
- Ignore malformed strings when comparing versions.
|
53
157
|
- Fix Facebook detection on newer apps.
|
54
158
|
- Change precedence for bot detection when common libs are used.
|
55
159
|
- Add Yandex's search browser to the exception list.
|
56
160
|
|
57
|
-
|
58
161
|
## v2.5.3
|
59
162
|
|
60
163
|
- Add Google Site Verification to the bot list.
|
@@ -95,8 +198,10 @@
|
|
95
198
|
- Add Google Drive API, Proximic Spider, NewRelic pinger and SocialRank bots.
|
96
199
|
- Add Pinboard in-app browser to the bot exception list.
|
97
200
|
- All browser detection methods can now compare versions.
|
98
|
-
- All platform detection methods can now compare versions (except `#linux?` and
|
99
|
-
|
201
|
+
- All platform detection methods can now compare versions (except `#linux?` and
|
202
|
+
`#firefox_os?`).
|
203
|
+
- Add `browser/aliases`, so you can have methods on the base object (e.g.
|
204
|
+
`browser.mobile?`). See README for instructions.
|
100
205
|
- Remove official support for Rails 3 and Ruby 2.1.
|
101
206
|
|
102
207
|
## v2.3.0
|
@@ -127,7 +232,8 @@
|
|
127
232
|
|
128
233
|
## v2.0.3
|
129
234
|
|
130
|
-
- Fix issue with version detection when no actual version is provided (i.e. the
|
235
|
+
- Fix issue with version detection when no actual version is provided (i.e. the
|
236
|
+
user agent doesn't have any version information).
|
131
237
|
|
132
238
|
## v2.0.2
|
133
239
|
|
@@ -140,9 +246,12 @@
|
|
140
246
|
|
141
247
|
## v2.0.0
|
142
248
|
|
143
|
-
- `Browser#platform` now returns instance of `Browser::Platform`, instead of a
|
144
|
-
|
145
|
-
- `Browser#
|
249
|
+
- `Browser#platform` now returns instance of `Browser::Platform`, instead of a
|
250
|
+
`String`. It contains information about the platform (software).
|
251
|
+
- `Browser#device` was added. It returns information about the device
|
252
|
+
(hardware).
|
253
|
+
- `Browser#accept_language` now returns a list of `Browser::AcceptLanguage`
|
254
|
+
objects.
|
146
255
|
- `Browser#bot` now returns a `Browser::Bot` instance.
|
147
256
|
- Safari running as web app mode is not recognized as Safari anymore.
|
148
257
|
- ruby-2.3+ will always activate frozen strings.
|
data/FUNDING.yml
ADDED