shopify_app 18.0.2 → 19.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +4 -5
  3. data/.gitignore +1 -0
  4. data/.nvmrc +1 -1
  5. data/.ruby-version +1 -1
  6. data/CHANGELOG.md +52 -2
  7. data/CONTRIBUTING.md +6 -1
  8. data/Gemfile +3 -2
  9. data/Gemfile.lock +144 -164
  10. data/README.md +1 -0
  11. data/Rakefile +4 -3
  12. data/app/assets/javascripts/shopify_app/app_bridge_2.0.12.js +10 -0
  13. data/app/assets/javascripts/shopify_app/app_bridge_redirect.js +22 -0
  14. data/app/assets/javascripts/shopify_app/redirect.js +9 -11
  15. data/app/assets/javascripts/shopify_app/storage_access.js +4 -10
  16. data/app/controllers/concerns/shopify_app/authenticated.rb +3 -0
  17. data/app/controllers/concerns/shopify_app/ensure_authenticated_links.rb +16 -3
  18. data/app/controllers/concerns/shopify_app/require_known_shop.rb +1 -0
  19. data/app/controllers/concerns/shopify_app/shop_access_scopes_verification.rb +1 -1
  20. data/app/controllers/shopify_app/authenticated_controller.rb +1 -0
  21. data/app/controllers/shopify_app/callback_controller.rb +49 -134
  22. data/app/controllers/shopify_app/sessions_controller.rb +26 -131
  23. data/app/controllers/shopify_app/webhooks_controller.rb +5 -24
  24. data/app/views/shopify_app/sessions/enable_cookies.html.erb +1 -1
  25. data/app/views/shopify_app/sessions/request_storage_access.html.erb +11 -11
  26. data/app/views/shopify_app/sessions/top_level_interaction.html.erb +1 -1
  27. data/app/views/shopify_app/shared/redirect.html.erb +2 -2
  28. data/config/locales/zh-CN.yml +1 -1
  29. data/config/routes.rb +20 -12
  30. data/docs/Troubleshooting.md +0 -3
  31. data/docs/Upgrading.md +116 -14
  32. data/docs/shopify_app/engine.md +2 -2
  33. data/docs/shopify_app/handling-access-scopes-changes.md +11 -1
  34. data/docs/shopify_app/script-tags.md +1 -1
  35. data/docs/shopify_app/webhooks.md +3 -3
  36. data/lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb +10 -9
  37. data/lib/generators/shopify_app/add_after_authenticate_job/templates/after_authenticate_job.rb +1 -0
  38. data/lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb +4 -3
  39. data/lib/generators/shopify_app/add_webhook/add_webhook_generator.rb +13 -12
  40. data/lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt +9 -1
  41. data/lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb +7 -6
  42. data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_controller.rb +2 -1
  43. data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_route.rb +1 -1
  44. data/lib/generators/shopify_app/authenticated_controller/authenticated_controller_generator.rb +3 -3
  45. data/lib/generators/shopify_app/controllers/controllers_generator.rb +4 -3
  46. data/lib/generators/shopify_app/home_controller/home_controller_generator.rb +11 -15
  47. data/lib/generators/shopify_app/home_controller/templates/home_controller.rb +2 -2
  48. data/lib/generators/shopify_app/home_controller/templates/index.html.erb +7 -3
  49. data/lib/generators/shopify_app/install/install_generator.rb +27 -72
  50. data/lib/generators/shopify_app/install/templates/embedded_app.html.erb +3 -1
  51. data/lib/generators/shopify_app/install/templates/session_store.rb +2 -1
  52. data/lib/generators/shopify_app/install/templates/shopify_app.rb.tt +33 -5
  53. data/lib/generators/shopify_app/install/templates/shopify_app_importmap.js +13 -0
  54. data/lib/generators/shopify_app/products_controller/products_controller_generator.rb +3 -3
  55. data/lib/generators/shopify_app/products_controller/templates/products_controller.rb +1 -1
  56. data/lib/generators/shopify_app/rotate_shopify_token_job/rotate_shopify_token_job_generator.rb +4 -4
  57. data/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token.rake +1 -0
  58. data/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token_job.rb +1 -1
  59. data/lib/generators/shopify_app/routes/routes_generator.rb +6 -5
  60. data/lib/generators/shopify_app/routes/templates/routes.rb +5 -5
  61. data/lib/generators/shopify_app/shop_model/shop_model_generator.rb +11 -10
  62. data/lib/generators/shopify_app/shop_model/templates/shop.rb +1 -0
  63. data/lib/generators/shopify_app/shopify_app_generator.rb +4 -3
  64. data/lib/generators/shopify_app/user_model/templates/user.rb +1 -0
  65. data/lib/generators/shopify_app/user_model/user_model_generator.rb +11 -10
  66. data/lib/generators/shopify_app/views/views_generator.rb +4 -3
  67. data/lib/shopify_app/access_scopes/shop_strategy.rb +2 -2
  68. data/lib/shopify_app/access_scopes/user_strategy.rb +4 -4
  69. data/lib/shopify_app/configuration.rb +33 -14
  70. data/lib/shopify_app/controller_concerns/app_proxy_verification.rb +4 -3
  71. data/lib/shopify_app/controller_concerns/csrf_protection.rb +2 -1
  72. data/lib/shopify_app/controller_concerns/embedded_app.rb +4 -3
  73. data/lib/shopify_app/controller_concerns/ensure_billing.rb +254 -0
  74. data/lib/shopify_app/controller_concerns/itp.rb +3 -3
  75. data/lib/shopify_app/controller_concerns/localization.rb +1 -0
  76. data/lib/shopify_app/controller_concerns/login_protection.rb +82 -68
  77. data/lib/shopify_app/controller_concerns/payload_verification.rb +3 -2
  78. data/lib/shopify_app/controller_concerns/webhook_verification.rb +2 -1
  79. data/lib/shopify_app/engine.rb +7 -15
  80. data/lib/shopify_app/jobs/scripttags_manager_job.rb +2 -2
  81. data/lib/shopify_app/jobs/webhooks_manager_job.rb +4 -5
  82. data/lib/shopify_app/managers/scripttags_manager.rb +11 -4
  83. data/lib/shopify_app/managers/webhooks_manager.rb +42 -44
  84. data/lib/shopify_app/middleware/jwt_middleware.rb +5 -3
  85. data/lib/shopify_app/session/in_memory_session_store.rb +1 -0
  86. data/lib/shopify_app/session/in_memory_shop_session_store.rb +2 -1
  87. data/lib/shopify_app/session/in_memory_user_session_store.rb +1 -0
  88. data/lib/shopify_app/session/jwt.rb +12 -7
  89. data/lib/shopify_app/session/null_user_session_store.rb +2 -1
  90. data/lib/shopify_app/session/session_repository.rb +37 -0
  91. data/lib/shopify_app/session/session_storage.rb +4 -6
  92. data/lib/shopify_app/session/shop_session_storage.rb +6 -6
  93. data/lib/shopify_app/session/shop_session_storage_with_scopes.rb +7 -8
  94. data/lib/shopify_app/session/user_session_storage.rb +19 -6
  95. data/lib/shopify_app/session/user_session_storage_with_scopes.rb +22 -9
  96. data/lib/shopify_app/test_helpers/all.rb +2 -1
  97. data/lib/shopify_app/test_helpers/webhook_verification_helper.rb +4 -3
  98. data/lib/shopify_app/utils.rb +4 -10
  99. data/lib/shopify_app/version.rb +2 -1
  100. data/lib/shopify_app.rb +44 -40
  101. data/package.json +1 -1
  102. data/shopify_app.gemspec +22 -21
  103. data/translation.yml +1 -1
  104. data/yarn.lock +103 -88
  105. metadata +51 -60
  106. data/config/locales/hi.yml +0 -23
  107. data/config/locales/ms.yml +0 -22
  108. data/lib/generators/shopify_app/install/templates/omniauth.rb +0 -4
  109. data/lib/generators/shopify_app/install/templates/shopify_provider.rb.tt +0 -8
  110. data/lib/generators/shopify_app/install/templates/user_agent.rb +0 -6
  111. data/lib/shopify_app/middleware/same_site_cookie_middleware.rb +0 -34
  112. data/lib/shopify_app/omniauth/omniauth_configuration.rb +0 -64
