shopify_app 20.2.0 → 21.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -0
  3. data/CHANGELOG.md +9 -0
  4. data/Gemfile.lock +108 -90
  5. data/README.md +5 -6
  6. data/app/controllers/concerns/shopify_app/ensure_authenticated_links.rb +1 -1
  7. data/app/controllers/shopify_app/callback_controller.rb +2 -2
  8. data/app/controllers/shopify_app/sessions_controller.rb +1 -1
  9. data/app/controllers/shopify_app/webhooks_controller.rb +1 -1
  10. data/docs/Quickstart.md +5 -3
  11. data/lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb +1 -1
  12. data/lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb +1 -1
  13. data/lib/generators/shopify_app/add_webhook/add_webhook_generator.rb +2 -2
  14. data/lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb +1 -1
  15. data/lib/generators/shopify_app/install/install_generator.rb +2 -2
  16. data/lib/generators/shopify_app/install/templates/shopify_app.rb.tt +1 -1
  17. data/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token.rake +1 -1
  18. data/lib/generators/shopify_app/routes/routes_generator.rb +1 -1
  19. data/lib/generators/shopify_app/shop_model/shop_model_generator.rb +1 -1
  20. data/lib/generators/shopify_app/user_model/user_model_generator.rb +1 -1
  21. data/lib/shopify_app/controller_concerns/app_proxy_verification.rb +2 -2
  22. data/lib/shopify_app/controller_concerns/ensure_billing.rb +3 -3
  23. data/lib/shopify_app/controller_concerns/frame_ancestors.rb +1 -1
  24. data/lib/shopify_app/controller_concerns/login_protection.rb +1 -1
  25. data/lib/shopify_app/controller_concerns/payload_verification.rb +1 -1
  26. data/lib/shopify_app/controller_concerns/redirect_for_embedded.rb +1 -1
  27. data/lib/shopify_app/controller_concerns/sanitized_params.rb +1 -0
  28. data/lib/shopify_app/managers/scripttags_manager.rb +1 -1
  29. data/lib/shopify_app/managers/webhooks_manager.rb +2 -2
  30. data/lib/shopify_app/session/jwt.rb +1 -0
  31. data/lib/shopify_app/session/shop_session_storage.rb +1 -1
  32. data/lib/shopify_app/session/shop_session_storage_with_scopes.rb +1 -1
  33. data/lib/shopify_app/session/user_session_storage.rb +2 -2
  34. data/lib/shopify_app/session/user_session_storage_with_scopes.rb +2 -2
  35. data/lib/shopify_app/version.rb +1 -1
  36. data/package.json +1 -1
  37. data/shopify_app.gemspec +1 -2
  38. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb6f3007d376f75a09be6f17e5dd378e4adc0a7ccc5feeac7ee18ecaf5469ee5
4
- data.tar.gz: 62c9f9d55bf842fb2c20c4123555d0c1e3f234e11855825e8afeec2e38db971d
3
+ metadata.gz: 56a2bcb7ba62da6e7f8c1357a18cb21ecaaa8010a930b537a1a2da76b76e5daa
4
+ data.tar.gz: a79ae7871ca2fef1cdafb859cc7e6916c07e6e1411d368bcdac2397d349f38c6
5
5
  SHA512:
6
- metadata.gz: d845e94acae7308bb796e46c1134faa06fdfa564fdfb8ecb65ec942a85d7e4b464de4e4d875b52add54d60ba6d3d4f4678f009957b8ac277067e683d3ebb70b2
7
- data.tar.gz: 16fbc75dc6a020f758e2020b2735ed6357878065e110c63072ac1c9114ba4bdc0dad8378d74064e34f69d4287046069e68004f9a64a14ac9c6c587102933c01a
6
+ metadata.gz: c5441d540170afa6a532fb88a2b19350a9ccf394d13487c5fc71c1cdeb4cd885fe6b3895adf0202f6f4be9c7a73e08acd407c5b5213ebd9d0694617c1fc582fe
7
+ data.tar.gz: b4bf6920d7ada93c7fe4b238088910d9c150b81219281c78c24efd45efe4b7829e738d93752bf0c6f95e0f5f660955d363e71063bc5cc62ee2e4e571cd38afde
data/.rubocop.yml CHANGED
@@ -16,3 +16,5 @@ Style/ClassAndModuleChildren:
16
16
  Exclude:
17
17
  - 'test/**/*'
18
18
 
19
+ Style/ClassMethodsDefinitions:
20
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,6 +1,15 @@
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
+
9
+ 21.0.0 (Oct 3, 2022)
10
+ ----------
11
+ * Updating shopify_api gem to 12.0.0
12
+
4
13
  20.2.0 (September 30, 2022)
5
14
  ----------
