Skip to content

Commit 10a3243

Browse files
authored
Merge pull request #22 from Kyon147/support/update_app_bridge_to_only_use_host
Remove the `shopOrigin` from the appBridge
2 parents 1c236c1 + a2eb5d6 commit 10a3243

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/resources/views/layouts/default.blade.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
var createApp = AppBridge.default;
3232
var app = createApp({
3333
apiKey: "{{ \Osiset\ShopifyApp\Util::getShopifyConfig('api_key', $shopDomain ?? Auth::user()->name ) }}",
34-
shopOrigin: "{{ $shopDomain ?? Auth::user()->name }}",
3534
host: "{{ \Request::get('host') }}",
3635
forceRedirect: true,
3736
});

tests/Traits/HomeControllerTest.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,21 @@ public function testHomeRoute(): void
2424
{
2525
$shop = factory($this->model)->create(['name' => 'shop-name.myshopify.com']);
2626

27-
$this->call('get', '/', ['token' => $this->buildToken()])
27+
$host = base64_encode($shop->getDomain()->toNative().'/admin');
28+
$this->call('get', '/', ['token' => $this->buildToken(), 'host' => $host])
2829
->assertOk()
2930
->assertSee('apiKey: "'.Util::getShopifyConfig('api_key').'"', false)
30-
->assertSee("shopOrigin: \"{$shop->name}\"", false);
31+
->assertSee("host: \"{$host}\"", false);
32+
}
33+
34+
public function testHomeRouteHostAdmin(): void
35+
{
36+
$shop = factory($this->model)->create(['name' => 'shop-name.myshopify.com']);
37+
38+
$host = base64_encode('admin.shopify.com/store/shop-name');
39+
$this->call('get', '/', ['token' => $this->buildToken(), 'host' => $host])
40+
->assertOk()
41+
->assertSee('apiKey: "'.Util::getShopifyConfig('api_key').'"', false)
42+
->assertSee("host: \"{$host}\"", false);
3143
}
3244
}

0 commit comments

Comments
 (0)