metadata CHANGED
@@ -1,43 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 18.0.2
4
+ version: 19.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: 2021-06-15 00:00:00.000000000 Z
11
+ date: 2022-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activeresource
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: browser_sniffer
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - "~>"
18
32
  - !ruby/object:Gem::Version
19
- version: 1.2.2
33
+ version: '2.0'
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
38
  - - "~>"
25
39
  - !ruby/object:Gem::Version
26
- version: 1.2.2
40
+ version: '2.0'
27
41
  - !ruby/object:Gem::Dependency
28
- name: omniauth-rails_csrf_protection
42
+ name: jwt
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - ">="
32
46
  - !ruby/object:Gem::Version
33
- version: '0'
47
+ version: 2.2.3
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - ">="
39
53
  - !ruby/object:Gem::Version
40
- version: '0'
54
+ version: 2.2.3
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rails
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -45,9 +59,6 @@ dependencies:
45
59
  - - ">"
46
60
  - !ruby/object:Gem::Version
47
61
  version: 5.2.1
48
- - - "<"
49
- - !ruby/object:Gem::Version
50
- version: '6.2'
51
62
  type: :runtime
52
63
  prerelease: false
53
64
  version_requirements: !ruby/object:Gem::Requirement
@@ -55,67 +66,64 @@ dependencies:
55
66
  - - ">"
