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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59b30f7e6f6f4a32691cf7ad37700d097faacbfac3798e2e7676398dbb75d99d
4
- data.tar.gz: a975f18919b4637aaf7d1f58eb1ffecd37c3d08d729c9a6d4726d94e8799f6b4
3
+ metadata.gz: 30c0bb97264a063694f11ea9b30ee06bf742e1471a5fe7fdbdcf18bcabe31706
4
+ data.tar.gz: ca1c6069fd225db57c7841fc702ecb2a84167d5095665c321f2b3a7bd29d1b12
5
5
  SHA512:
6
- metadata.gz: 1d22c4fb0db9323321e41907dc2841b624309917fd098def8f7b54d3e835eb084cbc104dc065e395547817b7c0c48de7e369eb4910c64dff4f3e78deec97e587
7
- data.tar.gz: 82e7ccdfd5825531585749c5860bd7cc0867cfcedb6837710ec9f53183435a00a1f7639feefbe14d73c67c9b6fe586415455441538b47b2215985c5f5e5f368f
6
+ metadata.gz: a6c6030b7c21bfb472200481c3ee4b627d04209d3c5488cd64dd8fa3039a6de722365955063d545aa8d0ea38786e00150d5ff439a7b457369df3ef79162ae39b
7
+ data.tar.gz: a14282cb5e80077da8a32e7e01557265794de9824bc0ebd91932b9d40d34a1ca50c7f94bef9755c2050fcac2cd716a9ea7461be74c3034b5374ca53c9aca2e06
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Quilt
4
+ module Logger
5
+ def self.log(string)
6
+ if defined? Rails && Rails.logger.nil?
7
+ puts string
8
+ else
9
+ Rails.logger.info(string)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -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
- ReactRenderable.log("[ReactRenderable] proxying to React server at #{url}")
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
- ReactRenderable.log("[ReactRenderable] #{url} returned #{status_code}")
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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Quilt
3
- VERSION = "1.4.0"
3
+ VERSION = "1.4.1"
4
4
  end
data/lib/quilt_rails.rb CHANGED
@@ -2,7 +2,8 @@
2
2
  module Quilt
3
3
  end
4
4
 
5
- require "quilt_rails/engine"
6
5
  require "quilt_rails/version"
6
+ require "quilt_rails/engine"
7
+ require "quilt_rails/logger"
7
8
  require "quilt_rails/configuration"
8
9
  require "quilt_rails/react_renderable"
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.0
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-21 00:00:00.000000000 Z
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