Skip to content

Commit f76d55f

Browse files
committed
Support subdomain
1 parent 01799fc commit f76d55f

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

UPGRADE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ If you are relying on Quill.js specifics (like css classes), use `'type' => 'qui
5252
Previously `withVideo` was true by default, if you relied on this you have to update these media fields to
5353
`'withVideo' => true`.
5454

55-
#### SVG's are now no longer passing thorough glide
55+
#### SVG's are now no longer passing through glide
5656

5757
These are now rendered directly, you can change this by updating config `twill.glide.original_media_for_extensions` to an empty array `[]`
5858

src/TwillRoutes.php

+9-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
use Illuminate\Support\Facades\Route;
1010
use Illuminate\Support\Str;
1111

12+
use function request;
13+
1214
class TwillRoutes
1315
{
1416
/**
@@ -405,10 +407,14 @@ public function getAuthRedirectPath(): string
405407

406408
public function isTwillRequest(): bool
407409
{
408-
$adminAppUrl = config('twill.admin_app_url', config('app.url'));
410+
$adminAppUrl = str_replace(['http://', 'https://'], '', config('twill.admin_app_url', config('app.url')));
411+
$requestHost = request()->getHttpHost();
412+
413+
$matchesDomain = config('twill.support_subdomain_admin_routing') ?
414+
Str::startsWith($requestHost, config('twill.admin_app_subdomain', 'admin') . '.') && Str::endsWith($requestHost, '.' . $adminAppUrl)
415+
: !config('twill.admin_app_strict') || $requestHost === $adminAppUrl;
409416

410-
$matchesDomain = !config('twill.admin_app_strict') || Str::endsWith(\request()->getSchemeAndHttpHost(), $adminAppUrl);
411-
$matchesPath = empty(config('twill.admin_app_path')) || \request()->is(config('twill.admin_app_path', '') . '*');
417+
$matchesPath = empty(config('twill.admin_app_path')) || request()->is(config('twill.admin_app_path', '') . '*');
412418

413419
return $matchesDomain && $matchesPath;
414420
}

0 commit comments

Comments
 (0)