shopify_app 12.0.4 → 13.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +13 -6
  3. data/CHANGELOG.md +28 -0
  4. data/Gemfile +3 -0
  5. data/README.md +98 -20
  6. data/Rakefile +1 -0
  7. data/app/controllers/concerns/shopify_app/authenticated.rb +1 -1
  8. data/app/controllers/shopify_app/authenticated_controller.rb +1 -0
  9. data/app/controllers/shopify_app/callback_controller.rb +15 -11
  10. data/app/controllers/shopify_app/sessions_controller.rb +35 -9
  11. data/app/controllers/shopify_app/webhooks_controller.rb +6 -5
  12. data/config/locales/fi.yml +1 -1
  13. data/config/routes.rb +1 -0
  14. data/lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb +5 -3
  15. data/lib/generators/shopify_app/add_after_authenticate_job/templates/after_authenticate_job.rb +1 -0
  16. data/lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb +2 -1
  17. data/lib/generators/shopify_app/add_marketing_activity_extension/templates/marketing_activities_controller.rb +4 -4
  18. data/lib/generators/shopify_app/add_webhook/add_webhook_generator.rb +5 -4
  19. data/lib/generators/shopify_app/add_webhook/templates/webhook_job.rb +5 -0
  20. data/lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb +4 -3
  21. data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_controller.rb +3 -3
  22. data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_route.rb +10 -9
  23. data/lib/generators/shopify_app/controllers/controllers_generator.rb +1 -0
  24. data/lib/generators/shopify_app/home_controller/home_controller_generator.rb +4 -3
  25. data/lib/generators/shopify_app/home_controller/templates/index.html.erb +1 -1
  26. data/lib/generators/shopify_app/install/install_generator.rb +9 -8
  27. data/lib/generators/shopify_app/install/templates/embedded_app.html.erb +1 -1
  28. data/lib/generators/shopify_app/install/templates/omniauth.rb +2 -1
  29. data/lib/generators/shopify_app/install/templates/shopify_app.rb +1 -1
  30. data/lib/generators/shopify_app/install/templates/shopify_provider.rb +1 -1
  31. data/lib/generators/shopify_app/install/templates/user_agent.rb +2 -1
  32. data/lib/generators/shopify_app/routes/routes_generator.rb +1 -0
  33. data/lib/generators/shopify_app/routes/templates/routes.rb +10 -9
  34. data/lib/generators/shopify_app/shop_model/shop_model_generator.rb +5 -4
  35. data/lib/generators/shopify_app/shop_model/templates/shop.rb +2 -1
  36. data/lib/generators/shopify_app/shopify_app_generator.rb +4 -3
  37. data/lib/generators/shopify_app/user_model/templates/user.rb +2 -1
  38. data/lib/generators/shopify_app/user_model/user_model_generator.rb +5 -4
  39. data/lib/generators/shopify_app/views/views_generator.rb +1 -0
  40. data/lib/shopify_app.rb +9 -4
  41. data/lib/shopify_app/configuration.rb +20 -10
  42. data/lib/shopify_app/controller_concerns/app_proxy_verification.rb +3 -2
  43. data/lib/shopify_app/controller_concerns/embedded_app.rb +3 -2
  44. data/lib/shopify_app/controller_concerns/localization.rb +1 -0
  45. data/lib/shopify_app/controller_concerns/login_protection.rb +65 -25
  46. data/lib/shopify_app/controller_concerns/webhook_verification.rb +2 -1
  47. data/lib/shopify_app/engine.rb +1 -0
  48. data/lib/shopify_app/jobs/scripttags_manager_job.rb +1 -1
  49. data/lib/shopify_app/jobs/webhooks_manager_job.rb +1 -1
  50. data/lib/shopify_app/managers/scripttags_manager.rb +4 -3
  51. data/lib/shopify_app/managers/webhooks_manager.rb +4 -3
  52. data/lib/shopify_app/middleware/same_site_cookie_middleware.rb +5 -38
  53. data/lib/shopify_app/session/in_memory_session_store.rb +7 -3
  54. data/lib/shopify_app/session/in_memory_shop_session_store.rb +14 -0
  55. data/lib/shopify_app/session/in_memory_user_session_store.rb +14 -0
  56. data/lib/shopify_app/session/jwt.rb +48 -0
  57. data/lib/shopify_app/session/null_user_session_store.rb +22 -0
  58. data/lib/shopify_app/session/session_repository.rb +36 -14
  59. data/lib/shopify_app/session/session_storage.rb +1 -10
  60. data/lib/shopify_app/session/shop_session_storage.rb +42 -0
  61. data/lib/shopify_app/session/user_session_storage.rb +42 -0
  62. data/lib/shopify_app/test_helpers/all.rb +1 -0
  63. data/lib/shopify_app/test_helpers/webhook_verification_helper.rb +16 -0
  64. data/lib/shopify_app/utils.rb +6 -5
  65. data/lib/shopify_app/version.rb +2 -1
  66. data/package-lock.json +1231 -1210
  67. data/package.json +1 -1
  68. data/shopify_app.gemspec +12 -8
  69. data/yarn.lock +3 -3
  70. metadata +32 -11
  71. data/lib/shopify_app/session/storage_strategies/shop_storage_strategy.rb +0 -23
  72. data/lib/shopify_app/session/storage_strategies/user_storage_strategy.rb +0 -24
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shopify_app",
3
- "version": "12.0.2",
3
+ "version": "13.0.1",
4
4
  "repository": "git@github.com:Shopify/shopify_app.git",