56
67
  - !ruby/object:Gem::Version
57
68
  version: 5.2.1
58
- - - "<"
59
- - !ruby/object:Gem::Version
60
- version: '6.2'
61
69
  - !ruby/object:Gem::Dependency
62
- name: shopify_api
70
+ name: redirect_safely
63
71
  requirement: !ruby/object:Gem::Requirement
64
72
  requirements:
65
73
  - - "~>"
66
74
  - !ruby/object:Gem::Version
67
- version: '9.4'
75
+ version: '1.0'
68
76
  type: :runtime
69
77
  prerelease: false
70
78
  version_requirements: !ruby/object:Gem::Requirement
71
79
  requirements:
72
80
  - - "~>"
73
81
  - !ruby/object:Gem::Version
74
- version: '9.4'
82
+ version: '1.0'
75
83
  - !ruby/object:Gem::Dependency
76
- name: omniauth-shopify-oauth2
84
+ name: shopify_api
77
85
  requirement: !ruby/object:Gem::Requirement
78
86
  requirements:
79
87
  - - "~>"
80
88
  - !ruby/object:Gem::Version
81
- version: '2.3'
89
+ version: '10.0'
82
90
  type: :runtime
83
91
  prerelease: false
84
92
  version_requirements: !ruby/object:Gem::Requirement
85
93
  requirements:
86
94
  - - "~>"
87
95
  - !ruby/object:Gem::Version
88
- version: '2.3'
96
+ version: '10.0'
89
97
  - !ruby/object:Gem::Dependency
90
- name: jwt
98
+ name: sprockets-rails
91
99
  requirement: !ruby/object:Gem::Requirement
92
100
  requirements:
93
101
  - - ">="
94
102
  - !ruby/object:Gem::Version
95
- version: 2.2.3
103
+ version: 2.0.0
96
104
  type: :runtime
97
105
  prerelease: false
