shopify_app 7.2.0 → 8.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +5 -5
  2. data/.babelrc +5 -0
  3. data/.github/CODEOWNERS +1 -0
  4. data/{ISSUE_TEMPLATE.md → .github/ISSUE_TEMPLATE.md} +0 -0
  5. data/.github/probots.yml +2 -0
  6. data/.gitignore +5 -0
  7. data/.nvmrc +1 -0
  8. data/.rubocop.yml +10 -0
  9. data/.ruby-version +1 -0
  10. data/.travis.yml +24 -12
  11. data/CHANGELOG.md +151 -0
  12. data/Gemfile +2 -0
  13. data/README.md +167 -68
  14. data/app/assets/images/storage_access.svg +2 -0
  15. data/app/assets/javascripts/shopify_app/enable_cookies.js +3 -0
  16. data/app/assets/javascripts/shopify_app/itp_helper.js +40 -0
  17. data/app/assets/javascripts/shopify_app/partition_cookies.js +7 -0
  18. data/app/assets/javascripts/shopify_app/redirect.js +33 -0
  19. data/app/assets/javascripts/shopify_app/request_storage_access.js +3 -0
  20. data/app/assets/javascripts/shopify_app/storage_access.js +121 -0
  21. data/app/assets/javascripts/shopify_app/storage_access_redirect.js +17 -0
  22. data/app/assets/javascripts/shopify_app/top_level.js +2 -0
  23. data/app/assets/javascripts/shopify_app/top_level_interaction.js +11 -0
  24. data/app/controllers/shopify_app/authenticated_controller.rb +5 -2
  25. data/app/controllers/shopify_app/callback_controller.rb +92 -0
  26. data/app/controllers/shopify_app/sessions_controller.rb +120 -2
  27. data/app/controllers/shopify_app/webhooks_controller.rb +11 -3
  28. data/app/views/shopify_app/partials/_button_styles.html.erb +104 -0
  29. data/app/views/shopify_app/partials/_card_styles.html.erb +33 -0
  30. data/app/views/shopify_app/partials/_empty_state_styles.html.erb +129 -0
  31. data/app/views/shopify_app/partials/_layout_styles.html.erb +167 -0
  32. data/app/views/shopify_app/partials/_typography_styles.html.erb +35 -0
  33. data/app/views/shopify_app/sessions/enable_cookies.html.erb +59 -0
  34. data/app/views/shopify_app/sessions/new.html.erb +88 -60
  35. data/app/views/shopify_app/sessions/request_storage_access.html.erb +67 -0
  36. data/app/views/shopify_app/sessions/top_level_interaction.html.erb +63 -0
  37. data/app/views/shopify_app/shared/redirect.html.erb +22 -0
  38. data/config/locales/de.yml +22 -0
  39. data/config/locales/en.yml +12 -1
  40. data/config/locales/es.yml +21 -3
  41. data/config/locales/fr.yml +23 -0
  42. data/config/locales/it.yml +22 -0
  43. data/config/locales/ja.yml +17 -0
  44. data/config/locales/nl.yml +21 -0
  45. data/config/locales/pt-BR.yml +22 -0
  46. data/config/locales/zh-CN.yml +16 -0
  47. data/config/locales/zh-TW.yml +17 -0
  48. data/config/routes.rb +11 -1
  49. data/{QUICKSTART.md → docs/Quickstart.md} +26 -23
  50. data/docs/Releasing.md +18 -0
  51. data/docs/Troubleshooting.md +16 -0
  52. data/karma.conf.js +43 -0
  53. data/lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb +45 -0
  54. data/lib/generators/shopify_app/add_after_authenticate_job/templates/after_authenticate_job.rb +10 -0
  55. data/lib/generators/shopify_app/home_controller/templates/home_controller.rb +1 -0
  56. data/lib/generators/shopify_app/home_controller/templates/index.html.erb +14 -0
  57. data/lib/generators/shopify_app/home_controller/templates/shopify_app_ready_script.html.erb +1 -5
  58. data/lib/generators/shopify_app/install/install_generator.rb +10 -16
  59. data/lib/generators/shopify_app/install/templates/_flash_messages.html.erb +13 -9
  60. data/lib/generators/shopify_app/install/templates/embedded_app.html.erb +1 -1
  61. data/lib/generators/shopify_app/install/templates/shopify_app.rb +5 -3
  62. data/lib/generators/shopify_app/install/templates/shopify_provider.rb +19 -4
  63. data/lib/generators/shopify_app/rotate_shopify_token_job/rotate_shopify_token_job_generator.rb +16 -0
  64. data/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token.rake +17 -0
  65. data/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token_job.rb +42 -0
  66. data/lib/generators/shopify_app/shop_model/shop_model_generator.rb +5 -9
  67. data/lib/generators/shopify_app/shop_model/templates/db/migrate/{create_shops.rb → create_shops.erb} +1 -1
  68. data/lib/generators/shopify_app/shop_model/templates/shop.rb +0 -1
  69. data/lib/shopify_app/configuration.rb +27 -8
  70. data/lib/shopify_app/{app_proxy_verification.rb → controller_concerns/app_proxy_verification.rb} +2 -7
  71. data/lib/shopify_app/controller_concerns/embedded_app.rb +19 -0
  72. data/lib/shopify_app/controller_concerns/itp.rb +45 -0
  73. data/lib/shopify_app/controller_concerns/localization.rb +22 -0
  74. data/lib/shopify_app/controller_concerns/login_protection.rb +135 -0
  75. data/lib/shopify_app/{webhook_verification.rb → controller_concerns/webhook_verification.rb} +11 -12
  76. data/lib/shopify_app/engine.rb +10 -0
  77. data/lib/shopify_app/{scripttags_manager_job.rb → jobs/scripttags_manager_job.rb} +2 -2
  78. data/lib/shopify_app/{webhooks_manager_job.rb → jobs/webhooks_manager_job.rb} +0 -0
  79. data/lib/shopify_app/{scripttags_manager.rb → managers/scripttags_manager.rb} +24 -8
  80. data/lib/shopify_app/{webhooks_manager.rb → managers/webhooks_manager.rb} +1 -1
  81. data/lib/shopify_app/session/in_memory_session_store.rb +27 -0
  82. data/lib/shopify_app/{shopify_session_repository.rb → session/session_repository.rb} +0 -0
  83. data/lib/shopify_app/{session_storage.rb → session/session_storage.rb} +9 -0
  84. data/lib/shopify_app/utils.rb +2 -2
  85. data/lib/shopify_app/version.rb +1 -1
  86. data/lib/shopify_app.rb +21 -16
  87. data/package-lock.json +23 -0
  88. data/package.json +28 -0
  89. data/service.yml +7 -0
  90. data/shipit.rubygems.yml +2 -0
  91. data/shopify_app.gemspec +6 -5
  92. data/translation.yml +7 -0
  93. data/webpack.config.js +24 -0
  94. data/yarn.lock +4594 -0
  95. metadata +92 -35
  96. data/Gemfile.rails50 +0 -5
  97. data/Gemfile.ruby22 +0 -6
  98. data/Gemfile.ruby22.rails50 +0 -9
  99. data/RELEASING +0 -13
  100. data/lib/generators/shopify_app/install/templates/shopify_session_repository.rb +0 -23
  101. data/lib/generators/shopify_app/shop_model/templates/shopify_session_repository.rb +0 -7
  102. data/lib/shopify_app/in_memory_session_store.rb +0 -25
  103. data/lib/shopify_app/login_protection.rb +0 -103
  104. data/lib/shopify_app/sessions_concern.rb +0 -101
  105. data/lib/shopify_app/shop.rb +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 47504ce67fc91bae133ac9451f21eb46b2307f6b
