seo_cache 0.18.0 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6132fa1fc97736b7bbfea3971ae247d65dd7a373a799ce4907bbd2106f8f9fa6
4
- data.tar.gz: 067f4bdea04af6f7c931c2ce09f283fb907c6a7a56afe364ef5ea932e320f3b1
3
+ metadata.gz: 93939e53687c186d003b4b09abed06bcf1b6ac0a63b808c3a7abfadd7e6531cb
4
+ data.tar.gz: 4d362ee26521e0ebb55b61c15e6b9d5e6c9e19877e57ead9cfab9765c4310142
5
5
  SHA512:
6
- metadata.gz: e4826755941dc1bfba9f98182c5d3c07d2ca78fe62f443b9e432c3411fc232099ca7966a97191a8e1fa6630b5551fca4679f9c47781411b1e4182f2013093d19
7
- data.tar.gz: 6aa1029ab15d5f6abd879cb54fe5cb74f972aa452c4555ee19dd4ac98cb63459507d742b2e359ad627eb593b940efc0a59c68435ee72780b3e520e2d46fc1c3f
6
+ metadata.gz: fc485c1ea013d77fcf9337c3423bacec563701b319d79b4949304f6bf51fe78c54a3553cdf875b8067e60c1c9c8ae3667dfeec0ee8f29f3991079d5662c3ffa7
7
+ data.tar.gz: 1d634743d69e52965d9c450b046dc19edabd88b92783c567c460a11b7407473d395600775cd5aaff31f96db5b68fa5143954f90fa7b154fbccf76f3f9284e00b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.19.0
2
+
3
+ - Add option to cache page if user connected
4
+
1
5
  ## 0.18.0
2
6
 
3
7
  - Correct use of prerender param in URL
data/README.md CHANGED
@@ -112,6 +112,12 @@ URLs to whitelist:
112
112
  SeoCache.whitelist_urls = []
113
113
  ```
114
114
 
115
+ Cache page even if user is connected (be careful when caching sensitive data):
116
+
117
+ ```ruby
118
+ SeoCache.cache_with_user_connected = true
119
+ ```
120
+
115
121
  Parameter to add manually to the URl to force page caching, if you want to cache a specific URL (e.g. `https://<my_website>/?_seo_cache_=true`):
116
122
 
117
123
  ```ruby
@@ -236,6 +242,9 @@ location / {
236
242
  if ($arg__seo_cache_) {
237
243
  break;
238
244
  }
245
+
246
+ # Local rewrite to remove trailing slash
247
+ rewrite ^/(.*)/$ /$1 last;
239
248
 
240
249
  try_files /seo_cache/$uri/index$cache_extension /seo_cache/$uri$cache_extension /seo_cache/$uri $uri @rubyproxy;
241
250
  }
@@ -78,6 +78,9 @@ module SeoCache
78
78
  request = Rack::Request.new(env)
79
79
  query_params = Rack::Utils.parse_query(request.query_string)
80
80
 
81
+ # Check if user connected
82
+ return false if !SeoCache.cache_with_user_connected && (env['warden'].respond_to?(:user) && env['warden'].user.present?)
83
+
81
84
  # If it is the generated page...don't prerender
82
85
  return false if query_params.has_key?(SeoCache.prerender_url_param)
83
86
 
@@ -6,9 +6,9 @@ require 'seo_cache/page_render'
6
6
  module SeoCache
7
7
  class PopulateCache
8
8
  def initialize(host, paths, options = {})
9
- @host = host
10
- @paths = paths
11
- @page_render = PageRender.new
9
+ @host = host
10
+ @paths = paths
11
+ @page_render = PageRender.new
12
12
  @page_caching = PageCaching.new
13
13
 
14
14
  @force_cache = options.fetch(:force_cache, false)
@@ -30,6 +30,7 @@ module SeoCache
30
30
  @page_caching.cache(page_source, path)
31
31
  end
32
32
 
33
+ ensure
33
34
  @page_render.close_connection
34
35
  end
35
36
  end
@@ -1,3 +1,3 @@
1
1
  module SeoCache
2
- VERSION = '0.18.0'.freeze
2
+ VERSION = '0.19.0'.freeze
3
3
  end
data/lib/seo_cache.rb CHANGED
@@ -43,6 +43,9 @@ module SeoCache
43
43
  mattr_accessor :blacklist_params
44
44
  self.blacklist_params = []
45
45
 
46
+ mattr_accessor :cache_with_user_connected
47
+ self.cache_with_user_connected = false
48
+
46
49
  mattr_accessor :log_missed_cache
47
50
  self.log_missed_cache = false
48
51
 
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: 0.18.0
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - FloXcoder
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-20 00:00:00.000000000 Z
11
+ date: 2020-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -226,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
226
  - !ruby/object:Gem::Version
227
227
  version: '0'
228
228
  requirements: []
229
- rubygems_version: 3.1.2
229
+ rubygems_version: 3.1.3
230
230
  signing_key:
231
231
  specification_version: 4
232
232
  summary: Cache dedicated for SEO with Javascript rendering