98
106
  version_requirements: !ruby/object:Gem::Requirement
99
107
  requirements:
100
108
  - - ">="
101
109
  - !ruby/object:Gem::Version
102
- version: 2.2.3
110
+ version: 2.0.0
103
111
  - !ruby/object:Gem::Dependency
104
- name: redirect_safely
112
+ name: byebug
105
113
  requirement: !ruby/object:Gem::Requirement
106
114
  requirements:
107
- - - "~>"
115
+ - - ">="
108
116
  - !ruby/object:Gem::Version
109
- version: '1.0'
110
- type: :runtime
117
+ version: '0'
118
+ type: :development
111
119
  prerelease: false
112
120
  version_requirements: !ruby/object:Gem::Requirement
113
121
  requirements:
114
- - - "~>"
122
+ - - ">="
115
123
  - !ruby/object:Gem::Version
116
- version: '1.0'
124
+ version: '0'
117
125
  - !ruby/object:Gem::Dependency
118
- name: rake
126
+ name: minitest
119
127
  requirement: !ruby/object:Gem::Requirement
120
128
  requirements:
121
129
  - - ">="
@@ -129,7 +137,7 @@ dependencies:
129
137
  - !ruby/object:Gem::Version
130
138
  version: '0'
131
139
  - !ruby/object:Gem::Dependency
132
- name: byebug
140
+ name: mocha
133
141
  requirement: !ruby/object:Gem::Requirement
134
142
  requirements:
135
143
  - - ">="
@@ -185,7 +193,7 @@ dependencies:
185
193
  - !ruby/object:Gem::Version
186
194
  version: '0'
187
195
  - !ruby/object:Gem::Dependency
188
- name: rb-readline
196
+ name: rake
189
197
  requirement: !ruby/object:Gem::Requirement
190
198
  requirements:
191
199
  - - ">="
@@ -199,21 +207,7 @@ dependencies:
199
207
  - !ruby/object:Gem::Version
200
208
  version: '0'
201
209
  - !ruby/object:Gem::Dependency
202
- name: sqlite3
203
- requirement: !ruby/object:Gem::Requirement
204
- requirements:
205
- - - "~>"
206
- - !ruby/object:Gem::Version
207
- version: '1.4'
208
- type: :development
209
- prerelease: false
210
- version_requirements: !ruby/object:Gem::Requirement
211
- requirements:
212
- - - "~>"
213
- - !ruby/object:Gem::Version
214
- version: '1.4'
215
- - !ruby/object:Gem::Dependency
216
- name: minitest
210
+ name: rb-readline
217
211
  requirement: !ruby/object:Gem::Requirement
218
212
  requirements:
219
213
  - - ">="
@@ -227,19 +221,19 @@ dependencies:
227
221
  - !ruby/object:Gem::Version
228
222
  version: '0'
229
223
  - !ruby/object:Gem::Dependency
230
- name: mocha
224
+ name: sqlite3
231
225
  requirement: !ruby/object:Gem::Requirement
232
226
  requirements:
233
- - - ">="
227
+ - - "~>"
234
228
  - !ruby/object:Gem::Version
235
- version: '0'
229
+ version: '1.4'
236
230
  type: :development
237
231
  prerelease: false
238
232
  version_requirements: !ruby/object:Gem::Requirement
239
233
  requirements:
240
- - - ">="
234
+ - - "~>"
241
235
  - !ruby/object:Gem::Version
242
- version: '0'
236
+ version: '1.4'
243
237
  - !ruby/object:Gem::Dependency
244
238
  name: webmock
245
239
  requirement: !ruby/object:Gem::Requirement
@@ -283,6 +277,8 @@ files:
283
277
  - Rakefile
284
278
  - SECURITY.md
285
279
  - app/assets/images/storage_access.svg
280
+ - app/assets/javascripts/shopify_app/app_bridge_2.0.12.js
281
+ - app/assets/javascripts/shopify_app/app_bridge_redirect.js
286
282
  - app/assets/javascripts/shopify_app/enable_cookies.js
