seo_cache 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -2
- data/CHANGELOG.md +4 -0
- data/LICENSE.txt +1 -1
- data/README.md +6 -0
- data/lib/seo_cache/logger.rb +6 -6
- data/lib/seo_cache/middleware.rb +12 -8
- data/lib/seo_cache/version.rb +1 -1
- data/lib/seo_cache.rb +3 -0
- data/seo_cache.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00ac90cae823df12ec7ff2d7dcea46232c5539082805ca603a9f368b59772269
|
4
|
+
data.tar.gz: 74888e92eaf846115a953c56aa5600afc9714a6d0df81a0e1b74d842a11ea916
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d50d063591d7f2d5666b09703d03859323cea404ac518d0b679661724989a5497d6b7d54cc691dc2222e367c5f1e10dc8bd84accfdac6b2d92fdfbe7f6fdf69
|
7
|
+
data.tar.gz: 1320e4d3162b29de954fb0b8c975c00afc01919b4775737f3ce2be0436bc4ded63fa0a3ade46967e8720e5d1746a945597b2809143b7ce79a923268942965a48
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
data/lib/seo_cache/logger.rb
CHANGED
@@ -49,17 +49,17 @@ module SeoCache
|
|
49
49
|
@logger.level = severity
|
50
50
|
else
|
51
51
|
case severity.to_s.downcase
|
52
|
-
when 'debug'
|
52
|
+
when 'debug'
|
53
53
|
@logger.level = DEBUG
|
54
|
-
when 'info'
|
54
|
+
when 'info'
|
55
55
|
@logger.level = INFO
|
56
|
-
when 'warn'
|
56
|
+
when 'warn'
|
57
57
|
@logger.level = WARN
|
58
|
-
when 'error'
|
58
|
+
when 'error'
|
59
59
|
@logger.level = ERROR
|
60
|
-
when 'fatal'
|
60
|
+
when 'fatal'
|
61
61
|
@logger.level = FATAL
|
62
|
-
when 'unknown'
|
62
|
+
when 'unknown'
|
63
63
|
@logger.level = UNKNOWN
|
64
64
|
else
|
65
65
|
raise ArgumentError, "invalid log level: #{severity}"
|
data/lib/seo_cache/middleware.rb
CHANGED
@@ -56,15 +56,11 @@ module SeoCache
|
|
56
56
|
# If it is the generated page...don't prerender
|
57
57
|
return false if query_params.has_key?(SeoCache.prerender_url_param)
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
is_requesting_prerendered_page = true if Rack::Utils.parse_query(request.query_string).has_key?('_escaped_fragment_') || Rack::Utils.parse_query(request.query_string).has_key?(SeoCache.force_cache_url_param)
|
59
|
+
# if it is a bot and host doesn't contain these domains...don't prerender
|
60
|
+
return false if SeoCache.whitelist_hosts.present? && SeoCache.whitelist_hosts.any? { |host| !request.host.include?(host) }
|
62
61
|
|
63
|
-
# if it is a bot...
|
64
|
-
|
65
|
-
|
66
|
-
# if it is BufferBot...show prerendered page
|
67
|
-
is_requesting_prerendered_page = true if buffer_agent
|
62
|
+
# if it is a bot and urls contain these params...don't prerender
|
63
|
+
return false if SeoCache.blacklist_params.present? && SeoCache.blacklist_params.any? { |param| query_params.has_key?(param) }
|
68
64
|
|
69
65
|
# if it is a bot and is requesting a resource...don't prerender
|
70
66
|
return false if @extensions_to_ignore.any? { |extension| request.fullpath.include? extension }
|
@@ -83,6 +79,14 @@ module SeoCache
|
|
83
79
|
end
|
84
80
|
return false if blacklisted_url
|
85
81
|
|
82
|
+
is_requesting_prerendered_page = true if Rack::Utils.parse_query(request.query_string).has_key?('_escaped_fragment_') || Rack::Utils.parse_query(request.query_string).has_key?(SeoCache.force_cache_url_param)
|
83
|
+
|
84
|
+
# if it is a bot...show prerendered page
|
85
|
+
is_requesting_prerendered_page = true if @crawler_user_agents.any? { |crawler_user_agent| user_agent.downcase.include?(crawler_user_agent.downcase) }
|
86
|
+
|
87
|
+
# if it is BufferBot...show prerendered page
|
88
|
+
is_requesting_prerendered_page = true if buffer_agent
|
89
|
+
|
86
90
|
SeoCache.log('force cache : ' + request.path) if Rack::Utils.parse_query(request.query_string).has_key?(SeoCache.force_cache_url_param) && SeoCache.log_missed_cache
|
87
91
|
|
88
92
|
return is_requesting_prerendered_page
|
data/lib/seo_cache/version.rb
CHANGED
data/lib/seo_cache.rb
CHANGED
data/seo_cache.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_dependency 'selenium-webdriver', '3.141.0' # 3.142 is bugged
|
30
30
|
spec.add_dependency 'webdrivers', '~> 4'
|
31
31
|
|
32
|
-
spec.add_development_dependency 'bundler', '~>
|
32
|
+
spec.add_development_dependency 'bundler', '~> 2'
|
33
33
|
spec.add_development_dependency 'rake', '~> 12'
|
34
34
|
spec.add_development_dependency 'rspec', '~> 3'
|
35
35
|
spec.add_development_dependency 'simplecov', '~> 0.16'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seo_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- FloXcoder
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
131
|
+
version: '2'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
138
|
+
version: '2'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rake
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|