4
- data.tar.gz: 1c9430ae87f14834389188ea630a43574e1d31c4
2
+ SHA256:
3
+ metadata.gz: 8fe2949f5e38db4532dbcab3c05f96e228e6285fdbb4b729ffefecd8e40b2aad
4
+ data.tar.gz: 2fefc3ce45bc58cd82c874d5217f6abfce0a70ba56cb9105084dbec011f033cb
5
5
  SHA512:
6
- metadata.gz: dce462b93f79c591d00801bf8eaedec76be7fcee1aa65184d6d2cad28480c438c92b2b4e1239382225f7782eb62bf735f941ca1c6bed166b0a016a4b7ca9d055
7
- data.tar.gz: f5e656f7f0c720daa423d20dea3bddc47439e556713d6bfa8cca030ef12617ac64bbdeedb4541dd85dc311b229231662635f1ea6994b18ed761806d18a24207a
6
+ metadata.gz: 1a435b2541e5198fad47a247a97b2a68ce6e741b2b29a4b0b7f2cc29d256fc382a7fd8a56801e982744258e9efdfd3879a13dd4dffc033c88d432ce44d525e44
7
+ data.tar.gz: 1df140b61ca82e090eba2fcabac5f079cc5d87e7cb64bab657cbc725ff1063360fbd88822d4ed76c9224d2fd4e9429ba197dd3c7f6a6312b3c8dbdb060c35f26
data/.babelrc ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "babel": {
3
+ "presets": ["shopify/web"]
4
+ }
5
+ }
@@ -0,0 +1 @@
1
+ * @shopify/platform-dev-tools-education
File without changes
@@ -0,0 +1,2 @@
1
+ enabled:
2
+ - cla
data/.gitignore CHANGED
@@ -9,3 +9,8 @@ doc/
9
9
  *.sqlite3