287
283
  - app/assets/javascripts/shopify_app/itp_helper.js
288
284
  - app/assets/javascripts/shopify_app/partition_cookies.js
@@ -321,11 +317,9 @@ files:
321
317
  - config/locales/es.yml
322
318
  - config/locales/fi.yml
323
319
  - config/locales/fr.yml
324
- - config/locales/hi.yml
325
320
  - config/locales/it.yml
326
321
  - config/locales/ja.yml
327
322
  - config/locales/ko.yml
328
- - config/locales/ms.yml
329
323
  - config/locales/nb.yml
330
324
  - config/locales/nl.yml
331
325
  - config/locales/pl.yml
@@ -373,13 +367,11 @@ files:
373
367
  - lib/generators/shopify_app/install/templates/_flash_messages.html.erb
374
368
  - lib/generators/shopify_app/install/templates/embedded_app.html.erb
375
369
  - lib/generators/shopify_app/install/templates/flash_messages.js
376
- - lib/generators/shopify_app/install/templates/omniauth.rb
377
370
  - lib/generators/shopify_app/install/templates/session_store.rb
378
371
  - lib/generators/shopify_app/install/templates/shopify_app.js
379
372
  - lib/generators/shopify_app/install/templates/shopify_app.rb.tt
373
+ - lib/generators/shopify_app/install/templates/shopify_app_importmap.js
380
374
  - lib/generators/shopify_app/install/templates/shopify_app_index.js
381
- - lib/generators/shopify_app/install/templates/shopify_provider.rb.tt
382
- - lib/generators/shopify_app/install/templates/user_agent.rb
383
375
  - lib/generators/shopify_app/products_controller/products_controller_generator.rb
384
376
  - lib/generators/shopify_app/products_controller/templates/products_controller.rb
385
377
  - lib/generators/shopify_app/rotate_shopify_token_job/rotate_shopify_token_job_generator.rb
@@ -407,6 +399,7 @@ files:
407
399
  - lib/shopify_app/controller_concerns/app_proxy_verification.rb
408
400
  - lib/shopify_app/controller_concerns/csrf_protection.rb
409
401
  - lib/shopify_app/controller_concerns/embedded_app.rb
402
+ - lib/shopify_app/controller_concerns/ensure_billing.rb
410
403
  - lib/shopify_app/controller_concerns/itp.rb
411
404
  - lib/shopify_app/controller_concerns/localization.rb
412
405
  - lib/shopify_app/controller_concerns/login_protection.rb
@@ -418,8 +411,6 @@ files:
418
411
  - lib/shopify_app/managers/scripttags_manager.rb
419
412
  - lib/shopify_app/managers/webhooks_manager.rb
420
413
  - lib/shopify_app/middleware/jwt_middleware.rb
421
- - lib/shopify_app/middleware/same_site_cookie_middleware.rb
422
- - lib/shopify_app/omniauth/omniauth_configuration.rb
423
414
  - lib/shopify_app/session/in_memory_session_store.rb
424
415
  - lib/shopify_app/session/in_memory_shop_session_store.rb
425
416
  - lib/shopify_app/session/in_memory_user_session_store.rb
@@ -454,14 +445,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
454
445
  requirements:
455
446
  - - ">="
456
447
  - !ruby/object:Gem::Version
457
- version: '2.5'
448
+ version: '2.6'
458
449
  required_rubygems_version: !ruby/object:Gem::Requirement
459
450
  requirements:
460
451
  - - ">="
461
452
  - !ruby/object:Gem::Version
462
453
  version: '0'
463
454
  requirements: []
464
- rubygems_version: 3.2.17
455
+ rubygems_version: 3.3.3
465
456
  signing_key:
466
457
  specification_version: 4
467
458
  summary: This gem is used to get quickly started with the Shopify API