6
15
  * Fixes a method signature error bug when raising `BillingError`. [#1513](https://github.com/Shopify/shopify_app/pull/1513)
data/Gemfile.lock CHANGED
@@ -1,87 +1,93 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify_app (20.2.0)
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 (~> 11.1)
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 (6.1.5)
17
- actionpack (= 6.1.5)
18
- activesupport (= 6.1.5)
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 (6.1.5)
22
- actionpack (= 6.1.5)
23
- activejob (= 6.1.5)
24
- activerecord (= 6.1.5)
25
- activestorage (= 6.1.5)
26
- activesupport (= 6.1.5)
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
- actionmailer (6.1.5)
29
- actionpack (= 6.1.5)
30
- actionview (= 6.1.5)
31
- activejob (= 6.1.5)
32
- activesupport (= 6.1.5)
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 (6.1.5)
36
- actionview (= 6.1.5)
37
- activesupport (= 6.1.5)
38
- rack (~> 2.0, >= 2.0.9)
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 (6.1.5)
43
- actionpack (= 6.1.5)
44
- activerecord (= 6.1.5)
45
- activestorage (= 6.1.5)
46
- activesupport (= 6.1.5)
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 (6.1.5)
49
- activesupport (= 6.1.5)
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 (6.1.5)
55
- activesupport (= 6.1.5)
61
+ activejob (7.0.4)
62
+ activesupport (= 7.0.4)
56
63
  globalid (>= 0.3.6)
57
- activemodel (6.1.5)
58
- activesupport (= 6.1.5)
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 (6.1.5)
64
- activemodel (= 6.1.5)
65
- activesupport (= 6.1.5)
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 (6.1.5)
71
- actionpack (= 6.1.5)
72
- activejob (= 6.1.5)
73
- activerecord (= 6.1.5)
74
- activesupport (= 6.1.5)
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 (6.1.5)
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
- zeitwerk (~> 2.3)
83
- addressable (2.8.0)
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.10.0)
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.10.0)
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.15.0)
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.15.0)
121
- mocha (1.13.0)
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.4)
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.21.0)
130
- parser (3.1.0.0)
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 (4.0.6)
155
+ public_suffix (5.0.0)
141
156
  racc (1.6.0)
142
- rack (2.2.3)
143
- rack-test (1.1.0)
144
- rack (>= 1.0, < 3)
145
- rails (6.1.5)
146
- actioncable (= 6.1.5)
147
- actionmailbox (= 6.1.5)
148
- actionmailer (= 6.1.5)
149
- actionpack (= 6.1.5)
150
- actiontext (= 6.1.5)
151
- actionview (= 6.1.5)
152
- activejob (= 6.1.5)
153
- activemodel (= 6.1.5)
154
- activerecord (= 6.1.5)
155
- activestorage (= 6.1.5)
156
- activesupport (= 6.1.5)
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 (= 6.1.5)
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.2)
181
+ rails-html-sanitizer (1.4.3)
168
182
  loofah (~> 2.3)
169
- railties (6.1.5)
170
- actionpack (= 6.1.5)
171
- activesupport (= 6.1.5)
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.2.0)
195
+ regexp_parser (2.6.0)
181
196
  rexml (3.2.5)
182
- rubocop (1.25.1)
197
+ rubocop (1.36.0)
198
+ json (~> 2.3)
183
199
  parallel (~> 1.10)
184
- parser (>= 3.1.0.0)
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.15.1, < 2.0)
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.15.1)
192
- parser (>= 3.0.1.1)
193
- rubocop-shopify (2.4.0)
194
- rubocop (~> 1.24)
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 (11.1.0)
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.10470)
223
+ sorbet-runtime (0.5.10488)
208
224
  sprockets (4.1.1)
209
225
  concurrent-ruby (~> 1.0)
210
226
  rack (> 1, < 3)
@@ -212,19 +228,21 @@ GEM
212
228
  actionpack (>= 5.2)
213
229
  activesupport (>= 5.2)
214
230
  sprockets (>= 3.0.0)
215
- sqlite3 (1.4.2)
231
+ sqlite3 (1.5.3)
232
+ mini_portile2 (~> 2.8.0)
216
233
  thor (1.2.1)
217
- tzinfo (2.0.4)
234
+ timeout (0.3.0)
235
+ tzinfo (2.0.5)
218
236
  concurrent-ruby (~> 1.0)
219
- unicode-display_width (2.1.0)
220
- webmock (3.14.0)
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)
224
242
  websocket-driver (0.7.5)
225
243
  websocket-extensions (>= 0.1.0)
226
244
  websocket-extensions (0.1.5)
227
- zeitwerk (2.6.0)
245
+ zeitwerk (2.6.1)
228
246
 
229
247
  PLATFORMS
230
248
  ruby
@@ -245,4 +263,4 @@ DEPENDENCIES
245
263
  webmock
246
264
 
247
265
  BUNDLED WITH