10
10
  test/tmp/*
11
11
  .idea
12
+ # ignore sprockets cache
13
+ /test/dummy/tmp/*
14
+ /node_modules/
15
+ .byebug_history
16
+
data/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 8.10.0
data/.rubocop.yml ADDED
@@ -0,0 +1,10 @@
1
+ inherit_from:
2
+ - https://shopify.github.io/ruby-style-guide/rubocop.yml
3
+
4
+ LineLength:
5
+ Exclude:
6
+ - test/**/*
7
+
8
+ Metrics/ClassLength:
9
+ Exclude:
10
+ - test/**/*
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.5.0
data/.travis.yml CHANGED
@@ -1,17 +1,29 @@
1
+ sudo: required
2
+ dist: trusty
3
+ addons:
4
+ chrome: stable
5
+ before_script:
6
+ - "sudo chown root /opt/google/chrome/chrome-sandbox"
7
+ - "sudo chmod 4755 /opt/google/chrome/chrome-sandbox"
1
8
  language: ruby
2
- cache: bundler
3
- sudo: false
9
+ before_install:
10
+ - gem update --system
11
+ cache:
12
+ bundler: true
13
+ directories:
14
+ - node_modules
15
+ yarn: true
4
16
 
5
17
  rvm:
6
- - 2.3.1
18
+ - 2.3.6
19
+ - 2.4.3
20
+ - 2.5.0
7
21
 
8
- gemfile:
9
- - Gemfile
10
- - Gemfile.rails50
22
+ install:
23
+ - bundle install
24
+ - nvm install node
25
+ - yarn
11
26
 
