shopify_app 12.0.4 → 12.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +11 -1
- data/lib/shopify_app/configuration.rb +7 -1
- data/lib/shopify_app/middleware/same_site_cookie_middleware.rb +3 -37
- data/lib/shopify_app/version.rb +1 -1
- data/package.json +1 -1
- data/shopify_app.gemspec +3 -3
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3552d2c9437c900a3217f00b142d81d187cfad26a4a3ea84ca3e1b64cb03dc14
|
4
|
+
data.tar.gz: 6aa9bde06b9635c5d61c6c01271ee073f54b7473ee4dbce8c4cf3af9f776d1aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b1c648bd6ecc8ed980b1f15354edb3a85856a4d80c5598b020cc4d9dd0bec1bfb90da82c01bcefeb9deb75376fc023d43f5b3b406aaecc77fab03061c63c8fb
|
7
|
+
data.tar.gz: e3647c88c1b956c6ec76c8f0414a4f4c9e4ae3f97b5502adbd9e9507b7dbd94559d6905a3175f9a45267d5b6cd165ad6394bce08cb91530f8c777624c5ba9522
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -91,7 +91,9 @@ SHOPIFY_API_KEY=your api key
|
|
91
91
|
SHOPIFY_API_SECRET=your api secret
|
92
92
|
```
|
93
93
|
|
94
|
-
These values can be found on the "App Setup" page in the [Shopify Partners Dashboard][dashboard]. If you are checking your code into a code repository, ensure your `.gitignore` prevents your `.env` file from being checked into any publicly accessible code.
|
94
|
+
These values can be found on the "App Setup" page in the [Shopify Partners Dashboard][dashboard]. If you are checking your code into a code repository, ensure your `.gitignore` prevents your `.env` file from being checked into any publicly accessible code.
|
95
|
+
|
96
|
+
**You will need to load the ENV variables into your enviroment, you can do this with the [dot-env](https://github.com/bkeepers/dotenv) gem or any other method you wish to.**
|
95
97
|
|
96
98
|
### Install Generator
|
97
99
|
|
@@ -287,6 +289,14 @@ bin/rails g shopify_app:add_after_authenticate_job
|
|
287
289
|
|
288
290
|
If you want to perform that action only once, e.g. send a welcome email to the user when they install the app, you should make sure that this action is idempotent, meaning that it won't have an impact if run multiple times.
|
289
291
|
|
292
|
+
API Versioning
|
293
|
+
--------------
|
294
|
+
|
295
|
+
Shopify's API is versioned, and you can [read about that process in the Shopify Developers documentation page](https://shopify.dev/concepts/about-apis/versioning).
|
296
|
+
|
297
|
+
Since shopify_app gem version 1.11.0, the included shopify_api gem has also been updated to allow you to easily set and switch what version of the Shopify API you want your app or service to use, as well as surface warnings to Rails apps about [deprecated endpoints, GraphQL fields and more](https://shopify.dev/concepts/about-apis/versioning#deprecation-practices).
|
298
|
+
|
299
|
+
See the [shopify_api gem README](https://github.com/Shopify/shopify_api/) for more details.
|
290
300
|
|
291
301
|
WebhooksManager
|
292
302
|
---------------
|
@@ -5,7 +5,7 @@ module ShopifyApp
|
|
5
5
|
# for the app in your Shopify Partners page. Change your settings in
|
6
6
|
# `config/initializers/shopify_app.rb`
|
7
7
|
attr_accessor :application_name
|
8
|
-
|
8
|
+
attr_reader :api_key
|
9
9
|
attr_accessor :secret
|
10
10
|
attr_accessor :old_secret
|
11
11
|
attr_accessor :scope
|
@@ -65,6 +65,12 @@ module ShopifyApp
|
|
65
65
|
scripttags.present?
|
66
66
|
end
|
67
67
|
|
68
|
+
def api_key=(key)
|
69
|
+
raise 'API Key is required and is being returned nil. \
|
70
|
+
This may indicate that your enviroment variables have not been loaded.' if key.nil?
|
71
|
+
@api_key = key
|
72
|
+
end
|
73
|
+
|
68
74
|
def enable_same_site_none
|
69
75
|
!Rails.env.test? && (@enable_same_site_none.nil? ? embedded_app? : @enable_same_site_none)
|
70
76
|
end
|
@@ -11,8 +11,9 @@ module ShopifyApp
|
|
11
11
|
user_agent = env['HTTP_USER_AGENT']
|
12
12
|
|
13
13
|
if headers && headers['Set-Cookie'] &&
|
14
|
-
|
15
|
-
ShopifyApp.configuration.enable_same_site_none
|
14
|
+
BrowserSniffer.new(user_agent).same_site_none_compatible? &&
|
15
|
+
ShopifyApp.configuration.enable_same_site_none &&
|
16
|
+
Rack::Request.new(env).ssl?
|
16
17
|
|
17
18
|
set_cookies = headers['Set-Cookie']
|
18
19
|
.split(COOKIE_SEPARATOR)
|
@@ -28,40 +29,5 @@ module ShopifyApp
|
|
28
29
|
|
29
30
|
[status, headers, body]
|
30
31
|
end
|
31
|
-
|
32
|
-
def self.same_site_none_incompatible?(user_agent)
|
33
|
-
sniffer = BrowserSniffer.new(user_agent)
|
34
|
-
|
35
|
-
webkit_same_site_bug?(sniffer) || drops_unrecognized_same_site_cookies?(sniffer)
|
36
|
-
rescue
|
37
|
-
true
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.webkit_same_site_bug?(sniffer)
|
41
|
-
(sniffer.os == :ios && sniffer.os_version.match(/^([0-9]|1[12])[\.\_]/)) ||
|
42
|
-
(sniffer.os == :mac && sniffer.browser == :safari && sniffer.os_version.match(/^10[\.\_]14/))
|
43
|
-
end
|
44
|
-
|
45
|
-
def self.drops_unrecognized_same_site_cookies?(sniffer)
|
46
|
-
(chromium_based?(sniffer) && sniffer.major_browser_version >= 51 && sniffer.major_browser_version <= 66) ||
|
47
|
-
(uc_browser?(sniffer) && !uc_browser_version_at_least?(sniffer: sniffer, major: 12, minor: 13, build: 2))
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.chromium_based?(sniffer)
|
51
|
-
sniffer.browser_name.downcase.match(/chrom(e|ium)/)
|
52
|
-
end
|
53
|
-
|
54
|
-
def self.uc_browser?(sniffer)
|
55
|
-
sniffer.user_agent.downcase.match(/uc\s?browser/)
|
56
|
-
end
|
57
|
-
|
58
|
-
def self.uc_browser_version_at_least?(sniffer:, major:, minor:, build:)
|
59
|
-
digits = sniffer.browser_version.split('.').map(&:to_i)
|
60
|
-
return false unless digits.count >= 3
|
61
|
-
|
62
|
-
return digits[0] > major if digits[0] != major
|
63
|
-
return digits[1] > minor if digits[1] != minor
|
64
|
-
digits[2] >= build
|
65
|
-
end
|
66
32
|
end
|
67
33
|
end
|
data/lib/shopify_app/version.rb
CHANGED
data/package.json
CHANGED
data/shopify_app.gemspec
CHANGED
@@ -10,9 +10,9 @@ Gem::Specification.new do |s|
|
|
10
10
|
|
11
11
|
s.required_ruby_version = ">= 2.3.1"
|
12
12
|
|
13
|
-
s.add_runtime_dependency('browser_sniffer', '~> 1.
|
13
|
+
s.add_runtime_dependency('browser_sniffer', '~> 1.2.0')
|
14
14
|
s.add_runtime_dependency('rails', '> 5.2.1')
|
15
|
-
s.add_runtime_dependency('shopify_api', '~> 9.0')
|
15
|
+
s.add_runtime_dependency('shopify_api', '~> 9.0.1')
|
16
16
|
s.add_runtime_dependency('omniauth-shopify-oauth2', '~> 2.2.0')
|
17
17
|
|
18
18
|
s.add_development_dependency('rake')
|
@@ -29,4 +29,4 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.files = `git ls-files`.split("\n").reject { |f| f.match(%r{^(test|example)/}) }
|
30
30
|
s.test_files = `git ls-files -- {test}/*`.split("\n")
|
31
31
|
s.require_paths = ["lib"]
|
32
|
-
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopify_app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 12.0.
|
4
|
+
version: 12.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02
|
11
|
+
date: 2020-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: browser_sniffer
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 9.0.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 9.0.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: omniauth-shopify-oauth2
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|