248
- 2.3.5
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. Setup a SSH tunnel to allow the OAuth redirect to work. See how in the [Setup SSH tunnel for development](/docs/Quickstart.md#setup-ssh-tunnel-for-development) section in [Quickstart](/docs/Quickstart.md)
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
- 8. 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.
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
- 9. After the app is installed, you're redirected to the embedded app.
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
 
@@ -14,7 +14,7 @@ module ShopifyApp
14
14
  splash_page_with_params(
15
15
  return_to: request.fullpath,
16
16
  shop: current_shopify_domain,
17
- host: params[:host]
17
+ host: params[:host],
18
18
  )
19
19
  end
20
20
 
@@ -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
- 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).
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
 
@@ -21,7 +21,7 @@ module ShopifyApp
21
21
  inject_into_file(
22
22
  "config/initializers/shopify_app.rb",
23
23
  after_authenticate_job_config,
24
- before: "end"
24
+ before: "end",
25
25
  )
26
26
 
27
27
  unless initializer.include?(after_authenticate_job_config)
@@ -18,7 +18,7 @@ module ShopifyApp
18
18
  inject_into_file(
19
19
  "config/routes.rb",
20
20
  optimize_indentation(routes, 2),
21
- after: "root :to => 'home#index'\n"
21
+ after: "root :to => 'home#index'\n",
22
22
  )
23
23
  end
24
24
 
@@ -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
@@ -19,7 +19,7 @@ module ShopifyApp
19
19
  inject_into_file(
20
20
  "config/routes.rb",
21
21
  File.read(File.expand_path(find_in_source_paths("app_proxy_route.rb"))),
22
- after: "mount ShopifyApp::Engine, at: '/'\n"
22
+ after: "mount ShopifyApp::Engine, at: '/'\n",
23
23
  )
24
24
  end
25
25
  end
@@ -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
- host_name: URI(ENV.fetch('HOST', '')).host || '',
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,
@@ -6,7 +6,7 @@ namespace :shopify do
6
6
  all_active_shops.find_each do |shop|
7
7
  Shopify::RotateShopifyTokenJob.perform_later(
8
8
  shop_domain: shop.shopify_domain,
9
- refresh_token: args[:refresh_token]
9
+ refresh_token: args[:refresh_token],
10
10
  )
11
11
  end
12
12
  end
@@ -15,7 +15,7 @@ module ShopifyApp
15
15
  gsub_file(
16
16
  "config/routes.rb",
17
17
  "mount ShopifyApp::Engine, at: '/'",
18
- ""
18
+ "",
19
19
  )
20
20
  end
21
21
 
@@ -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 = "https://#{ShopifyAPI::Context.host_name}?shop=#{shop}&host=#{host}"
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
- "https://#{domain_host} https://admin.shopify.com"
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 = "https://#{ShopifyAPI::Context.host_name}#{ShopifyApp.configuration.login_url}"
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?
@@ -21,6 +21,7 @@ module ShopifyApp
21
21
 
22
22
  def sanitize_shop_param(params)
23
23
  return unless params[:shop].present?
24
+
24
25
  ShopifyApp::Utils.sanitize_shop_domain(params[:shop])
25
26
  end
26
27
 
@@ -7,7 +7,7 @@ module ShopifyApp
7
7
  shop_domain: shop_domain,
8
8
  shop_token: shop_token,
9
9
  # Procs cannot be serialized so we interpolate now, if necessary
10
- scripttags: build_src(scripttags, shop_domain)
10
+ scripttags: build_src(scripttags, shop_domain),
11
11
  )
12
12
  end
13
13
 
@@ -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
 
@@ -34,7 +34,7 @@ module ShopifyApp
34
34
 
35
35
  ShopifyAPI::Auth::Session.new(
36
36
  shop: shop.shopify_domain,
37
- access_token: shop.shopify_token
37
+ access_token: shop.shopify_token,
38
38
  )
39
39
  end
40
40
  end
@@ -37,7 +37,7 @@ module ShopifyApp
37
37
  ShopifyAPI::Auth::Session.new(
38
38
  shop: shop.shopify_domain,
39
39
  access_token: shop.shopify_token,
40
- scope: shop.access_scopes
40
+ scope: shop.access_scopes,
41
41
  )
42
42
  end
43
43
  end
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ShopifyApp
4
- VERSION = "20.2.0"
4
+ VERSION = "21.1.0"
5
5
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shopify_app",
3
- "version": "20.2.0",
3
+ "version": "21.0.0",
4
4
  "repository": "git@github.com:Shopify/shopify_app.git",
5
5
  "author": "Shopify",
6
6
  "license": "MIT",
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", "~> 11.1")
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: 20.2.0
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-03 00:00:00.000000000 Z
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: '11.1'
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: '11.1'
96
+ version: '12.1'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: sprockets-rails
99
99
  requirement: !ruby/object:Gem::Requirement