lthn.io/app/Website/Explorer/Boot.php
Claude 4f72d62146
feat: Octane domain middleware + fix catch-all route conflicts
DomainScope middleware checks Host header per-request — Octane-safe.
Applied to Api homepage (scoped to api.lthn.io). Explorer and Docs
subdomain routes stay disabled — catch-all routes like /{section}/{page?}
match before middleware runs, breaking other routes. These modules
need own containers for proper domain isolation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 11:31:19 +01:00

46 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace Website\Explorer;
use Core\Events\DomainResolving;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\ServiceProvider;
/**
* explorer.lthn.io — block explorer subdomain.
*
* Root-level routes disabled to prevent conflict with Lethean homepage.
* Mod/Explorer handles /explorer prefix on lthn.io.
* When deployed to its own container, re-enable routes with domain middleware.
*/
class Boot extends ServiceProvider
{
public static array $domains = [
'/^explorer\.lthn\.io$/',
];
public static array $listens = [
DomainResolving::class => 'onDomain',
];
public function register(): void {}
public function boot(): void
{
foreach (static::$listens as $event => $method) {
Event::listen($event, [$this, $method]);
}
}
public function onDomain(DomainResolving $event): void
{
foreach (static::$domains as $pattern) {
if (preg_match($pattern, $event->domain)) {
$event->resolve($this);
return;
}
}
}
}