Skip to content

Commit

Permalink
Support subdomain
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofandel authored and ifox committed Oct 14, 2024
1 parent a06a045 commit 6849704
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ If you are relying on Quill.js specifics (like css classes), use `'type' => 'qui
Previously `withVideo` was true by default, if you relied on this you have to update these media fields to
`'withVideo' => true`.

#### SVG's are now no longer passing thorough glide
#### SVG's are now no longer passing through glide

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

Expand Down
12 changes: 9 additions & 3 deletions src/TwillRoutes.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Str;

use function request;

class TwillRoutes
{
/**
Expand Down Expand Up @@ -405,10 +407,14 @@ public function getAuthRedirectPath(): string

public function isTwillRequest(): bool
{
$adminAppUrl = config('twill.admin_app_url', config('app.url'));
$adminAppUrl = str_replace(['http://', 'https://'], '', config('twill.admin_app_url', config('app.url')));
$requestHost = request()->getHttpHost();

$matchesDomain = config('twill.support_subdomain_admin_routing') ?
Str::startsWith($requestHost, config('twill.admin_app_subdomain', 'admin') . '.') && Str::endsWith($requestHost, '.' . $adminAppUrl)
: !config('twill.admin_app_strict') || $requestHost === $adminAppUrl;

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

return $matchesDomain && $matchesPath;
}
Expand Down

0 comments on commit 6849704

Please sign in to comment.