shopify_app 17.2.1 → 18.0.3
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/CHANGELOG.md +18 -1
- data/Gemfile.lock +58 -31
- data/README.md +2 -1
- data/app/assets/javascripts/shopify_app/post_redirect.js +9 -0
- data/app/controllers/concerns/shopify_app/ensure_authenticated_links.rb +15 -2
- data/app/controllers/shopify_app/sessions_controller.rb +5 -1
- data/app/views/shopify_app/shared/post_redirect_to_auth_shopify.html.erb +13 -0
- data/docs/Troubleshooting.md +19 -1
- data/docs/shopify_app/engine.md +2 -2
- data/docs/shopify_app/handling-access-scopes-changes.md +11 -1
- data/docs/shopify_app/script-tags.md +1 -1
- data/docs/shopify_app/webhooks.md +2 -2
- data/lib/generators/shopify_app/home_controller/templates/home_controller.rb +8 -0
- data/lib/generators/shopify_app/home_controller/templates/index.html.erb +1 -1
- data/lib/generators/shopify_app/home_controller/templates/unauthenticated_home_controller.rb +1 -0
- data/lib/generators/shopify_app/install/install_generator.rb +1 -1
- data/lib/generators/shopify_app/install/templates/embedded_app.html.erb +2 -1
- data/lib/generators/shopify_app/install/templates/shopify_app.js +1 -1
- data/lib/shopify_app/controller_concerns/login_protection.rb +10 -3
- data/lib/shopify_app/engine.rb +1 -0
- data/lib/shopify_app/version.rb +1 -1
- data/lib/shopify_app.rb +1 -0
- data/package.json +1 -1
- data/service.yml +1 -4
- data/shopify_app.gemspec +4 -3
- data/translation.yml +1 -1
- data/yarn.lock +6 -6
- metadata +27 -13
- data/config/locales/hi.yml +0 -23
- data/config/locales/ms.yml +0 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a17cc09be2742af3a0e91af4ac4c2e3d4ab246ae10c31dc2c26b1138058f1846
|
|
4
|
+
data.tar.gz: afd2922bb83d113c1c4d16c240db9455d1d63478cd2e231fd4e27d3aebb01958
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a19c5616ec96c8c454077dd114f4aedd215725e1af274eadc05d2989812bc5bd3b4674b9a850af3b28f7171b9f60c7db7a89398a97cf3ad8ad3023482a8ddd1d
|
|
7
|
+
data.tar.gz: f6eb5a88f94cab3f1555d017f0fada8809661716739186382a5038d880596ba451e2791f616f03400d95ab44c739720feae6b3f677a8188e56f000172b365c8d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
18.0.3 (Jan 7, 2022)
|
|
2
2
|
----------
|
|
3
|
+
* Change regexp to match standard ngrok URLs. [#1311](https://github.com/Shopify/shopify_app/pull/1311)
|
|
4
|
+
* Make `EnsureAuthenticatedLinks` compatible with AppBridge 2.0. [#1277](https://github.com/Shopify/shopify_app/pull/1277)
|
|
5
|
+
* Includes the `host` parameter when redirecting to the splash page in an unauthenticated state.
|
|
6
|
+
|
|
7
|
+
18.0.2 (Jun 15, 2021)
|
|
8
|
+
----------
|
|
9
|
+
* Added careers link to readme. [#1274](https://github.com/Shopify/shopify_app/pull/1274)
|
|
10
|
+
|
|
11
|
+
18.0.1 (May 7, 2021)
|
|
12
|
+
----------
|
|
13
|
+
* Fix bug causing OAuth flow to fail due to CSP violation. [#1265](https://github.com/Shopify/shopify_app/pull/1265)
|
|
14
|
+
|
|
15
|
+
18.0.0 (May 3, 2021)
|
|
16
|
+
----------
|
|
17
|
+
* Support OmniAuth 2.x
|
|
18
|
+
* If your app has custom OmniAuth configuration, please refer to the [OmniAuth 2.0 upgrade guide](https://github.com/omniauth/omniauth/wiki/Upgrading-to-2.0).
|
|
19
|
+
* Support App Bridge version 2.x in the Embedded App layout. [#1241](https://github.com/Shopify/shopify_app/pull/1241)
|
|
3
20
|
|
|
4
21
|
17.2.1 (April 1, 2021)
|
|
5
22
|
----------
|
data/Gemfile.lock
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
shopify_app (
|
|
5
|
-
browser_sniffer (~> 1.
|
|
6
|
-
jwt (
|
|
7
|
-
omniauth-
|
|
4
|
+
shopify_app (18.0.3)
|
|
5
|
+
browser_sniffer (~> 1.4.0)
|
|
6
|
+
jwt (>= 2.2.3)
|
|
7
|
+
omniauth-rails_csrf_protection
|
|
8
|
+
omniauth-shopify-oauth2 (~> 2.3)
|
|
8
9
|
rails (> 5.2.1, < 6.2)
|
|
9
10
|
redirect_safely (~> 1.0)
|
|
10
11
|
shopify_api (~> 9.4)
|
|
@@ -79,12 +80,12 @@ GEM
|
|
|
79
80
|
minitest (>= 5.1)
|
|
80
81
|
tzinfo (~> 2.0)
|
|
81
82
|
zeitwerk (~> 2.3)
|
|
82
|
-
addressable (2.
|
|
83
|
+
addressable (2.8.0)
|
|
83
84
|
public_suffix (>= 2.0.2, < 5.0)
|
|
84
85
|
ast (2.4.1)
|
|
85
86
|
binding_of_caller (0.8.0)
|
|
86
87
|
debug_inspector (>= 0.0.1)
|
|
87
|
-
browser_sniffer (1.
|
|
88
|
+
browser_sniffer (1.4.0)
|
|
88
89
|
builder (3.2.4)
|
|
89
90
|
byebug (11.1.3)
|
|
90
91
|
coderay (1.1.3)
|
|
@@ -93,28 +94,46 @@ GEM
|
|
|
93
94
|
crass (1.0.6)
|
|
94
95
|
debug_inspector (0.0.3)
|
|
95
96
|
erubi (1.10.0)
|
|
96
|
-
faraday (1.3
|
|
97
|
+
faraday (1.9.3)
|
|
98
|
+
faraday-em_http (~> 1.0)
|
|
99
|
+
faraday-em_synchrony (~> 1.0)
|
|
100
|
+
faraday-excon (~> 1.1)
|
|
101
|
+
faraday-httpclient (~> 1.0)
|
|
102
|
+
faraday-multipart (~> 1.0)
|
|
97
103
|
faraday-net_http (~> 1.0)
|
|
104
|
+
faraday-net_http_persistent (~> 1.0)
|
|
105
|
+
faraday-patron (~> 1.0)
|
|
106
|
+
faraday-rack (~> 1.0)
|
|
107
|
+
faraday-retry (~> 1.0)
|
|
108
|
+
ruby2_keywords (>= 0.0.4)
|
|
109
|
+
faraday-em_http (1.0.0)
|
|
110
|
+
faraday-em_synchrony (1.0.0)
|
|
111
|
+
faraday-excon (1.1.0)
|
|
112
|
+
faraday-httpclient (1.0.1)
|
|
113
|
+
faraday-multipart (1.0.2)
|
|
98
114
|
multipart-post (>= 1.2, < 3)
|
|
99
|
-
ruby2_keywords
|
|
100
115
|
faraday-net_http (1.0.1)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
116
|
+
faraday-net_http_persistent (1.2.0)
|
|
117
|
+
faraday-patron (1.0.0)
|
|
118
|
+
faraday-rack (1.0.0)
|
|
119
|
+
faraday-retry (1.0.3)
|
|
120
|
+
globalid (1.0.0)
|
|
121
|
+
activesupport (>= 5.0)
|
|
122
|
+
graphql (1.13.4)
|
|
123
|
+
graphql-client (0.17.0)
|
|
105
124
|
activesupport (>= 3.0)
|
|
106
|
-
graphql (~> 1.
|
|
125
|
+
graphql (~> 1.10)
|
|
107
126
|
hashdiff (1.0.1)
|
|
108
|
-
hashie (
|
|
127
|
+
hashie (5.0.0)
|
|
109
128
|
i18n (1.8.9)
|
|
110
129
|
concurrent-ruby (~> 1.0)
|
|
111
|
-
jwt (2.
|
|
130
|
+
jwt (2.3.0)
|
|
112
131
|
loofah (2.9.0)
|
|
113
132
|
crass (~> 1.0.2)
|
|
114
133
|
nokogiri (>= 1.5.9)
|
|
115
134
|
mail (2.7.1)
|
|
116
135
|
mini_mime (>= 0.1.1)
|
|
117
|
-
marcel (1.0.
|
|
136
|
+
marcel (1.0.2)
|
|
118
137
|
method_source (0.9.2)
|
|
119
138
|
mini_mime (1.0.3)
|
|
120
139
|
mini_portile2 (2.5.0)
|
|
@@ -123,7 +142,7 @@ GEM
|
|
|
123
142
|
multi_json (1.15.0)
|
|
124
143
|
multi_xml (0.6.0)
|
|
125
144
|
multipart-post (2.1.1)
|
|
126
|
-
nio4r (2.5.
|
|
145
|
+
nio4r (2.5.8)
|
|
127
146
|
nokogiri (1.11.2)
|
|
128
147
|
mini_portile2 (~> 2.5.0)
|
|
129
148
|
racc (~> 1.4)
|
|
@@ -133,15 +152,19 @@ GEM
|
|
|
133
152
|
multi_json (~> 1.3)
|
|
134
153
|
multi_xml (~> 0.5)
|
|
135
154
|
rack (>= 1.2, < 3)
|
|
136
|
-
omniauth (
|
|
155
|
+
omniauth (2.0.4)
|
|
137
156
|
hashie (>= 3.4.6)
|
|
138
157
|
rack (>= 1.6.2, < 3)
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
158
|
+
rack-protection
|
|
159
|
+
omniauth-oauth2 (1.7.2)
|
|
160
|
+
oauth2 (~> 1.4)
|
|
161
|
+
omniauth (>= 1.9, < 3)
|
|
162
|
+
omniauth-rails_csrf_protection (1.0.0)
|
|
163
|
+
actionpack (>= 4.2)
|
|
164
|
+
omniauth (~> 2.0)
|
|
165
|
+
omniauth-shopify-oauth2 (2.3.2)
|
|
143
166
|
activesupport
|
|
144
|
-
omniauth-oauth2 (~> 1.5
|
|
167
|
+
omniauth-oauth2 (~> 1.5)
|
|
145
168
|
parallel (1.20.1)
|
|
146
169
|
parser (2.7.2.0)
|
|
147
170
|
ast (~> 2.4.1)
|
|
@@ -156,6 +179,8 @@ GEM
|
|
|
156
179
|
public_suffix (4.0.6)
|
|
157
180
|
racc (1.5.2)
|
|
158
181
|
rack (2.2.3)
|
|
182
|
+
rack-protection (2.1.0)
|
|
183
|
+
rack
|
|
159
184
|
rack-test (1.1.0)
|
|
160
185
|
rack (>= 1.0, < 3)
|
|
161
186
|
rails (6.1.3.1)
|
|
@@ -209,20 +234,21 @@ GEM
|
|
|
209
234
|
rubocop-shopify (1.0.7)
|
|
210
235
|
rubocop (~> 1.4)
|
|
211
236
|
ruby-progressbar (1.10.1)
|
|
212
|
-
ruby2_keywords (0.0.
|
|
213
|
-
shopify_api (9.
|
|
237
|
+
ruby2_keywords (0.0.5)
|
|
238
|
+
shopify_api (9.5)
|
|
214
239
|
activeresource (>= 4.1.0, < 6.0.0)
|
|
215
240
|
graphql-client
|
|
216
241
|
rack
|
|
242
|
+
webrick
|
|
217
243
|
sprockets (4.0.2)
|
|
218
244
|
concurrent-ruby (~> 1.0)
|
|
219
245
|
rack (> 1, < 3)
|
|
220
|
-
sprockets-rails (3.
|
|
221
|
-
actionpack (>=
|
|
222
|
-
activesupport (>=
|
|
246
|
+
sprockets-rails (3.4.2)
|
|
247
|
+
actionpack (>= 5.2)
|
|
248
|
+
activesupport (>= 5.2)
|
|
223
249
|
sprockets (>= 3.0.0)
|
|
224
250
|
sqlite3 (1.4.2)
|
|
225
|
-
thor (1.1
|
|
251
|
+
thor (1.2.1)
|
|
226
252
|
tzinfo (2.0.4)
|
|
227
253
|
concurrent-ruby (~> 1.0)
|
|
228
254
|
unicode-display_width (1.7.0)
|
|
@@ -230,7 +256,8 @@ GEM
|
|
|
230
256
|
addressable (>= 2.3.6)
|
|
231
257
|
crack (>= 0.3.2)
|
|
232
258
|
hashdiff (>= 0.4.0, < 2.0.0)
|
|
233
|
-
|
|
259
|
+
webrick (1.7.0)
|
|
260
|
+
websocket-driver (0.7.5)
|
|
234
261
|
websocket-extensions (>= 0.1.0)
|
|
235
262
|
websocket-extensions (0.1.5)
|
|
236
263
|
zeitwerk (2.4.2)
|
|
@@ -254,4 +281,4 @@ DEPENDENCIES
|
|
|
254
281
|
webmock
|
|
255
282
|
|
|
256
283
|
BUNDLED WITH
|
|
257
|
-
2.
|
|
284
|
+
2.2.22
|
data/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Shopify App
|
|
2
2
|
|
|
3
|
+
**Shopify is doubling our engineering staff in 2021! [Join our team and work on libraries like this one.](https://smrtr.io/5GGrK)**
|
|
4
|
+
|
|
3
5
|
[![Version][gem]][gem_url] [](https://github.com/Shopify/shopify_app/actions?query=workflow%3ACI) ![Supported Rails version][supported_rails_version]
|
|
4
6
|
|
|
5
7
|
[gem]: https://img.shields.io/gem/v/shopify_app.svg
|
|
@@ -23,7 +25,6 @@ This gem includes a Rails engine, generators, modules, and mixins that help crea
|
|
|
23
25
|
## Requirements
|
|
24
26
|
|
|
25
27
|
> **Rails compatibility**
|
|
26
|
-
> * Rails 6.1 or above is not yet supported due to the new `cookies_same_site_protection` setting.
|
|
27
28
|
> * Use Shopify App `<= v7.2.8` if you need to work with Rails 4.
|
|
28
29
|
|
|
29
30
|
To become a Shopify app developer, you will need a [Shopify Partners](https://www.shopify.com/partners) account. Explore the [Shopify dev docs](https://shopify.dev/concepts/shopify-introduction) to learn more about [building Shopify apps](https://shopify.dev/concepts/apps).
|
|
@@ -10,9 +10,22 @@ module ShopifyApp
|
|
|
10
10
|
|
|
11
11
|
private
|
|
12
12
|
|
|
13
|
+
def splash_page
|
|
14
|
+
splash_page_with_params(
|
|
15
|
+
return_to: request.fullpath,
|
|
16
|
+
shop: current_shopify_domain,
|
|
17
|
+
host: params[:host]
|
|
18
|
+
)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def splash_page_with_params(params)
|
|
22
|
+
uri = URI(root_path)
|
|
23
|
+
uri.query = params.compact.to_query
|
|
24
|
+
uri.to_s
|
|
25
|
+
end
|
|
26
|
+
|
|
13
27
|
def redirect_to_splash_page
|
|
14
|
-
|
|
15
|
-
redirect_to(splash_page_path)
|
|
28
|
+
redirect_to(splash_page)
|
|
16
29
|
rescue ShopifyApp::LoginProtection::ShopifyDomainNotFound => error
|
|
17
30
|
Rails.logger.warn("[ShopifyApp::EnsureAuthenticatedLinks] Redirecting to login: [#{error.class}] "\
|
|
18
31
|
"Could not determine current shop domain")
|
|
@@ -150,7 +150,11 @@ module ShopifyApp
|
|
|
150
150
|
end
|
|
151
151
|
|
|
152
152
|
def authenticate_in_context
|
|
153
|
-
|
|
153
|
+
post_redirect_to_auth_shopify
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def post_redirect_to_auth_shopify
|
|
157
|
+
render('shopify_app/shared/post_redirect_to_auth_shopify', layout: false)
|
|
154
158
|
end
|
|
155
159
|
|
|
156
160
|
def authenticate_at_top_level
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<base target="_top">
|
|
7
|
+
<title>Redirecting…</title>
|
|
8
|
+
<%= javascript_include_tag('shopify_app/post_redirect', crossorigin: 'anonymous', integrity: true) %>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<%= form_tag '/auth/shopify', id: 'redirect-form' %>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
data/docs/Troubleshooting.md
CHANGED
|
@@ -11,11 +11,14 @@
|
|
|
11
11
|
[App installation](#app-installation)
|
|
12
12
|
* [My app won't install](#my-app-wont-install)
|
|
13
13
|
* [My app keeps redirecting to login](#my-app-keeps-redirecting-to-login)
|
|
14
|
+
* [My app returns 401 during oauth](#my-app-returns-401-during-oauth)
|
|
14
15
|
|
|
15
16
|
[JWT session tokens](#jwt-session-tokens)
|
|
16
17
|
* [My app is still using cookies to authenticate](#my-app-is-still-using-cookies-to-authenticate)
|
|
17
18
|
* [My app can't make requests to the Shopify API](#my-app-cant-make-requests-to-the-shopify-api)
|
|
18
19
|
|
|
20
|
+
[Migrating to App Bridge 2.0](#migrating-to-app-bridge-2.0)
|
|
21
|
+
|
|
19
22
|
## Generators
|
|
20
23
|
|
|
21
24
|
### The shopify_app:install generator hangs
|
|
@@ -65,6 +68,10 @@ Alternatively, you can upgrade to [`v17.2.0` of the shopify_app gem](/docs/Upgra
|
|
|
65
68
|
|
|
66
69
|
This issue can occur when the session (the model you set as `ShopifyApp::SessionRepository.storage`) isn't deleted when the user uninstalls your app. A possible fix for this is listening to the `app/uninstalled` webhook and deleting the corresponding session in the webhook handler.
|
|
67
70
|
|
|
71
|
+
### My app returns 401 during oauth
|
|
72
|
+
|
|
73
|
+
If your local dev env uses the `cookie_store` session storage strategy, you may encounter 401 errors during oauth due to a race condition between asset requests and `/auth/shopify`. You should be able to work around for local testing by using a different browser or session storage strategy. [Read more about the status of this issue](https://github.com/Shopify/shopify_app/issues/1269).
|
|
74
|
+
|
|
68
75
|
## JWT session tokens
|
|
69
76
|
|
|
70
77
|
### My app is still using cookies to authenticate
|
|
@@ -138,4 +145,15 @@ _Example:_ If your embedded app cannot handle server-side XHR redirects, then co
|
|
|
138
145
|
X-Shopify-API-Request-Failure-Unauthorized: true
|
|
139
146
|
```
|
|
140
147
|
|
|
141
|
-
Then, use the [Shopify App Bridge Redirect](https://shopify.dev/tools/app-bridge/actions/navigation/redirect) action to redirect your app frontend to the app login URL if this header is set.
|
|
148
|
+
Then, use the [Shopify App Bridge Redirect](https://shopify.dev/tools/app-bridge/actions/navigation/redirect) action to redirect your app frontend to the app login URL if this header is set.
|
|
149
|
+
|
|
150
|
+
## Migrating to App Bridge 2.0
|
|
151
|
+
|
|
152
|
+
In order to upgrade your embedded app to the latest App Bridge 2.0 version, please refer to the [migration guide](https://shopify.dev/tutorials/migrate-your-app-to-app-bridge-2).
|
|
153
|
+
|
|
154
|
+
To ensure that your app's embedded layout doesn't import App Bridge 2.0 before fully migrating, make the following change to bind it to v1.x.
|
|
155
|
+
|
|
156
|
+
```diff
|
|
157
|
+
- <script src="https://unpkg.com/@shopify/app-bridge"></script>
|
|
158
|
+
+ <script src="https://unpkg.com/@shopify/app-bridge@1"></script>
|
|
159
|
+
```
|
data/docs/shopify_app/engine.md
CHANGED
|
@@ -15,7 +15,7 @@ While you can customize the login view by creating a `/app/views/shopify_app/ses
|
|
|
15
15
|
|
|
16
16
|
```ruby
|
|
17
17
|
ShopifyApp.configure do |config|
|
|
18
|
-
config.login_url = 'https://
|
|
18
|
+
config.login_url = 'https://example.com/nested/login'
|
|
19
19
|
end
|
|
20
20
|
```
|
|
21
21
|
|
|
@@ -77,6 +77,6 @@ class ReviewsController < ApplicationController
|
|
|
77
77
|
end
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
Create your app proxy URL in the [Shopify Partners dashboard](https://partners.shopify.com/organizations), making sure to point it to `https://
|
|
80
|
+
Create your app proxy URL in the [Shopify Partners dashboard](https://partners.shopify.com/organizations), making sure to point it to `https://example.com/app_proxy`.
|
|
81
81
|
|
|
82
82
|

|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Handling changes in access scopes
|
|
2
|
-
|
|
2
|
+
## Updating the list of scopes the app requests
|
|
3
|
+
|
|
4
|
+
Your app specifies the [access scopes](https://shopify.dev/api/usage/access-scopes) it requires in the Shopify App initializer, located at`config/initializers/shopify_app.rb`. To modify this list, update the comma-delimited configuration option:
|
|
5
|
+
|
|
6
|
+
```ruby
|
|
7
|
+
config.scope = "read_products,write_discounts"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Requesting new scopes from merchants
|
|
11
|
+
|
|
12
|
+
The Shopify App gem will automatically request new scopes from merchants for both shop/offline and user/online tokens. To enable your app to reauth via OAuth on scope changes, you can set the following configuration flag in your `config/initializers/shopify_app.rb`:
|
|
3
13
|
```ruby
|
|
4
14
|
config.reauth_on_access_scope_changes = true
|
|
5
15
|
```
|
|
@@ -11,7 +11,7 @@ As with webhooks, ShopifyApp can manage your app's [ScriptTags](https://shopify-
|
|
|
11
11
|
```ruby
|
|
12
12
|
ShopifyApp.configure do |config|
|
|
13
13
|
config.scripttags = [
|
|
14
|
-
{event:'onload', src: 'https://
|
|
14
|
+
{event:'onload', src: 'https://example.com/fancy.js'},
|
|
15
15
|
{event:'onload', src: ->(domain) { dynamic_tag_url(domain) } }
|
|
16
16
|
]
|
|
17
17
|
end
|
|
@@ -12,7 +12,7 @@ ShopifyApp can manage your app's webhooks for you if you set which webhooks you
|
|
|
12
12
|
```ruby
|
|
13
13
|
ShopifyApp.configure do |config|
|
|
14
14
|
config.webhooks = [
|
|
15
|
-
{topic: 'carts/update', address: 'https://example
|
|
15
|
+
{topic: 'carts/update', address: 'https://example.com/webhooks/carts_update'}
|
|
16
16
|
]
|
|
17
17
|
end
|
|
18
18
|
```
|
|
@@ -34,7 +34,7 @@ If you are only interested in particular fields, you can optionally filter the d
|
|
|
34
34
|
```ruby
|
|
35
35
|
ShopifyApp.configure do |config|
|
|
36
36
|
config.webhooks = [
|
|
37
|
-
{topic: 'products/update', address: 'https://example
|
|
37
|
+
{topic: 'products/update', address: 'https://example.com/webhooks/products_update', fields: ['title', 'vendor']}
|
|
38
38
|
]
|
|
39
39
|
end
|
|
40
40
|
```
|
|
@@ -3,8 +3,16 @@
|
|
|
3
3
|
class HomeController < AuthenticatedController
|
|
4
4
|
include ShopifyApp::ShopAccessScopesVerification
|
|
5
5
|
|
|
6
|
+
before_action :set_host
|
|
7
|
+
|
|
6
8
|
def index
|
|
7
9
|
@products = ShopifyAPI::Product.find(:all, params: { limit: 10 })
|
|
8
10
|
@webhooks = ShopifyAPI::Webhook.find(:all)
|
|
9
11
|
end
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
def set_host
|
|
16
|
+
@host = params[:host]
|
|
17
|
+
end
|
|
10
18
|
end
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
// Save a session token for future requests
|
|
20
20
|
window.sessionToken = await new Promise((resolve) => {
|
|
21
|
-
app.subscribe(SessionToken.
|
|
21
|
+
app.subscribe(SessionToken.Action.RESPOND, (data) => {
|
|
22
22
|
resolve(data.sessionToken || "");
|
|
23
23
|
});
|
|
24
24
|
});
|
|
@@ -67,7 +67,7 @@ module ShopifyApp
|
|
|
67
67
|
def insert_hosts_into_development_config
|
|
68
68
|
inject_into_file(
|
|
69
69
|
'config/environments/development.rb',
|
|
70
|
-
" config.hosts = (config.hosts rescue []) <<
|
|
70
|
+
" config.hosts = (config.hosts rescue []) << /\[-\w]+\\.ngrok\\.io/\n",
|
|
71
71
|
after: "Rails.application.configure do\n"
|
|
72
72
|
)
|
|
73
73
|
end
|
|
@@ -24,11 +24,12 @@
|
|
|
24
24
|
|
|
25
25
|
<%= render 'layouts/flash_messages' %>
|
|
26
26
|
|
|
27
|
-
<script src="https://unpkg.com/@shopify/app-bridge@
|
|
27
|
+
<script src="https://unpkg.com/@shopify/app-bridge@2"></script>
|
|
28
28
|
|
|
29
29
|
<%= content_tag(:div, nil, id: 'shopify-app-init', data: {
|
|
30
30
|
api_key: ShopifyApp.configuration.api_key,
|
|
31
31
|
shop_origin: @shop_origin || (@current_shopify_session.domain if @current_shopify_session),
|
|
32
|
+
host: @host,
|
|
32
33
|
debug: Rails.env.development?
|
|
33
34
|
} ) %>
|
|
34
35
|
|
|
@@ -9,6 +9,8 @@ module ShopifyApp
|
|
|
9
9
|
|
|
10
10
|
class ShopifyDomainNotFound < StandardError; end
|
|
11
11
|
|
|
12
|
+
class ShopifyHostNotFound < StandardError; end
|
|
13
|
+
|
|
12
14
|
included do
|
|
13
15
|
after_action :set_test_cookie
|
|
14
16
|
rescue_from ActiveResource::UnauthorizedAccess, with: :close_session
|
|
@@ -103,6 +105,12 @@ module ShopifyApp
|
|
|
103
105
|
request.env['jwt.shopify_user_id']
|
|
104
106
|
end
|
|
105
107
|
|
|
108
|
+
def host
|
|
109
|
+
return params[:host] if params[:host].present?
|
|
110
|
+
|
|
111
|
+
raise ShopifyHostNotFound
|
|
112
|
+
end
|
|
113
|
+
|
|
106
114
|
def redirect_to_login
|
|
107
115
|
if request.xhr?
|
|
108
116
|
head(:unauthorized)
|
|
@@ -215,9 +223,8 @@ module ShopifyApp
|
|
|
215
223
|
end
|
|
216
224
|
|
|
217
225
|
def return_address
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
rescue ShopifyDomainNotFound
|
|
226
|
+
return_address_with_params(shop: current_shopify_domain, host: host)
|
|
227
|
+
rescue ShopifyDomainNotFound, ShopifyHostNotFound
|
|
221
228
|
base_return_address
|
|
222
229
|
end
|
|
223
230
|
|
data/lib/shopify_app/engine.rb
CHANGED
|
@@ -17,6 +17,7 @@ module ShopifyApp
|
|
|
17
17
|
initializer "shopify_app.assets.precompile" do |app|
|
|
18
18
|
app.config.assets.precompile += %w[
|
|
19
19
|
shopify_app/redirect.js
|
|
20
|
+
shopify_app/post_redirect.js
|
|
20
21
|
shopify_app/top_level.js
|
|
21
22
|
shopify_app/enable_cookies.js
|
|
22
23
|
shopify_app/request_storage_access.js
|
data/lib/shopify_app/version.rb
CHANGED
data/lib/shopify_app.rb
CHANGED
data/package.json
CHANGED
data/service.yml
CHANGED
data/shopify_app.gemspec
CHANGED
|
@@ -13,11 +13,12 @@ Gem::Specification.new do |s|
|
|
|
13
13
|
|
|
14
14
|
s.metadata['allowed_push_host'] = 'https://rubygems.org'
|
|
15
15
|
|
|
16
|
-
s.add_runtime_dependency('browser_sniffer', '~> 1.
|
|
16
|
+
s.add_runtime_dependency('browser_sniffer', '~> 1.4.0')
|
|
17
|
+
s.add_runtime_dependency('omniauth-rails_csrf_protection')
|
|
17
18
|
s.add_runtime_dependency('rails', '> 5.2.1', '< 6.2')
|
|
18
19
|
s.add_runtime_dependency('shopify_api', '~> 9.4')
|
|
19
|
-
s.add_runtime_dependency('omniauth-shopify-oauth2', '~> 2.
|
|
20
|
-
s.add_runtime_dependency('jwt', '
|
|
20
|
+
s.add_runtime_dependency('omniauth-shopify-oauth2', '~> 2.3')
|
|
21
|
+
s.add_runtime_dependency('jwt', '>= 2.2.3')
|
|
21
22
|
s.add_runtime_dependency('redirect_safely', '~> 1.0')
|
|
22
23
|
|
|
23
24
|
s.add_development_dependency('rake')
|
data/translation.yml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
source_language: en
|
|
2
|
-
target_languages: [cs, da, de, es, fi, fr,
|
|
2
|
+
target_languages: [cs, da, de, es, fi, fr, it, ja, ko, nb, nl, pl, pt-BR, pt-PT, sv, th, tr, vi, zh-CN, zh-TW]
|
|
3
3
|
components:
|
|
4
4
|
- name: 'merchant'
|
|
5
5
|
paths:
|
data/yarn.lock
CHANGED
|
@@ -4519,9 +4519,9 @@ sprintf-js@~1.0.2:
|
|
|
4519
4519
|
integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=
|
|
4520
4520
|
|
|
4521
4521
|
ssri@^6.0.1:
|
|
4522
|
-
version "6.0.
|
|
4523
|
-
resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.
|
|
4524
|
-
integrity sha512-
|
|
4522
|
+
version "6.0.2"
|
|
4523
|
+
resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.2.tgz#157939134f20464e7301ddba3e90ffa8f7728ac5"
|
|
4524
|
+
integrity sha512-cepbSq/neFK7xB6A50KHN0xHDotYzq58wWCa5LeWqnPrHG8GzfEjO/4O8kpmcGW+oaxkvhEJCWgbgNk4/ZV93Q==
|
|
4525
4525
|
dependencies:
|
|
4526
4526
|
figgy-pudding "^3.5.1"
|
|
4527
4527
|
|
|
@@ -5115,9 +5115,9 @@ xtend@^4.0.0, xtend@~4.0.1:
|
|
|
5115
5115
|
integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==
|
|
5116
5116
|
|
|
5117
5117
|
y18n@^4.0.0:
|
|
5118
|
-
version "4.0.
|
|
5119
|
-
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.
|
|
5120
|
-
integrity sha512-
|
|
5118
|
+
version "4.0.3"
|
|
5119
|
+
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf"
|
|
5120
|
+
integrity sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==
|
|
5121
5121
|
|
|
5122
5122
|
yallist@^3.0.2:
|
|
5123
5123
|
version "3.1.1"
|
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:
|
|
4
|
+
version: 18.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shopify
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-01-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: browser_sniffer
|
|
@@ -16,14 +16,28 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 1.
|
|
19
|
+
version: 1.4.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.4.0
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: omniauth-rails_csrf_protection
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
27
41
|
- !ruby/object:Gem::Dependency
|
|
28
42
|
name: rails
|
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -64,28 +78,28 @@ dependencies:
|
|
|
64
78
|
requirements:
|
|
65
79
|
- - "~>"
|
|
66
80
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: 2.
|
|
81
|
+
version: '2.3'
|
|
68
82
|
type: :runtime
|
|
69
83
|
prerelease: false
|
|
70
84
|
version_requirements: !ruby/object:Gem::Requirement
|
|
71
85
|
requirements:
|
|
72
86
|
- - "~>"
|
|
73
87
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: 2.
|
|
88
|
+
version: '2.3'
|
|
75
89
|
- !ruby/object:Gem::Dependency
|
|
76
90
|
name: jwt
|
|
77
91
|
requirement: !ruby/object:Gem::Requirement
|
|
78
92
|
requirements:
|
|
79
|
-
- - "
|
|
93
|
+
- - ">="
|
|
80
94
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: 2.2.
|
|
95
|
+
version: 2.2.3
|
|
82
96
|
type: :runtime
|
|
83
97
|
prerelease: false
|
|
84
98
|
version_requirements: !ruby/object:Gem::Requirement
|
|
85
99
|
requirements:
|
|
86
|
-
- - "
|
|
100
|
+
- - ">="
|
|
87
101
|
- !ruby/object:Gem::Version
|
|
88
|
-
version: 2.2.
|
|
102
|
+
version: 2.2.3
|
|
89
103
|
- !ruby/object:Gem::Dependency
|
|
90
104
|
name: redirect_safely
|
|
91
105
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -272,6 +286,7 @@ files:
|
|
|
272
286
|
- app/assets/javascripts/shopify_app/enable_cookies.js
|
|
273
287
|
- app/assets/javascripts/shopify_app/itp_helper.js
|
|
274
288
|
- app/assets/javascripts/shopify_app/partition_cookies.js
|
|
289
|
+
- app/assets/javascripts/shopify_app/post_redirect.js
|
|
275
290
|
- app/assets/javascripts/shopify_app/redirect.js
|
|
276
291
|
- app/assets/javascripts/shopify_app/request_storage_access.js
|
|
277
292
|
- app/assets/javascripts/shopify_app/storage_access.js
|
|
@@ -297,6 +312,7 @@ files:
|
|
|
297
312
|
- app/views/shopify_app/sessions/new.html.erb
|
|
298
313
|
- app/views/shopify_app/sessions/request_storage_access.html.erb
|
|
299
314
|
- app/views/shopify_app/sessions/top_level_interaction.html.erb
|
|
315
|
+
- app/views/shopify_app/shared/post_redirect_to_auth_shopify.html.erb
|
|
300
316
|
- app/views/shopify_app/shared/redirect.html.erb
|
|
301
317
|
- config/locales/cs.yml
|
|
302
318
|
- config/locales/da.yml
|
|
@@ -305,11 +321,9 @@ files:
|
|
|
305
321
|
- config/locales/es.yml
|
|
306
322
|
- config/locales/fi.yml
|
|
307
323
|
- config/locales/fr.yml
|
|
308
|
-
- config/locales/hi.yml
|
|
309
324
|
- config/locales/it.yml
|
|
310
325
|
- config/locales/ja.yml
|
|
311
326
|
- config/locales/ko.yml
|
|
312
|
-
- config/locales/ms.yml
|
|
313
327
|
- config/locales/nb.yml
|
|
314
328
|
- config/locales/nl.yml
|
|
315
329
|
- config/locales/pl.yml
|
|
@@ -445,7 +459,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
445
459
|
- !ruby/object:Gem::Version
|
|
446
460
|
version: '0'
|
|
447
461
|
requirements: []
|
|
448
|
-
rubygems_version: 3.
|
|
462
|
+
rubygems_version: 3.2.20
|
|
449
463
|
signing_key:
|
|
450
464
|
specification_version: 4
|
|
451
465
|
summary: This gem is used to get quickly started with the Shopify API
|
data/config/locales/hi.yml
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
hi:
|
|
3
|
-
logged_out: सफलतापूर्वक लॉग आउट कर दिया
|
|
4
|
-
could_not_log_in: Shopify स्टोर में लॉग इन नहीं किया जा सका
|
|
5
|
-
invalid_shop_url: अमान्य शॉप डोमेन
|
|
6
|
-
enable_cookies_heading: "%{app} के कुकीज़ सक्षम करें"
|
|
7
|
-
enable_cookies_body: आपको %{app} का उपयोग Shopify में करने के लिए इस ब्राउज़र में
|
|
8
|
-
कुकीज़ मैन्युअल रूप से सक्षम करने चाहिए.
|
|
9
|
-
enable_cookies_footer: कुकीज़ अस्थायी रूप से आपकी वरीयताएं और व्यक्तिगत जानकारी स्टोर
|
|
10
|
-
कर ऐप को आपको प्रमाणित करने देते हैं. इनकी समय-सीमा 30 दिनों बाद समाप्त हो जाती
|
|
11
|
-
है.
|
|
12
|
-
enable_cookies_action: कुकीज़ को सक्षम करें
|
|
13
|
-
top_level_interaction_heading: आपके ब्राउज़र को %{app} प्रमाणित करने की आवश्यकता
|
|
14
|
-
है
|
|
15
|
-
top_level_interaction_body: आपके ब्राउज़र को %{app} जैसे ऐप की ज़रूरत होती है, जो
|
|
16
|
-
Shopify द्वारा आपके लिए उसे खोलने से पहले कुकीज़ पर पहुंचने करने की अनुमति मांगे.
|
|
17
|
-
top_level_interaction_action: जारी रखें
|
|
18
|
-
request_storage_access_heading: "%{app} को कुकीज़ पर पहुंच करने की आवश्यकता है"
|
|
19
|
-
request_storage_access_body: यह आपकी व्यक्तिगत जानकारी अस्थायी रूप से स्टोर कर ऐप
|
|
20
|
-
को आपको प्रमाणित करने देता है. जारी रखें पर क्लिक करें और कुकीज़ को ऐप उपयोग करने
|
|
21
|
-
की अनुमति दें.
|
|
22
|
-
request_storage_access_footer: कुकीज़ की समय-सीमा 30 दिनों बाद समाप्त हो जाती है.
|
|
23
|
-
request_storage_access_action: जारी रखें
|
data/config/locales/ms.yml
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
ms:
|
|
3
|
-
logged_out: Berjaya log keluar
|
|
4
|
-
could_not_log_in: Tidak dapat log masuk ke kedai Shopify
|
|
5
|
-
invalid_shop_url: Domain kedai tidak sah
|
|
6
|
-
enable_cookies_heading: Dayakan kuki dari %{app}
|
|
7
|
-
enable_cookies_body: Anda mesti mengaktifkan kuki secara manual dalam pelayar ini
|
|
8
|
-
untuk %{app} digunakan dalam Shopify.
|
|
9
|
-
enable_cookies_footer: Kuki membenarkan aplikasi mengesahkan anda dengan menyimpan
|
|
10
|
-
keutamaan dan maklumat peribadi anda buat sementara waktu. Ia tamat tempoh selepas
|
|
11
|
-
30 hari.
|
|
12
|
-
enable_cookies_action: Dayakan kuki
|
|
13
|
-
top_level_interaction_heading: Pelayar anda perlu mengesahkan %{app}
|
|
14
|
-
top_level_interaction_body: Pelayar anda memerlukan aplikasi seperti %{app} untuk
|
|
15
|
-
meminta anda akses kepada kuki sebelum Shopify boleh membukanya untuk anda.
|
|
16
|
-
top_level_interaction_action: Teruskan
|
|
17
|
-
request_storage_access_heading: "%{app} memerlukan akses kepada kuki"
|
|
18
|
-
request_storage_access_body: Ini membolehkan aplikasi mengesahkan anda dengan menyimpan
|
|
19
|
-
maklumat peribadi anda buat sementara waktu. Klik teruskan dan benarkan kuki untuk
|
|
20
|
-
menggunakan aplikasi.
|
|
21
|
-
request_storage_access_footer: Kuki akan tamat tempoh selepas 30 hari.
|
|
22
|
-
request_storage_access_action: Teruskan
|