quilt_rails 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/quilt_rails/logger.rb +13 -0
- data/lib/quilt_rails/react_renderable.rb +14 -10
- data/lib/quilt_rails/version.rb +1 -1
- data/lib/quilt_rails.rb +2 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30c0bb97264a063694f11ea9b30ee06bf742e1471a5fe7fdbdcf18bcabe31706
|
4
|
+
data.tar.gz: ca1c6069fd225db57c7841fc702ecb2a84167d5095665c321f2b3a7bd29d1b12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6c6030b7c21bfb472200481c3ee4b627d04209d3c5488cd64dd8fa3039a6de722365955063d545aa8d0ea38786e00150d5ff439a7b457369df3ef79162ae39b
|
7
|
+
data.tar.gz: a14282cb5e80077da8a32e7e01557265794de9824bc0ebd91932b9d40d34a1ca50c7f94bef9755c2050fcac2cd716a9ea7461be74c3034b5374ca53c9aca2e06
|
@@ -7,13 +7,25 @@ module Quilt
|
|
7
7
|
include ReverseProxy::Controller
|
8
8
|
|
9
9
|
def render_react
|
10
|
+
if defined? ShopifySecurityBase
|
11
|
+
ShopifySecurityBase::HTTPHostRestriction.whitelist([Quilt.configuration.react_server_host]) do
|
12
|
+
proxy
|
13
|
+
end
|
14
|
+
else
|
15
|
+
proxy
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def proxy
|
10
22
|
url = "#{Quilt.configuration.react_server_protocol}://#{Quilt.configuration.react_server_host}"
|
11
|
-
|
23
|
+
Quilt::Logger.log("[ReactRenderable] proxying to React server at #{url}")
|
12
24
|
|
13
25
|
begin
|
14
26
|
reverse_proxy(url, headers: { 'X-CSRF-Token': form_authenticity_token }) do |callbacks|
|
15
27
|
callbacks.on_response do |status_code, _response|
|
16
|
-
|
28
|
+
Quilt::Logger.log("[ReactRenderable] #{url} returned #{status_code}")
|
17
29
|
end
|
18
30
|
end
|
19
31
|
rescue Errno::ECONNREFUSED
|
@@ -21,14 +33,6 @@ module Quilt
|
|
21
33
|
end
|
22
34
|
end
|
23
35
|
|
24
|
-
def self.log(string)
|
25
|
-
if Rails.logger.nil?
|
26
|
-
puts string
|
27
|
-
else
|
28
|
-
Rails.logger.info(string)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
36
|
class ReactServerNoResponseError < StandardError
|
33
37
|
def initialize(url)
|
34
38
|
# rubocop:disable LineLength
|
data/lib/quilt_rails/version.rb
CHANGED
data/lib/quilt_rails.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quilt_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathew Allen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/quilt_rails.rb
|
89
89
|
- lib/quilt_rails/configuration.rb
|
90
90
|
- lib/quilt_rails/engine.rb
|
91
|
+
- lib/quilt_rails/logger.rb
|
91
92
|
- lib/quilt_rails/react_renderable.rb
|
92
93
|
- lib/quilt_rails/version.rb
|
93
94
|
homepage: https://github.com/Shopify/quilt/tree/master/gems/quilt_rails
|