prerender_rails 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/prerender_rails.rb +3 -0
- data/prerender_rails.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b02ea13b681d4f5e6a8f66e569a8b85880a856c3
|
4
|
+
data.tar.gz: c274987c34aa4001c1989d5c8e2d1243e640bcae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a61bc9b14d443ed658f1fb4bf4437ce2a176d6aabaae92d4968732c3b1cd64d0b24df498c0b96afc03156bff8cfb62c9e7049a2aebe581d63ef3b694001053b
|
7
|
+
data.tar.gz: 8d5a5eb19f54d5f0587bf5b691467d3eba61dba4dac2a4d3e810e6988df92f558425079d97b01809493de2a59ca8fc35e13c178d9b42b595c966a9bcb0fe80e0
|
data/README.md
CHANGED
@@ -21,6 +21,12 @@ And in `config/environment/production.rb`, add this line:
|
|
21
21
|
config.middleware.use Rack::Prerender
|
22
22
|
```
|
23
23
|
|
24
|
+
or if you have an account on [prerender.io](http://prerender.io) and want to use your token:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
config.middleware.use Rack::Prerender, prerender_token: 'YOUR_TOKEN'
|
28
|
+
```
|
29
|
+
|
24
30
|
## How it works
|
25
31
|
1. Check to make sure we should show a prerendered page
|
26
32
|
1. Check if the request is from a crawler (`_escaped_fragment_` or agent string)
|
data/lib/prerender_rails.rb
CHANGED
@@ -27,6 +27,8 @@ module Rack
|
|
27
27
|
'.pdf',
|
28
28
|
'.doc',
|
29
29
|
'.txt',
|
30
|
+
'.ico',
|
31
|
+
'.rss',
|
30
32
|
'.zip',
|
31
33
|
'.mp3',
|
32
34
|
'.rar',
|
@@ -126,6 +128,7 @@ module Rack
|
|
126
128
|
url = URI.parse(build_api_url(env))
|
127
129
|
headers = { 'User-Agent' => env['HTTP_USER_AGENT'] }
|
128
130
|
headers['X-Prerender-Token'] = ENV['PRERENDER_TOKEN'] if ENV['PRERENDER_TOKEN']
|
131
|
+
headers['X-Prerender-Token'] = @options[:prerender_token] if @options[:prerender_token]
|
129
132
|
req = Net::HTTP::Get.new(url.request_uri, headers)
|
130
133
|
response = Net::HTTP.start(url.host, url.port) { |http| http.request(req) }
|
131
134
|
rescue
|
data/prerender_rails.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "prerender_rails"
|
5
|
-
spec.version = "0.1.
|
5
|
+
spec.version = "0.1.13"
|
6
6
|
spec.authors = ["Todd Hooper"]
|
7
7
|
spec.email = ["todd@collectiveip.com"]
|
8
8
|
spec.description = %q{Rails middleware to prerender your javascript heavy pages on the fly by a phantomjs service}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prerender_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd Hooper
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|