12
- matrix:
13
- include:
14
- - rvm: 2.2.2
15
- gemfile: Gemfile.ruby22
16
- - rvm: 2.2.2
17
- gemfile: Gemfile.ruby22.rails50
27
+ script:
28
+ - yarn test
29
+ - bundle exec rake test
data/CHANGELOG.md CHANGED
@@ -1,3 +1,154 @@
1
+ 8.5.0
2
+ -----
3
+ Added support for rotating Shopify access tokens:
4
+
5
+ * Added a generator shopify_app:rotate_shopify_token_job for generating the job to perform token rotation
6
+ * Extend Shopify app configuration to support a new and old secret token
7
+ * Extended webhook validation code to support validating against new and old secret tokens
8
+ * See the README for more details: https://github.com/Shopify/shopify_app#rotateshopifytokenjob
9
+
10
+ 8.4.2
11
+ -----
12
+ * Clear stale user session during auth callback
13
+
14
+ 8.4.1
15
+ -----
16
+ * Update README and Releasing.md
17
+ * Allow user agent to not be set
18
+ * Remove legacy EASDK examples
19
+ * Add .ruby-version file
20
+ * Clean up omniauth setup and fix examples
21
+ * Fix infinite redirect loops if users have disabled 3rd party cookies in their browser
22
+
23
+ 8.4.0
24
+ ----
25
+ * Fix embedded app session management in Safari 12.1
26
+ * Shop names passed to OAuth are no longer case sensitive
27
+
28
+ 8.3.2
29
+ ----
30
+ * Removes `read_orders` from the default scopes provided upon app generation
31
+
32
+ 8.3.1
33
+ ----
34
+ * Adds the ability to customize the login URL through the initializer
35
+
36
+ 8.3.0
37
+ ----
38
+ * Fix embedded app session management in Safari 12
39
+ * Add support for translation platform
40
+
41
+ 8.2.6
42
+ ----
43
+ * Sanitize the shop query param to include `.myshopify.com` if no domain was provided
44
+
45
+ 8.2.5
46
+ ----
47
+ * fix iframe headers on session controller
48
+
49
+ 8.2.4
50
+ -----
51
+ * Add CSRF protection through `protect_from_forgery with: :exception` on `ShopifyApp::AuthenticatedController`
52
+
53
+ 8.2.3
54
+ -----
55
+ * Send head :forbidden instead of :unauthorized when AppProxyVerification fails
56
+
57
+ 8.2.2
58
+ -----
59
+ * Changes how the ESDK concern allows iframes. Fixes an issue with the first request for some people
60
+
61
+ 8.2.1
62
+ -----
63
+ * Bugfix: Don't logout shops from `login_again_if_different_shop` when Rails
64
+ params for a 'Shop' model are passed in [[#477]](https://github.com/Shopify/shopify_app/pull/477)
65
+
66
+ 8.2.0
67
+ -----
68
+ Known bug: Shop logged out when submitting a form for 'Shop' objects, fixed in 8.2.1 [[See #480 for details]](https://github.com/Shopify/shopify_app/issues/480)
69
+
70
+ * Add `webhook_jobs_namespace` config option. [[#463]](https://github.com/Shopify/shopify_app/pull/463)
71
+ * Updates login page styles to match the [Polaris](https://polaris.shopify.com/) design system. [[#474]](https://github.com/Shopify/shopify_app/pull/474)
72
+
73
+ 8.1.0
74
+ -----
75
+ Known bug: Shop logged out when submitting a form for 'Shop' objects, fixed in 8.2.1 [[See #480 for details]](https://github.com/Shopify/shopify_app/issues/480)
76
+
77
+ * Add support for per_user_authentication
78
+ * Pass the shop param in the session for authentication instead of a url param (prevents csrf). If you are upgrading from an older version of the gem you will need to update your omniauth.rb initializer file. Check the example app for what it what it should look like.
79
+
80
+ 8.0.0
81
+ -----
82
+ Known bug: Shop logged out when submitting a form for 'Shop' objects, fixed in 8.2.1 [[See #480 for details]](https://github.com/Shopify/shopify_app/issues/480)
83
+
84
+ * Removed the `shopify_session_repository` initializer. The SessionRepository is now configured through the main ShopifyApp configuration object and the generated initializer
85
+ * Moved InMemorySessionStore into the ShopifyApp namespace
86
+ * Remove ShopifySession concern. This module made the code internal to this engine harder to follow and we want to discourage over-writing the auth code now that we have generic hooks for all extra tasks during install.
87
+ * Changed engine controllers to subclass ActionController::Base to avoid any possible conflict with the parent application
88
+ * Removed the `ShopifyApp::Shop` concern and added its methods to `ShopifyApp::SessionStorage`. To update for this change just remove this concern anywhere it is being used in your application.
89
+ * Add `ShopifyApp::EmbeddedApp` controller concern which handles setting the required headers for the ESDK. Previously this was done by injecting configuration into applicaton.rb which affects the entire app.
90
+ * Add webhooks to generated home controller. This should help new users debug issues.
91
+
92
+ 7.4.0
93
+ -----
94
+ Known bug: Shop logged out when submitting a form for 'Shop' objects, fixed in 8.2.1 [[See #480 for details]](https://github.com/Shopify/shopify_app/issues/480)
95
+
96
+ * Add an after_authenticate job which will be run once the shop is authenticated. [[#431]](https://github.com/Shopify/shopify_app/pull/432)
97
+
98
+ 7.3.0
99
+ -----
100
+ Known bug: Shop logged out when submitting a form for 'Shop' objects, fixed in 8.2.1 [[See #480 for details]](https://github.com/Shopify/shopify_app/issues/480)
101
+
102
+ * Bump required omniauth-shopify-oauth2 version to 1.2.0.
103
+ * Always expect params[:shop] to be a string.
104
+
105
+ 7.2.11
106
+ -----
107
+ * Remove 'Logged in' flash message [[#425]](https://github.com/Shopify/shopify_app/pull/425)
108
+
109
+ 7.2.10
110
+ -----
111
+ * Fix an issue with the create_shops generator template
112
+ [[#423]](https://github.com/Shopify/shopify_app/pull/423)
113
+
114
+ 7.2.9
115
+ -----
116
+ * Remove support for Rails 4
117
+ [[#417]](https://github.com/Shopify/shopify_app/pull/417)
118
+
119
+ 7.2.8
120
+ -----
121
+ * Add i18n locale param support
122
+ [[#409]](https://github.com/Shopify/shopify_app/pull/409)
123
+
124
+
125
+ 7.2.7
126
+ -----
127
+ * Require `shopify_app` `>= 4.3.2`. This version relaxes the ruby version requirement from `>= 2.3.0` to `>= 2.0`
128
+ * Rails 5: ActionDispatch::Reloader#to_prepare is deprecated
129
+ [[#404]](https://github.com/Shopify/shopify_app/pull/404)
130
+
131
+ 7.2.6
132
+ -----
133
+ * Update LoginProtection#fullpage_redirect_to to get shopify domain from session
134
+ [[#401]](https://github.com/Shopify/shopify_app/pull/401)
135
+
136
+ 7.2.5
137
+ -----
138
+ * Update LoginProtection.redirection_javascript to work with absolute URLS
139
+ [[#389]](https://github.com/Shopify/shopify_app/pull/389)
140
+
141
+ 7.2.4
142
+ -----
143
+ * Fix redirect issue by sanitizing shop name on sessions#new
144
+
145
+ 7.2.3
146
+ -----
147
+ * Use postMessage to redirect parent iframe during authentication [[#366]](https://github.com/Shopify/shopify_app/pull/366)
148
+ * Add support for dynamically generating scripttag URLs
149
+ * Bug-fix: Update scripttags_manager_job
150
+ * Bug-fix: `--application_name` and `--scope` generates proper Configuration even when options supplied to them contain whitespaces.
151
+
1
152
  7.2.0
2
153
  -----
3
154
  * Disable application layout rendering for the `/login` page
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in shopify_app.gemspec
4
4
  gemspec
5
+
6
+ gem 'rails-controller-testing', group: :test