shopify_app 21.0.0 → 21.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +107 -89
- data/README.md +5 -6
- data/app/controllers/concerns/shopify_app/ensure_authenticated_links.rb +1 -1
- data/app/controllers/shopify_app/callback_controller.rb +2 -2
- data/app/controllers/shopify_app/sessions_controller.rb +1 -1
- data/app/controllers/shopify_app/webhooks_controller.rb +1 -1
- data/docs/Quickstart.md +5 -3
- data/lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb +1 -1
- data/lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb +1 -1
- data/lib/generators/shopify_app/add_webhook/add_webhook_generator.rb +2 -2
- data/lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb +1 -1
- data/lib/generators/shopify_app/install/install_generator.rb +2 -2
- data/lib/generators/shopify_app/install/templates/shopify_app.rb.tt +1 -1
- data/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token.rake +1 -1
- data/lib/generators/shopify_app/routes/routes_generator.rb +1 -1
- data/lib/generators/shopify_app/shop_model/shop_model_generator.rb +1 -1
- data/lib/generators/shopify_app/user_model/user_model_generator.rb +1 -1
- data/lib/shopify_app/controller_concerns/app_proxy_verification.rb +2 -2
- data/lib/shopify_app/controller_concerns/ensure_billing.rb +3 -3
- data/lib/shopify_app/controller_concerns/frame_ancestors.rb +1 -1
- data/lib/shopify_app/controller_concerns/login_protection.rb +1 -1
- data/lib/shopify_app/controller_concerns/payload_verification.rb +1 -1
- data/lib/shopify_app/controller_concerns/redirect_for_embedded.rb +1 -1
- data/lib/shopify_app/controller_concerns/sanitized_params.rb +1 -0
- data/lib/shopify_app/managers/scripttags_manager.rb +1 -1
- data/lib/shopify_app/managers/webhooks_manager.rb +2 -2
- data/lib/shopify_app/session/jwt.rb +1 -0
- data/lib/shopify_app/session/shop_session_storage.rb +1 -1
- data/lib/shopify_app/session/shop_session_storage_with_scopes.rb +1 -1
- data/lib/shopify_app/session/user_session_storage.rb +2 -2
- data/lib/shopify_app/session/user_session_storage_with_scopes.rb +2 -2
- data/lib/shopify_app/version.rb +1 -1
- data/shopify_app.gemspec +1 -2
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 56a2bcb7ba62da6e7f8c1357a18cb21ecaaa8010a930b537a1a2da76b76e5daa
|
|
4
|
+
data.tar.gz: a79ae7871ca2fef1cdafb859cc7e6916c07e6e1411d368bcdac2397d349f38c6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c5441d540170afa6a532fb88a2b19350a9ccf394d13487c5fc71c1cdeb4cd885fe6b3895adf0202f6f4be9c7a73e08acd407c5b5213ebd9d0694617c1fc582fe
|
|
7
|
+
data.tar.gz: b4bf6920d7ada93c7fe4b238088910d9c150b81219281c78c24efd45efe4b7829e738d93752bf0c6f95e0f5f660955d363e71063bc5cc62ee2e4e571cd38afde
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
Unreleased
|
|
2
2
|
----------
|
|
3
3
|
|
|
4
|
+
21.1.0 (Oct 17, 2022)
|
|
5
|
+
----------
|
|
6
|
+
|
|
7
|
+
* Removes assumed `https` required to run locally. Support both `http` and `https` in backward compatible way. [#1518](https://github.com/Shopify/shopify_app/pull/1518)
|
|
8
|
+
|
|
4
9
|
21.0.0 (Oct 3, 2022)
|
|
5
10
|
----------
|
|
6
11
|
* Updating shopify_api gem to 12.0.0
|
data/Gemfile.lock
CHANGED
|
@@ -1,87 +1,93 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
shopify_app (21.
|
|
4
|
+
shopify_app (21.1.0)
|
|
5
5
|
activeresource
|
|
6
6
|
browser_sniffer (~> 2.0)
|
|
7
7
|
jwt (>= 2.2.3)
|
|
8
8
|
rails (> 5.2.1)
|
|
9
9
|
redirect_safely (~> 1.0)
|
|
10
|
-
shopify_api (~> 12.
|
|
10
|
+
shopify_api (~> 12.1)
|
|
11
11
|
sprockets-rails (>= 2.0.0)
|
|
12
12
|
|
|
13
13
|
GEM
|
|
14
14
|
remote: https://rubygems.org/
|
|
15
15
|
specs:
|
|
16
|
-
actioncable (
|
|
17
|
-
actionpack (=
|
|
18
|
-
activesupport (=
|
|
16
|
+
actioncable (7.0.4)
|
|
17
|
+
actionpack (= 7.0.4)
|
|
18
|
+
activesupport (= 7.0.4)
|
|
19
19
|
nio4r (~> 2.0)
|
|
20
20
|
websocket-driver (>= 0.6.1)
|
|
21
|
-
actionmailbox (
|
|
22
|
-
actionpack (=
|
|
23
|
-
activejob (=
|
|
24
|
-
activerecord (=
|
|
25
|
-
activestorage (=
|
|
26
|
-
activesupport (=
|
|
21
|
+
actionmailbox (7.0.4)
|
|
22
|
+
actionpack (= 7.0.4)
|
|
23
|
+
activejob (= 7.0.4)
|
|
24
|
+
activerecord (= 7.0.4)
|
|
25
|
+
activestorage (= 7.0.4)
|
|
26
|
+
activesupport (= 7.0.4)
|
|
27
27
|
mail (>= 2.7.1)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
net-imap
|
|
29
|
+
net-pop
|
|
30
|
+
net-smtp
|
|
31
|
+
actionmailer (7.0.4)
|
|
32
|
+
actionpack (= 7.0.4)
|
|
33
|
+
actionview (= 7.0.4)
|
|
34
|
+
activejob (= 7.0.4)
|
|
35
|
+
activesupport (= 7.0.4)
|
|
33
36
|
mail (~> 2.5, >= 2.5.4)
|
|
37
|
+
net-imap
|
|
38
|
+
net-pop
|
|
39
|
+
net-smtp
|
|
34
40
|
rails-dom-testing (~> 2.0)
|
|
35
|
-
actionpack (
|
|
36
|
-
actionview (=
|
|
37
|
-
activesupport (=
|
|
38
|
-
rack (~> 2.0, >= 2.0
|
|
41
|
+
actionpack (7.0.4)
|
|
42
|
+
actionview (= 7.0.4)
|
|
43
|
+
activesupport (= 7.0.4)
|
|
44
|
+
rack (~> 2.0, >= 2.2.0)
|
|
39
45
|
rack-test (>= 0.6.3)
|
|
40
46
|
rails-dom-testing (~> 2.0)
|
|
41
47
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
|
42
|
-
actiontext (
|
|
43
|
-
actionpack (=
|
|
44
|
-
activerecord (=
|
|
45
|
-
activestorage (=
|
|
46
|
-
activesupport (=
|
|
48
|
+
actiontext (7.0.4)
|
|
49
|
+
actionpack (= 7.0.4)
|
|
50
|
+
activerecord (= 7.0.4)
|
|
51
|
+
activestorage (= 7.0.4)
|
|
52
|
+
activesupport (= 7.0.4)
|
|
53
|
+
globalid (>= 0.6.0)
|
|
47
54
|
nokogiri (>= 1.8.5)
|
|
48
|
-
actionview (
|
|
49
|
-
activesupport (=
|
|
55
|
+
actionview (7.0.4)
|
|
56
|
+
activesupport (= 7.0.4)
|
|
50
57
|
builder (~> 3.1)
|
|
51
58
|
erubi (~> 1.4)
|
|
52
59
|
rails-dom-testing (~> 2.0)
|
|
53
60
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
|
54
|
-
activejob (
|
|
55
|
-
activesupport (=
|
|
61
|
+
activejob (7.0.4)
|
|
62
|
+
activesupport (= 7.0.4)
|
|
56
63
|
globalid (>= 0.3.6)
|
|
57
|
-
activemodel (
|
|
58
|
-
activesupport (=
|
|
64
|
+
activemodel (7.0.4)
|
|
65
|
+
activesupport (= 7.0.4)
|
|
59
66
|
activemodel-serializers-xml (1.0.2)
|
|
60
67
|
activemodel (> 5.x)
|
|
61
68
|
activesupport (> 5.x)
|
|
62
69
|
builder (~> 3.1)
|
|
63
|
-
activerecord (
|
|
64
|
-
activemodel (=
|
|
65
|
-
activesupport (=
|
|
70
|
+
activerecord (7.0.4)
|
|
71
|
+
activemodel (= 7.0.4)
|
|
72
|
+
activesupport (= 7.0.4)
|
|
66
73
|
activeresource (6.0.0)
|
|
67
74
|
activemodel (>= 6.0)
|
|
68
75
|
activemodel-serializers-xml (~> 1.0)
|
|
69
76
|
activesupport (>= 6.0)
|
|
70
|
-
activestorage (
|
|
71
|
-
actionpack (=
|
|
72
|
-
activejob (=
|
|
73
|
-
activerecord (=
|
|
74
|
-
activesupport (=
|
|
77
|
+
activestorage (7.0.4)
|
|
78
|
+
actionpack (= 7.0.4)
|
|
79
|
+
activejob (= 7.0.4)
|
|
80
|
+
activerecord (= 7.0.4)
|
|
81
|
+
activesupport (= 7.0.4)
|
|
75
82
|
marcel (~> 1.0)
|
|
76
83
|
mini_mime (>= 1.1.0)
|
|
77
|
-
activesupport (
|
|
84
|
+
activesupport (7.0.4)
|
|
78
85
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
79
86
|
i18n (>= 1.6, < 2)
|
|
80
87
|
minitest (>= 5.1)
|
|
81
88
|
tzinfo (~> 2.0)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
public_suffix (>= 2.0.2, < 5.0)
|
|
89
|
+
addressable (2.8.1)
|
|
90
|
+
public_suffix (>= 2.0.2, < 6.0)
|
|
85
91
|
ast (2.4.2)
|
|
86
92
|
binding_of_caller (1.0.0)
|
|
87
93
|
debug_inspector (>= 0.0.1)
|
|
@@ -94,7 +100,7 @@ GEM
|
|
|
94
100
|
rexml
|
|
95
101
|
crass (1.0.6)
|
|
96
102
|
debug_inspector (1.1.0)
|
|
97
|
-
erubi (1.
|
|
103
|
+
erubi (1.11.0)
|
|
98
104
|
globalid (1.0.0)
|
|
99
105
|
activesupport (>= 5.0)
|
|
100
106
|
hash_diff (1.1.1)
|
|
@@ -102,10 +108,11 @@ GEM
|
|
|
102
108
|
httparty (0.20.0)
|
|
103
109
|
mime-types (~> 3.0)
|
|
104
110
|
multi_xml (>= 0.5.2)
|
|
105
|
-
i18n (1.
|
|
111
|
+
i18n (1.12.0)
|
|
106
112
|
concurrent-ruby (~> 1.0)
|
|
113
|
+
json (2.6.2)
|
|
107
114
|
jwt (2.5.0)
|
|
108
|
-
loofah (2.
|
|
115
|
+
loofah (2.19.0)
|
|
109
116
|
crass (~> 1.0.2)
|
|
110
117
|
nokogiri (>= 1.5.9)
|
|
111
118
|
mail (2.7.1)
|
|
@@ -117,17 +124,25 @@ GEM
|
|
|
117
124
|
mime-types-data (3.2022.0105)
|
|
118
125
|
mini_mime (1.1.2)
|
|
119
126
|
mini_portile2 (2.8.0)
|
|
120
|
-
minitest (5.
|
|
121
|
-
mocha (1.
|
|
127
|
+
minitest (5.16.3)
|
|
128
|
+
mocha (1.15.0)
|
|
122
129
|
multi_xml (0.6.0)
|
|
130
|
+
net-imap (0.3.1)
|
|
131
|
+
net-protocol
|
|
132
|
+
net-pop (0.1.2)
|
|
133
|
+
net-protocol
|
|
134
|
+
net-protocol (0.1.3)
|
|
135
|
+
timeout
|
|
136
|
+
net-smtp (0.3.2)
|
|
137
|
+
net-protocol
|
|
123
138
|
nio4r (2.5.8)
|
|
124
|
-
nokogiri (1.13.
|
|
139
|
+
nokogiri (1.13.8)
|
|
125
140
|
mini_portile2 (~> 2.8.0)
|
|
126
141
|
racc (~> 1.4)
|
|
127
142
|
oj (3.13.21)
|
|
128
143
|
openssl (3.0.1)
|
|
129
|
-
parallel (1.
|
|
130
|
-
parser (3.1.
|
|
144
|
+
parallel (1.22.1)
|
|
145
|
+
parser (3.1.2.1)
|
|
131
146
|
ast (~> 2.4.1)
|
|
132
147
|
pry (0.14.1)
|
|
133
148
|
coderay (~> 1.1)
|
|
@@ -137,26 +152,25 @@ GEM
|
|
|
137
152
|
pry-stack_explorer (0.6.1)
|
|
138
153
|
binding_of_caller (~> 1.0)
|
|
139
154
|
pry (~> 0.13)
|
|
140
|
-
public_suffix (
|
|
155
|
+
public_suffix (5.0.0)
|
|
141
156
|
racc (1.6.0)
|
|
142
|
-
rack (2.2.
|
|
143
|
-
rack-test (
|
|
144
|
-
rack (>= 1.
|
|
145
|
-
rails (
|
|
146
|
-
actioncable (=
|
|
147
|
-
actionmailbox (=
|
|
148
|
-
actionmailer (=
|
|
149
|
-
actionpack (=
|
|
150
|
-
actiontext (=
|
|
151
|
-
actionview (=
|
|
152
|
-
activejob (=
|
|
153
|
-
activemodel (=
|
|
154
|
-
activerecord (=
|
|
155
|
-
activestorage (=
|
|
156
|
-
activesupport (=
|
|
157
|
+
rack (2.2.4)
|
|
158
|
+
rack-test (2.0.2)
|
|
159
|
+
rack (>= 1.3)
|
|
160
|
+
rails (7.0.4)
|
|
161
|
+
actioncable (= 7.0.4)
|
|
162
|
+
actionmailbox (= 7.0.4)
|
|
163
|
+
actionmailer (= 7.0.4)
|
|
164
|
+
actionpack (= 7.0.4)
|
|
165
|
+
actiontext (= 7.0.4)
|
|
166
|
+
actionview (= 7.0.4)
|
|
167
|
+
activejob (= 7.0.4)
|
|
168
|
+
activemodel (= 7.0.4)
|
|
169
|
+
activerecord (= 7.0.4)
|
|
170
|
+
activestorage (= 7.0.4)
|
|
171
|
+
activesupport (= 7.0.4)
|
|
157
172
|
bundler (>= 1.15.0)
|
|
158
|
-
railties (=
|
|
159
|
-
sprockets-rails (>= 2.0.0)
|
|
173
|
+
railties (= 7.0.4)
|
|
160
174
|
rails-controller-testing (1.0.5)
|
|
161
175
|
actionpack (>= 5.0.1.rc1)
|
|
162
176
|
actionview (>= 5.0.1.rc1)
|
|
@@ -164,37 +178,39 @@ GEM
|
|
|
164
178
|
rails-dom-testing (2.0.3)
|
|
165
179
|
activesupport (>= 4.2.0)
|
|
166
180
|
nokogiri (>= 1.6)
|
|
167
|
-
rails-html-sanitizer (1.4.
|
|
181
|
+
rails-html-sanitizer (1.4.3)
|
|
168
182
|
loofah (~> 2.3)
|
|
169
|
-
railties (
|
|
170
|
-
actionpack (=
|
|
171
|
-
activesupport (=
|
|
183
|
+
railties (7.0.4)
|
|
184
|
+
actionpack (= 7.0.4)
|
|
185
|
+
activesupport (= 7.0.4)
|
|
172
186
|
method_source
|
|
173
187
|
rake (>= 12.2)
|
|
174
188
|
thor (~> 1.0)
|
|
189
|
+
zeitwerk (~> 2.5)
|
|
175
190
|
rainbow (3.1.1)
|
|
176
191
|
rake (13.0.6)
|
|
177
192
|
rb-readline (0.5.5)
|
|
178
193
|
redirect_safely (1.0.0)
|
|
179
194
|
activemodel
|
|
180
|
-
regexp_parser (2.
|
|
195
|
+
regexp_parser (2.6.0)
|
|
181
196
|
rexml (3.2.5)
|
|
182
|
-
rubocop (1.
|
|
197
|
+
rubocop (1.36.0)
|
|
198
|
+
json (~> 2.3)
|
|
183
199
|
parallel (~> 1.10)
|
|
184
|
-
parser (>= 3.1.
|
|
200
|
+
parser (>= 3.1.2.1)
|
|
185
201
|
rainbow (>= 2.2.2, < 4.0)
|
|
186
202
|
regexp_parser (>= 1.8, < 3.0)
|
|
187
|
-
rexml
|
|
188
|
-
rubocop-ast (>= 1.
|
|
203
|
+
rexml (>= 3.2.5, < 4.0)
|
|
204
|
+
rubocop-ast (>= 1.20.1, < 2.0)
|
|
189
205
|
ruby-progressbar (~> 1.7)
|
|
190
206
|
unicode-display_width (>= 1.4.0, < 3.0)
|
|
191
|
-
rubocop-ast (1.
|
|
192
|
-
parser (>= 3.
|
|
193
|
-
rubocop-shopify (2.
|
|
194
|
-
rubocop (~> 1.
|
|
207
|
+
rubocop-ast (1.21.0)
|
|
208
|
+
parser (>= 3.1.1.0)
|
|
209
|
+
rubocop-shopify (2.10.1)
|
|
210
|
+
rubocop (~> 1.35)
|
|
195
211
|
ruby-progressbar (1.11.0)
|
|
196
212
|
securerandom (0.2.0)
|
|
197
|
-
shopify_api (12.
|
|
213
|
+
shopify_api (12.1.0)
|
|
198
214
|
concurrent-ruby
|
|
199
215
|
hash_diff
|
|
200
216
|
httparty
|
|
@@ -204,7 +220,7 @@ GEM
|
|
|
204
220
|
securerandom
|
|
205
221
|
sorbet-runtime
|
|
206
222
|
zeitwerk (~> 2.5)
|
|
207
|
-
sorbet-runtime (0.5.
|
|
223
|
+
sorbet-runtime (0.5.10488)
|
|
208
224
|
sprockets (4.1.1)
|
|
209
225
|
concurrent-ruby (~> 1.0)
|
|
210
226
|
rack (> 1, < 3)
|
|
@@ -212,12 +228,14 @@ GEM
|
|
|
212
228
|
actionpack (>= 5.2)
|
|
213
229
|
activesupport (>= 5.2)
|
|
214
230
|
sprockets (>= 3.0.0)
|
|
215
|
-
sqlite3 (1.
|
|
231
|
+
sqlite3 (1.5.3)
|
|
232
|
+
mini_portile2 (~> 2.8.0)
|
|
216
233
|
thor (1.2.1)
|
|
217
|
-
|
|
234
|
+
timeout (0.3.0)
|
|
235
|
+
tzinfo (2.0.5)
|
|
218
236
|
concurrent-ruby (~> 1.0)
|
|
219
|
-
unicode-display_width (2.
|
|
220
|
-
webmock (3.
|
|
237
|
+
unicode-display_width (2.3.0)
|
|
238
|
+
webmock (3.18.1)
|
|
221
239
|
addressable (>= 2.8.0)
|
|
222
240
|
crack (>= 0.3.2)
|
|
223
241
|
hashdiff (>= 0.4.0, < 2.0.0)
|
|
@@ -245,4 +263,4 @@ DEPENDENCIES
|
|
|
245
263
|
webmock
|
|
246
264
|
|
|
247
265
|
BUNDLED WITH
|
|
248
|
-
2.3.
|
|
266
|
+
2.3.7
|
data/README.md
CHANGED
|
@@ -46,9 +46,10 @@ rails new my_shopify_app
|
|
|
46
46
|
bundle add shopify_app
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
3. Create a `.env` file in the root of `my_shopify_app` to specify your Shopify API credentials:
|
|
49
|
+
3. Create a `.env` file in the root of `my_shopify_app` to specify your full host and Shopify API credentials:
|
|
50
50
|
|
|
51
51
|
```sh
|
|
52
|
+
HOST=http://localhost:3000
|
|
52
53
|
SHOPIFY_API_KEY=<Your Shopify API key>
|
|
53
54
|
SHOPIFY_API_SECRET=<Your Shopify API secret>
|
|
54
55
|
```
|
|
@@ -67,17 +68,15 @@ rails generate shopify_app
|
|
|
67
68
|
rails db:migrate
|
|
68
69
|
```
|
|
69
70
|
|
|
70
|
-
6.
|
|
71
|
-
|
|
72
|
-
7. Run the app:
|
|
71
|
+
6. Run the app:
|
|
73
72
|
|
|
74
73
|
```sh
|
|
75
74
|
rails server
|
|
76
75
|
```
|
|
77
76
|
|
|
78
|
-
|
|
77
|
+
7. Install the app by visiting the server's URL (e.g. http://127.0.0.1:3000) and specifying the subdomain of the shop where you want it to be installed to.
|
|
79
78
|
|
|
80
|
-
|
|
79
|
+
8. After the app is installed, you're redirected to the embedded app.
|
|
81
80
|
|
|
82
81
|
This app implements [OAuth 2.0](https://shopify.dev/tutorials/authenticate-with-oauth) with Shopify to authenticate requests made to Shopify APIs. By default, this app is configured to use [session tokens](https://shopify.dev/concepts/apps/building-embedded-apps-using-session-tokens) to authenticate merchants when embedded in the Shopify Admin.
|
|
83
82
|
|
|
@@ -15,7 +15,7 @@ module ShopifyApp
|
|
|
15
15
|
ShopifyAPI::Auth::Oauth::SessionCookie::SESSION_COOKIE_NAME =>
|
|
16
16
|
cookies.encrypted[ShopifyAPI::Auth::Oauth::SessionCookie::SESSION_COOKIE_NAME],
|
|
17
17
|
},
|
|
18
|
-
auth_query: ShopifyAPI::Auth::Oauth::AuthQuery.new(**filtered_params)
|
|
18
|
+
auth_query: ShopifyAPI::Auth::Oauth::AuthQuery.new(**filtered_params),
|
|
19
19
|
)
|
|
20
20
|
rescue
|
|
21
21
|
return respond_with_error
|
|
@@ -95,7 +95,7 @@ module ShopifyApp
|
|
|
95
95
|
ScripttagsManager.queue(
|
|
96
96
|
session.shop,
|
|
97
97
|
session.access_token,
|
|
98
|
-
ShopifyApp.configuration.scripttags
|
|
98
|
+
ShopifyApp.configuration.scripttags,
|
|
99
99
|
)
|
|
100
100
|
end
|
|
101
101
|
|
|
@@ -56,7 +56,7 @@ module ShopifyApp
|
|
|
56
56
|
auth_attributes = ShopifyAPI::Auth::Oauth.begin_auth(
|
|
57
57
|
shop: sanitized_shop_name,
|
|
58
58
|
redirect_path: "/#{callback_url}",
|
|
59
|
-
is_online: user_session_expected
|
|
59
|
+
is_online: user_session_expected?,
|
|
60
60
|
)
|
|
61
61
|
cookies.encrypted[auth_attributes[:cookie].name] = {
|
|
62
62
|
expires: auth_attributes[:cookie].expires,
|
|
@@ -8,7 +8,7 @@ module ShopifyApp
|
|
|
8
8
|
params.permit!
|
|
9
9
|
|
|
10
10
|
ShopifyAPI::Webhooks::Registry.process(
|
|
11
|
-
ShopifyAPI::Webhooks::Request.new(raw_body: request.raw_post, headers: request.headers.to_h)
|
|
11
|
+
ShopifyAPI::Webhooks::Request.new(raw_body: request.raw_post, headers: request.headers.to_h),
|
|
12
12
|
)
|
|
13
13
|
head(:ok)
|
|
14
14
|
end
|
data/docs/Quickstart.md
CHANGED
|
@@ -4,13 +4,15 @@ This guide assumes you have completed the steps to create a new Rails app using
|
|
|
4
4
|
|
|
5
5
|
#### Table of contents
|
|
6
6
|
|
|
7
|
-
[Setup SSH tunnel for development](#setup-ssh-tunnel-for-development)
|
|
7
|
+
[Optionally Setup SSH tunnel for development](#setup-ssh-tunnel-for-development)
|
|
8
8
|
|
|
9
9
|
[Use Shopify App Bridge to embed your app in the Shopify Admin](#use-shopify-app-bridge-to-embed-your-app-in-the-shopify-admin)
|
|
10
10
|
|
|
11
|
-
## Setup SSH tunnel for development
|
|
11
|
+
## Optionally Setup SSH tunnel for development
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Local development supports both `http` and `https` schemes. By default `http` and localhost are used.
|
|
14
|
+
|
|
15
|
+
To use `https`, your local app needs to be accessible from the public Internet in order to install it on a Shopify store to use the [App Proxy Controller](/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_controller.rb) or receive [webhooks](/docs/shopify_app/webhooks.md).
|
|
14
16
|
|
|
15
17
|
In order to receive requests securely, you'll need to setup a tunnel from the internet to localhost. You can use [Cloudflare](https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/run-tunnel/trycloudflare/) for this.
|
|
16
18
|
|
|
@@ -20,7 +20,7 @@ module ShopifyApp
|
|
|
20
20
|
inject_into_file(
|
|
21
21
|
"config/initializers/shopify_app.rb",
|
|
22
22
|
" config.webhooks = [\n ]\n",
|
|
23
|
-
after: /ShopifyApp\.configure.*\n
|
|
23
|
+
after: /ShopifyApp\.configure.*\n/,
|
|
24
24
|
)
|
|
25
25
|
end
|
|
26
26
|
|
|
@@ -28,7 +28,7 @@ module ShopifyApp
|
|
|
28
28
|
inject_into_file(
|
|
29
29
|
"config/initializers/shopify_app.rb",
|
|
30
30
|
webhook_config,
|
|
31
|
-
after: "config.webhooks = ["
|
|
31
|
+
after: "config.webhooks = [",
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
initializer = load_initializer
|
|
@@ -66,7 +66,7 @@ module ShopifyApp
|
|
|
66
66
|
inject_into_file(
|
|
67
67
|
"config/environments/development.rb",
|
|
68
68
|
comment,
|
|
69
|
-
after: insert_after_line
|
|
69
|
+
after: insert_after_line,
|
|
70
70
|
)
|
|
71
71
|
comment
|
|
72
72
|
end
|
|
@@ -78,7 +78,7 @@ module ShopifyApp
|
|
|
78
78
|
inject_into_file(
|
|
79
79
|
"config/environments/development.rb",
|
|
80
80
|
host_line,
|
|
81
|
-
after: explaination_comment
|
|
81
|
+
after: explaination_comment,
|
|
82
82
|
)
|
|
83
83
|
host_line
|
|
84
84
|
end
|
|
@@ -38,7 +38,7 @@ Rails.application.config.after_initialize do
|
|
|
38
38
|
api_key: ShopifyApp.configuration.api_key,
|
|
39
39
|
api_secret_key: ShopifyApp.configuration.secret,
|
|
40
40
|
api_version: ShopifyApp.configuration.api_version,
|
|
41
|
-
|
|
41
|
+
host: ENV['HOST'],
|
|
42
42
|
scope: ShopifyApp.configuration.scope,
|
|
43
43
|
is_private: !ENV.fetch('SHOPIFY_APP_PRIVATE_SHOP', '').empty?,
|
|
44
44
|
is_embedded: ShopifyApp.configuration.embedded_app,
|
|
@@ -35,7 +35,7 @@ module ShopifyApp
|
|
|
35
35
|
if new_shopify_cli_app? || Rails.env.test? || yes?(scopes_column_prompt)
|
|
36
36
|
migration_template(
|
|
37
37
|
"db/migrate/add_shop_access_scopes_column.erb",
|
|
38
|
-
"db/migrate/add_shop_access_scopes_column.rb"
|
|
38
|
+
"db/migrate/add_shop_access_scopes_column.rb",
|
|
39
39
|
)
|
|
40
40
|
end
|
|
41
41
|
end
|
|
@@ -35,7 +35,7 @@ module ShopifyApp
|
|
|
35
35
|
if new_shopify_cli_app? || Rails.env.test? || yes?(scopes_column_prompt)
|
|
36
36
|
migration_template(
|
|
37
37
|
"db/migrate/add_user_access_scopes_column.erb",
|
|
38
|
-
"db/migrate/add_user_access_scopes_column.rb"
|
|
38
|
+
"db/migrate/add_user_access_scopes_column.rb",
|
|
39
39
|
)
|
|
40
40
|
end
|
|
41
41
|
end
|
|
@@ -22,7 +22,7 @@ module ShopifyApp
|
|
|
22
22
|
|
|
23
23
|
ActiveSupport::SecurityUtils.secure_compare(
|
|
24
24
|
calculated_signature(query_hash),
|
|
25
|
-
signature
|
|
25
|
+
signature,
|
|
26
26
|
)
|
|
27
27
|
end
|
|
28
28
|
|
|
@@ -32,7 +32,7 @@ module ShopifyApp
|
|
|
32
32
|
OpenSSL::HMAC.hexdigest(
|
|
33
33
|
OpenSSL::Digest.new("sha256"),
|
|
34
34
|
ShopifyApp.configuration.secret,
|
|
35
|
-
sorted_params
|
|
35
|
+
sorted_params,
|
|
36
36
|
)
|
|
37
37
|
end
|
|
38
38
|
end
|
|
@@ -98,7 +98,7 @@ module ShopifyApp
|
|
|
98
98
|
def request_payment(session)
|
|
99
99
|
shop = session.shop
|
|
100
100
|
host = Base64.encode64("#{shop}/admin")
|
|
101
|
-
return_url = "
|
|
101
|
+
return_url = "#{ShopifyAPI::Context.host}?shop=#{shop}&host=#{host}"
|
|
102
102
|
|
|
103
103
|
if recurring?
|
|
104
104
|
data = request_recurring_payment(session: session, return_url: return_url)
|
|
@@ -132,7 +132,7 @@ module ShopifyApp
|
|
|
132
132
|
},
|
|
133
133
|
returnUrl: return_url,
|
|
134
134
|
test: !Rails.env.production?,
|
|
135
|
-
}
|
|
135
|
+
},
|
|
136
136
|
)
|
|
137
137
|
|
|
138
138
|
response.body
|
|
@@ -150,7 +150,7 @@ module ShopifyApp
|
|
|
150
150
|
},
|
|
151
151
|
returnUrl: return_url,
|
|
152
152
|
test: !Rails.env.production?,
|
|
153
|
-
}
|
|
153
|
+
},
|
|
154
154
|
)
|
|
155
155
|
|
|
156
156
|
response.body
|
|
@@ -8,7 +8,7 @@ module ShopifyApp
|
|
|
8
8
|
content_security_policy do |policy|
|
|
9
9
|
policy.frame_ancestors(-> do
|
|
10
10
|
domain_host = current_shopify_domain || "*.#{::ShopifyApp.configuration.myshopify_domain}"
|
|
11
|
-
"
|
|
11
|
+
"#{ShopifyAPI::Context.host_scheme}://#{domain_host} https://admin.shopify.com"
|
|
12
12
|
end)
|
|
13
13
|
end
|
|
14
14
|
end
|
|
@@ -42,7 +42,7 @@ module ShopifyApp
|
|
|
42
42
|
ShopifyAPI::Utils::SessionUtils.load_current_session(
|
|
43
43
|
auth_header: request.headers["HTTP_AUTHORIZATION"],
|
|
44
44
|
cookies: { cookie_name => cookies.encrypted[cookie_name] },
|
|
45
|
-
is_online: user_session_expected
|
|
45
|
+
is_online: user_session_expected?,
|
|
46
46
|
)
|
|
47
47
|
rescue ShopifyAPI::Errors::CookieNotFoundError
|
|
48
48
|
nil
|
|
@@ -17,7 +17,7 @@ module ShopifyApp
|
|
|
17
17
|
digest = OpenSSL::Digest.new("sha256")
|
|
18
18
|
ActiveSupport::SecurityUtils.secure_compare(
|
|
19
19
|
shopify_hmac,
|
|
20
|
-
Base64.strict_encode64(OpenSSL::HMAC.digest(digest, secret, data))
|
|
20
|
+
Base64.strict_encode64(OpenSSL::HMAC.digest(digest, secret, data)),
|
|
21
21
|
)
|
|
22
22
|
end
|
|
23
23
|
end
|
|
@@ -21,7 +21,7 @@ module ShopifyApp
|
|
|
21
21
|
|
|
22
22
|
def redirect_uri_for_embedded
|
|
23
23
|
redirect_query_params = {}
|
|
24
|
-
redirect_uri = "
|
|
24
|
+
redirect_uri = "#{ShopifyAPI::Context.host}#{ShopifyApp.configuration.login_url}"
|
|
25
25
|
redirect_query_params[:shop] = sanitized_shop_name
|
|
26
26
|
redirect_query_params[:shop] ||= referer_sanitized_shop_name if referer_sanitized_shop_name.present?
|
|
27
27
|
redirect_query_params[:host] ||= params[:host] if params[:host].present?
|
|
@@ -8,7 +8,7 @@ module ShopifyApp
|
|
|
8
8
|
def queue(shop_domain, shop_token)
|
|
9
9
|
ShopifyApp::WebhooksManagerJob.perform_later(
|
|
10
10
|
shop_domain: shop_domain,
|
|
11
|
-
shop_token: shop_token
|
|
11
|
+
shop_token: shop_token,
|
|
12
12
|
)
|
|
13
13
|
end
|
|
14
14
|
|
|
@@ -45,7 +45,7 @@ module ShopifyApp
|
|
|
45
45
|
delivery_method: attributes[:delivery_method] || :http,
|
|
46
46
|
path: webhook_path,
|
|
47
47
|
handler: webhook_job_klass(webhook_path),
|
|
48
|
-
fields: attributes[:fields]
|
|
48
|
+
fields: attributes[:fields],
|
|
49
49
|
)
|
|
50
50
|
end
|
|
51
51
|
end
|
|
@@ -55,6 +55,7 @@ module ShopifyApp
|
|
|
55
55
|
raise ::ShopifyApp::InvalidAudienceError,
|
|
56
56
|
"'aud' claim does not match api_key" unless payload["aud"] == api_key
|
|
57
57
|
raise ::ShopifyApp::InvalidDestinationError, "'dest' claim host not a valid shopify host" unless dest_host
|
|
58
|
+
|
|
58
59
|
raise ::ShopifyApp::MismatchedHostsError,
|
|
59
60
|
"'dest' claim host does not match 'iss' claim host" unless dest_host == iss_host
|
|
60
61
|
|
|
@@ -41,13 +41,13 @@ module ShopifyApp
|
|
|
41
41
|
email_verified: false,
|
|
42
42
|
account_owner: false,
|
|
43
43
|
locale: "",
|
|
44
|
-
collaborator: false
|
|
44
|
+
collaborator: false,
|
|
45
45
|
)
|
|
46
46
|
|
|
47
47
|
ShopifyAPI::Auth::Session.new(
|
|
48
48
|
shop: user.shopify_domain,
|
|
49
49
|
access_token: user.shopify_token,
|
|
50
|
-
associated_user: associated_user
|
|
50
|
+
associated_user: associated_user,
|
|
51
51
|
)
|
|
52
52
|
end
|
|
53
53
|
end
|
|
@@ -43,7 +43,7 @@ module ShopifyApp
|
|
|
43
43
|
email_verified: false,
|
|
44
44
|
account_owner: false,
|
|
45
45
|
locale: "",
|
|
46
|
-
collaborator: false
|
|
46
|
+
collaborator: false,
|
|
47
47
|
)
|
|
48
48
|
|
|
49
49
|
ShopifyAPI::Auth::Session.new(
|
|
@@ -51,7 +51,7 @@ module ShopifyApp
|
|
|
51
51
|
access_token: user.shopify_token,
|
|
52
52
|
scope: user.access_scopes,
|
|
53
53
|
associated_user_scope: user.access_scopes,
|
|
54
|
-
associated_user: associated_user
|
|
54
|
+
associated_user: associated_user,
|
|
55
55
|
)
|
|
56
56
|
end
|
|
57
57
|
end
|
data/lib/shopify_app/version.rb
CHANGED
data/shopify_app.gemspec
CHANGED
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
|
19
19
|
s.add_runtime_dependency("jwt", ">= 2.2.3")
|
|
20
20
|
s.add_runtime_dependency("rails", "> 5.2.1")
|
|
21
21
|
s.add_runtime_dependency("redirect_safely", "~> 1.0")
|
|
22
|
-
s.add_runtime_dependency("shopify_api", "~> 12.
|
|
22
|
+
s.add_runtime_dependency("shopify_api", "~> 12.1")
|
|
23
23
|
s.add_runtime_dependency("sprockets-rails", ">= 2.0.0")
|
|
24
24
|
|
|
25
25
|
s.add_development_dependency("byebug")
|
|
@@ -34,6 +34,5 @@ Gem::Specification.new do |s|
|
|
|
34
34
|
s.add_development_dependency("webmock")
|
|
35
35
|
|
|
36
36
|
s.files = %x(git ls-files).split("\n").reject { |f| f.match(%r{^(test|example)/}) }
|
|
37
|
-
s.test_files = %x(git ls-files -- {test}/*).split("\n")
|
|
38
37
|
s.require_paths = ["lib"]
|
|
39
38
|
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: 21.
|
|
4
|
+
version: 21.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shopify
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-10-
|
|
11
|
+
date: 2022-10-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activeresource
|
|
@@ -86,14 +86,14 @@ dependencies:
|
|
|
86
86
|
requirements:
|
|
87
87
|
- - "~>"
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: 12.
|
|
89
|
+
version: '12.1'
|
|
90
90
|
type: :runtime
|
|
91
91
|
prerelease: false
|
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
|
94
94
|
- - "~>"
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: 12.
|
|
96
|
+
version: '12.1'
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
98
|
name: sprockets-rails
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|