5
5
  "author": "Shopify",
6
6
  "license": "MIT",
@@ -1,4 +1,5 @@
1
- $LOAD_PATH.push File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+ $LOAD_PATH.push(File.expand_path('../lib', __FILE__))
2
3
  require "shopify_app/version"
3
4
 
4
5
  Gem::Specification.new do |s|
@@ -6,14 +7,17 @@ Gem::Specification.new do |s|
6
7
  s.version = ShopifyApp::VERSION
7
8
  s.platform = Gem::Platform::RUBY
8
9
  s.author = "Shopify"
9
- s.summary = %q{This gem is used to get quickly started with the Shopify API}
10
+ s.summary = 'This gem is used to get quickly started with the Shopify API'
10
11
 
11
12
  s.required_ruby_version = ">= 2.3.1"
12
13
 
13
- s.add_runtime_dependency('browser_sniffer', '~> 1.1.3')
14
+ s.metadata['allowed_push_host'] = 'https://rubygems.org'
15
+
16
+ s.add_runtime_dependency('browser_sniffer', '~> 1.2.0')
14
17
  s.add_runtime_dependency('rails', '> 5.2.1')
15
- s.add_runtime_dependency('shopify_api', '~> 9.0')
16
- s.add_runtime_dependency('omniauth-shopify-oauth2', '~> 2.2.0')
18
+ s.add_runtime_dependency('shopify_api', '~> 9.0.2')
19
+ s.add_runtime_dependency('omniauth-shopify-oauth2', '~> 2.2.2')
20
+ s.add_runtime_dependency('jwt', '~> 2.2.1')
17
21
 
18
22
  s.add_development_dependency('rake')
19
23
  s.add_development_dependency('byebug')
@@ -26,7 +30,7 @@ Gem::Specification.new do |s|
26
30
  s.add_development_dependency('mocha')
27
31
  s.add_development_dependency('webmock')
28
32
 
29
- s.files = `git ls-files`.split("\n").reject { |f| f.match(%r{^(test|example)/}) }
30
- s.test_files = `git ls-files -- {test}/*`.split("\n")
33
+ s.files = %x(git ls-files).split("\n").reject { |f| f.match(%r{^(test|example)/}) }
34
+ s.test_files = %x(git ls-files -- {test}/*).split("\n")
31
35
  s.require_paths = ["lib"]
32
- end
36
+ end
data/yarn.lock CHANGED
@@ -994,9 +994,9 @@ accepts@~1.3.4:
994
994
  negotiator "0.6.2"
995
995
 
996
996
  acorn@^6.2.1:
997
- version "6.3.0"
998
- resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.3.0.tgz#0087509119ffa4fc0a0041d1e93a417e68cb856e"
999
- integrity sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA==
997
+ version "6.4.1"
998
+ resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.1.tgz#531e58ba3f51b9dacb9a6646ca4debf5b14ca474"
999
+ integrity sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==
1000
1000
 
1001
1001
  after@0.8.2:
1002
1002
  version "0.8.2"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.0.4
4
+ version: 13.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-19 00:00:00.000000000 Z
11
+ date: 2020-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: browser_sniffer
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.1.3
19
+ version: 1.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.1.3
26
+ version: 1.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,28 +44,42 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '9.0'
47
+ version: 9.0.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '9.0'
54
+ version: 9.0.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: omniauth-shopify-oauth2
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 2.2.0
61
+ version: 2.2.2
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 2.2.0
68
+ version: 2.2.2
69
+ - !ruby/object:Gem::Dependency
70
+ name: jwt
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 2.2.1
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 2.2.1
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rake
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -339,10 +353,16 @@ files:
339
353
  - lib/shopify_app/managers/webhooks_manager.rb
340
354
  - lib/shopify_app/middleware/same_site_cookie_middleware.rb
341
355
  - lib/shopify_app/session/in_memory_session_store.rb
356
+ - lib/shopify_app/session/in_memory_shop_session_store.rb
357
+ - lib/shopify_app/session/in_memory_user_session_store.rb
358
+ - lib/shopify_app/session/jwt.rb
359
+ - lib/shopify_app/session/null_user_session_store.rb
342
360
  - lib/shopify_app/session/session_repository.rb
343
361
  - lib/shopify_app/session/session_storage.rb
344
- - lib/shopify_app/session/storage_strategies/shop_storage_strategy.rb
345
- - lib/shopify_app/session/storage_strategies/user_storage_strategy.rb
362
+ - lib/shopify_app/session/shop_session_storage.rb
363
+ - lib/shopify_app/session/user_session_storage.rb
364
+ - lib/shopify_app/test_helpers/all.rb
365
+ - lib/shopify_app/test_helpers/webhook_verification_helper.rb
346
366
  - lib/shopify_app/utils.rb
347
367
  - lib/shopify_app/version.rb
348
368
  - package-lock.json
@@ -355,7 +375,8 @@ files:
355
375
  - yarn.lock
356
376
  homepage:
357
377
  licenses: []
358
- metadata: {}
378
+ metadata:
379
+ allowed_push_host: https://rubygems.org
359
380
  post_install_message:
360
381
  rdoc_options: []
361
382
  require_paths:
@@ -1,23 +0,0 @@
1
- module ShopifyApp
2
- module SessionStorage
3
- module ShopStorageStrategy
4
- def store(auth_session, *args)
5
- shop = find_or_initialize_by(shopify_domain: auth_session.domain)
6
- shop.shopify_token = auth_session.token
7
- shop.save!
8
- shop.id
9
- end
10
-
11
- def retrieve(id)
12
- return unless id
13
- if shop = self.find_by(id: id)
14
- ShopifyAPI::Session.new(
15
- domain: shop.shopify_domain,
16
- token: shop.shopify_token,
17
- api_version: shop.api_version
18
- )
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,24 +0,0 @@
1
- module ShopifyApp
2
- module SessionStorage
3
- module UserStorageStrategy
4
- def store(auth_session, user)
5
- user = find_or_initialize_by(shopify_user_id: user[:id])
6
- user.shopify_token = auth_session.token
7
- user.shopify_domain = auth_session.domain
8
- user.save!
9
- user.id
10
- end
11
-
12
- def retrieve(id)
13
- return unless id
14
- if user = self.find_by(shopify_user_id: id)
15
- ShopifyAPI::Session.new(
16
- domain: user.shopify_domain,
17
- token: user.shopify_token,
18
- api_version: user.api_version
19
- )
20
- end
21
- end
22
- end
23
- end
24
- end