diff --git a/web/Gemfile b/web/Gemfile index e2b73fa..4bd253b 100644 --- a/web/Gemfile +++ b/web/Gemfile @@ -75,4 +75,4 @@ group :test do gem "webdrivers" end -gem "shopify_app", "~> 19.0" +gem "shopify_app", "~> 20.1" diff --git a/web/app/controllers/home_controller.rb b/web/app/controllers/home_controller.rb index 6302406..b0708fe 100644 --- a/web/app/controllers/home_controller.rb +++ b/web/app/controllers/home_controller.rb @@ -9,8 +9,12 @@ class HomeController < ApplicationController PROD_INDEX_PATH = Rails.public_path.join("dist") def index - contents = File.read(File.join(Rails.env.production? ? PROD_INDEX_PATH : DEV_INDEX_PATH, "index.html")) + if ShopifyAPI::Context.embedded? && !params[:embedded].present? || params[:embedded] != "1" + redirect_to(ShopifyAPI::Auth.embedded_app_url(params[:host]), allow_other_host: true) + else + contents = File.read(File.join(Rails.env.production? ? PROD_INDEX_PATH : DEV_INDEX_PATH, "index.html")) - render(plain: contents, content_type: "text/html", layout: false) + render(plain: contents, content_type: "text/html", layout: false) + end end end diff --git a/web/app/services/application_service.rb b/web/app/services/application_service.rb index 1e34e5d..0a22aaf 100644 --- a/web/app/services/application_service.rb +++ b/web/app/services/application_service.rb @@ -1,7 +1,9 @@ # frozen_string_literal: true class ApplicationService - def self.call(*args, **kwargs, &block) - new(*args, **kwargs, &block).call + class << self + def call(*args, **kwargs, &block) + new(*args, **kwargs, &block).call + end end end diff --git a/web/config/initializers/shopify_app.rb b/web/config/initializers/shopify_app.rb index 80f2917..04ab787 100644 --- a/web/config/initializers/shopify_app.rb +++ b/web/config/initializers/shopify_app.rb @@ -20,6 +20,7 @@ config.root_url = "/api" config.login_url = "/api/auth" config.login_callback_url = "/api/auth/callback" + config.embedded_redirect_url = "/ExitIframe" # You may want to charge merchants for using your app. Setting the billing configuration will cause the Authenticated # controller concern to check that the session is for a merchant that has an active one-time payment or subscription. diff --git a/web/frontend b/web/frontend index 9d2caa0..1b54ce0 160000 --- a/web/frontend +++ b/web/frontend @@ -1 +1 @@ -Subproject commit 9d2caa0c416037cfbf38824169f0f06b350372c7 +Subproject commit 1b54ce0884a4fa629be3ab6fa782751da46b8d9a