shopify-cli 2.15.5 → 2.15.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: acc8ad7231574d322ab00d0f5223bbd270689a8251e4574329fc58ae001ddd76
4
- data.tar.gz: 98ea2d3cb974a4cc33593bde1af7052807c1dcb31cb26246a3d65eec0a7fb074
3
+ metadata.gz: 756d40b258dafcaa9e3fd02305cbc3eb4bc1416b5711f22543c9b6221c4bd888
4
+ data.tar.gz: 476eea5325f671f2e3a1337700356f895792c1e4b2568dc56e38c58b4d1e93d5
5
5
  SHA512:
6
- metadata.gz: 33d4f4d824d79a8f5c2d6238e481985f4f9539b44c0a2d5666f55675fc320a0c30b0d1f058a3016a496a193151a296dd0351ea6d682aefba5394af90f5fb8ad9
7
- data.tar.gz: a382ec37c557103b3d8ec5b939d90e9184355e184fdeaeee665c86d987c25fb695b8e7044c71f62f73620a4745119c7da84f3ad23c2bc1488dea78bed58b74f0
6
+ metadata.gz: 11bee20d53a3809978a2cf37a7f4ed3e759f0edd7d53ac8ec9e08dad76c1bd3ed8fcbf66262dc686d7bf929fec256685189facaf1255c2f51c2f566757b7ae29
7
+ data.tar.gz: 8cb0d2cb3d2edf801f752b74ed8534816180e257d3a1afef8fb0b13ffa5a3a85388bd6bb71df04d0c42bf450cedd1008e473f36cf48722435eea912645dcb1e9
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## Version 2.15.6 - 2022-04-12
6
+
7
+ ### Fixed
8
+ * [#2246](https://github.com/Shopify/shopify-cli/pull/2246): Fix callback urls for app serve
9
+
5
10
  ## Version 2.15.5 - 2022-04-08
6
11
 
7
12
  ### Fixed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify-cli (2.15.5)
4
+ shopify-cli (2.15.6)
5
5
  bugsnag (~> 6.22)
6
6
  listen (~> 3.7.0)
7
7
  theme-check (~> 1.10.1)
@@ -36,7 +36,7 @@ module ShopifyCLI
36
36
  ShopifyCLI::Tasks::UpdateDashboardURLS.call(
37
37
  context,
38
38
  url: project.env.host,
39
- callback_url: "/auth/shopify/callback",
39
+ callback_urls: %w(/auth/shopify/callback /auth/callback),
40
40
  )
41
41
  end
42
42
 
@@ -1,18 +1,21 @@
1
+ require "set"
2
+
1
3
  module ShopifyCLI
2
4
  module Tasks
3
5
  class UpdateDashboardURLS < ShopifyCLI::Task
4
6
  NGROK_REGEX = /https:\/\/([a-z0-9\-]+\.ngrok\.io)(.*)/
5
7
 
6
- def call(ctx, url:, callback_url:)
8
+ def call(ctx, url:, callback_urls:)
7
9
  @ctx = ctx
8
10
  project = ShopifyCLI::Project.current
9
11
  api_key = project.env.api_key
10
12
  result = ShopifyCLI::PartnersAPI.query(ctx, "get_app_urls", apiKey: api_key)
11
13
  app = result["data"]["app"]
12
14
 
13
- return if app["applicationUrl"].match(url)
15
+ constructed_urls = construct_redirect_urls(app["redirectUrlWhitelist"], url, callback_urls)
16
+
17
+ return if already_updated(app, constructed_urls, url)
14
18
 
15
- constructed_urls = construct_redirect_urls(app["redirectUrlWhitelist"], url, callback_url)
16
19
  ShopifyCLI::PartnersAPI.query(@ctx, "update_dashboard_urls", input: {
17
20
  applicationUrl: url,
18
21
  redirectUrlWhitelist: constructed_urls,
@@ -25,7 +28,7 @@ module ShopifyCLI
25
28
  raise
26
29
  end
27
30
 
28
- def construct_redirect_urls(urls, new_url, callback_url)
31
+ def construct_redirect_urls(urls, new_url, callback_urls)
29
32
  new_urls = urls.map do |url|
30
33
  if (match = url.match(NGROK_REGEX))
31
34
  "#{new_url}#{match[2]}"
@@ -33,11 +36,22 @@ module ShopifyCLI
33
36
  url
34
37
  end
35
38
  end
36
- if new_urls.grep(/#{new_url}#{callback_url}/).empty?
37
- new_urls.push("#{new_url}#{callback_url}")
39
+ callback_urls.each do |callback_url|
40
+ if new_urls.grep(/#{new_url}#{callback_url}/).empty?
41
+ new_urls.push("#{new_url}#{callback_url}")
42
+ end
38
43
  end
39
44
  new_urls.uniq
40
45
  end
46
+
47
+ private
48
+
49
+ def already_updated(app, new_redirect_urls, new_url)
50
+ current_url = app["applicationUrl"]
51
+ current_redirect_urls = app["redirectUrlWhitelist"]
52
+ current_url.match(new_url) &&
53
+ Set.new(current_redirect_urls) == Set.new(new_redirect_urls)
54
+ end
41
55
  end
42
56
  end
43
57
  end
@@ -44,7 +44,7 @@ module ShopifyCLI
44
44
 
45
45
  def serve_file(path_info)
46
46
  path = @theme.root.join(path_info[1..-1])
47
- if path.file? && path.readable?
47
+ if path.file? && path.readable? && @theme.theme_file?(path)
48
48
  [
49
49
  200,
50
50
  {
@@ -1,3 +1,3 @@
1
1
  module ShopifyCLI
2
- VERSION = "2.15.5"
2
+ VERSION = "2.15.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.15.5
4
+ version: 2.15.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-08 00:00:00.000000000 Z
11
+ date: 2022-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler