seo_cache 0.13.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/seo_cache/middleware.rb +8 -4
- data/lib/seo_cache/page_render.rb +5 -1
- 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: e4489f101114c4ab4c88d1328f3caa18a2b32d025e28a6d3dd0e635ab0732f2f
|
4
|
+
data.tar.gz: d24a3daad5ba14c90d7be285204e753ec3f25c8574f04a26a6e3d77298f83f78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d9affe855d206a22002ad0ef1ef8257e0635fdd74fce95c92b3dd7b54e55a63e71bc09413f71cb79f1ee471386ee529a15bee9a7ec36f9a2ee9e7180aea3c95
|
7
|
+
data.tar.gz: 55e82b4cdf9cdc037acd8dbfe69a274508b8317b1b6d111d723a039d68011d5ad114abc3444b6a19ad391e376ccff5c25908f050cbfd3fbb4a10ae2ce6691496
|
data/CHANGELOG.md
CHANGED
data/lib/seo_cache/middleware.rb
CHANGED
@@ -33,8 +33,8 @@ module SeoCache
|
|
33
33
|
else
|
34
34
|
Thread.new do
|
35
35
|
prerender_data = page_render(env)
|
36
|
-
# Extract status from render page
|
37
|
-
status = prerender_data&.scan(/<!--status:(\d+)-->/)&.last&.first
|
36
|
+
# Extract status from render page (return 500 if status cannot be found, some problems happen somewhere)
|
37
|
+
status = prerender_data&.scan(/<!--status:(\d+)-->/)&.last&.first || 500
|
38
38
|
after_render(env, prerender_data, status || 200)
|
39
39
|
end
|
40
40
|
end
|
@@ -44,8 +44,12 @@ module SeoCache
|
|
44
44
|
status, headers, response = @app.call(env)
|
45
45
|
status_code = "<!--status:#{status}-->"
|
46
46
|
# Cannot add at the top of file, Chrome removes leading comments...
|
47
|
-
|
48
|
-
|
47
|
+
begin
|
48
|
+
body_code = response.body.sub('<head>', "<head>#{status_code}")
|
49
|
+
return [status, headers, [body_code]]
|
50
|
+
rescue
|
51
|
+
return [status, headers, [nil]]
|
52
|
+
end
|
49
53
|
end
|
50
54
|
|
51
55
|
return @app.call(env)
|
@@ -35,12 +35,16 @@ module SeoCache
|
|
35
35
|
browser_options.args << 'disable-infobars'
|
36
36
|
browser_options.args << '--headless'
|
37
37
|
browser_options.args << '--no-sandbox'
|
38
|
+
browser_options.args << '--incognito'
|
38
39
|
browser_options.args << '--disable-dev-shm-usage'
|
39
40
|
browser_options.args << '--disable-gpu'
|
40
41
|
browser_options.args << '--disable-web-security'
|
41
42
|
browser_options.args << '--disable-extensions'
|
43
|
+
browser_options.args << '--disable-logging'
|
44
|
+
browser_options.args << '--disable-notifications'
|
45
|
+
browser_options.args << '--disable-sync'
|
42
46
|
browser_options.args << '--window-size=1920x1080'
|
43
|
-
browser_options.args << '--remote-debugging-port=
|
47
|
+
#browser_options.args << '--remote-debugging-port=9222'
|
44
48
|
@driver = ::Selenium::WebDriver.for(:chrome, options: browser_options)
|
45
49
|
end
|
46
50
|
end
|
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: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- FloXcoder
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|