seo_cache 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/seo_cache/middleware.rb +10 -4
- data/lib/seo_cache/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 470c0f8bf9bee91e738987dd31618d612d4f8007fe5d486bce1c4d7c0f1053de
|
4
|
+
data.tar.gz: cc0bb416f7893fb08a97e845635c374bf8dbc846127724077729d6870ceb93ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6057c2afeb50daf1a93c1df0e9f6c90d55be66688445a417dca2d6b434d0dfc587e487be4d4404d3897c783f0e3d3d2880d5f9b6524b35975e5c87031028e4c2
|
7
|
+
data.tar.gz: 5822d662fdbbf6d2c47bb21ed627697c52760e6133eff49978f11c3ad6fd984cb0b67c8b6e778e6bc43742a2ba2241bdf81d24f810333e92be60c840d159559c
|
data/CHANGELOG.md
CHANGED
data/lib/seo_cache/middleware.rb
CHANGED
@@ -36,9 +36,15 @@ module SeoCache
|
|
36
36
|
else
|
37
37
|
Thread.new do
|
38
38
|
prerender_data = page_render(env)
|
39
|
-
# Extract status from render page or return
|
40
|
-
status = prerender_data&.scan(/<!--status:(\d+)-->/)&.last&.first
|
41
|
-
|
39
|
+
# Extract status from render page or return success (200)
|
40
|
+
status = prerender_data&.scan(/<!--status:(\d+)-->/)&.last&.first || 200
|
41
|
+
|
42
|
+
if SeoCache.log_missed_cache && status.to_s.start_with?('2')
|
43
|
+
env_request = Rack::Request.new(env)
|
44
|
+
SeoCache.log("missed cache : #{env_request.path} (User agent: #{env_request.user_agent})")
|
45
|
+
end
|
46
|
+
|
47
|
+
after_render(env, prerender_data, status)
|
42
48
|
end
|
43
49
|
end
|
44
50
|
elsif prerender_params?(env)
|
@@ -94,7 +100,7 @@ module SeoCache
|
|
94
100
|
return false if SeoCache.blacklist_params.present? && SeoCache.blacklist_params.any? { |param| query_params.has_key?(param) }
|
95
101
|
|
96
102
|
# if it is a bot and is requesting a resource...don't prerender
|
97
|
-
return false if @extensions_to_ignore.any? { |extension| request.fullpath.include?
|
103
|
+
return false if @extensions_to_ignore.any? { |extension| request.fullpath.include?(extension) }
|
98
104
|
|
99
105
|
# if it is a bot and not requesting a resource and is not whitelisted...don't prerender
|
100
106
|
return false if SeoCache.whitelist_urls.present? && SeoCache.whitelist_urls.all? { |whitelisted| !Regexp.new(whitelisted).match(request.fullpath) }
|
data/lib/seo_cache/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seo_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- FloXcoder
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|