@@ -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: जारी रखें
@@ -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
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Rails.application.config.middleware.use(OmniAuth::Builder) do
4
- end
@@ -1,8 +0,0 @@
1
- provider :shopify,
2
- ShopifyApp.configuration.api_key,
3
- ShopifyApp.configuration.secret,
4
- scope: ShopifyApp.configuration.scope,
5
- setup: lambda { |env|
6
- configuration = ShopifyApp::OmniAuthConfiguration.new(env['omniauth.strategy'], Rack::Request.new(env))
7
- configuration.build_options
8
- }
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
- module ShopifyAPI
3
- class Base < ActiveResource::Base
4
- headers['User-Agent'] << " | ShopifyApp/#{ShopifyApp::VERSION}"
5
- end
6
- end
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
- module ShopifyApp
3
- class SameSiteCookieMiddleware
4
- COOKIE_SEPARATOR = "\n"
5
-
6
- def initialize(app)
7
- @app = app
8
- end
9
-
10
- def call(env)
11
- status, headers, body = @app.call(env)
12
- user_agent = env['HTTP_USER_AGENT']
13
-
14
- if headers && headers['Set-Cookie'] &&
15
- BrowserSniffer.new(user_agent).same_site_none_compatible? &&
16
- ShopifyApp.configuration.enable_same_site_none &&
17
- Rack::Request.new(env).ssl?
18
-
19
- set_cookies = headers['Set-Cookie']
20
- .split(COOKIE_SEPARATOR)
21
- .compact
22
- .map do |cookie|
23
- cookie << '; Secure' unless cookie =~ /;\s*secure/i
24
- cookie << '; SameSite=None' if ShopifyApp.configuration.embedded_app?
25
- cookie
26
- end
27
-
28
- headers['Set-Cookie'] = set_cookies.join(COOKIE_SEPARATOR)
29
- end
30
-
31
- [status, headers, body]
32
- end
33
- end
34
- end
@@ -1,64 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ShopifyApp
4
- class OmniAuthConfiguration
5
- attr_reader :strategy, :request
6
- attr_writer :client_options_site, :scopes, :per_user_permissions
7
-
8
- def initialize(strategy, request)
9
- @strategy = strategy
10
- @request = request
11
- end
12
-
13
- def build_options
14
- strategy.options[:client_options][:site] = client_options_site
15
- strategy.options[:scope] = scopes
16
- strategy.options[:old_client_secret] = ShopifyApp.configuration.old_secret
17
- strategy.options[:per_user_permissions] = request_online_tokens?
18
- end
19
-
20
- private
21
-
22
- def request_online_tokens?
23
- return @per_user_permissions unless @per_user_permissions.nil?
24
- default_request_online_tokens?
25
- end
26
-
27
- def scopes
28
- @scopes || default_scopes
29
- end
30
-
31
- def client_options_site
32
- @client_options_site || default_client_options_site
33
- end
34
-
35
- def default_scopes
36
- if request_online_tokens?
37
- ShopifyApp.configuration.user_access_scopes
38
- else
39
- ShopifyApp.configuration.shop_access_scopes
40
- end
41
- end
42
-
43
- def default_client_options_site
44
- return '' unless shop_domain.present?
45
- "https://#{shopify_auth_params[:shop]}"
46
- end
47
-
48
- def default_request_online_tokens?
49
- strategy.session[:user_tokens] && !update_shop_scopes?
50
- end
51
-
52
- def update_shop_scopes?
53
- ShopifyApp.configuration.shop_access_scopes_strategy.update_access_scopes?(shop_domain)
54
- end
55
-
56
- def shop_domain
57
- request.params['shop'] || (shopify_auth_params && shopify_auth_params['shop'])
58
- end
59
-
60
- def shopify_auth_params
61
- strategy.session['shopify.omniauth_params']&.with_indifferent_access
62
- end
63
- end
64
- end