diff --git a/app/Website/Names/Boot.php b/app/Website/Names/Boot.php index e40fcb8..990d004 100644 --- a/app/Website/Names/Boot.php +++ b/app/Website/Names/Boot.php @@ -13,12 +13,13 @@ use Illuminate\Support\ServiceProvider; /** * .lthn TLD registrar website. * - * Serves names.lthn.io (prod) or /names path on lthn.io. + * On names.lthn.io: serves at root. On lthn.io: Mod/Names handles /names prefix. */ class Boot extends ServiceProvider { public static array $domains = [ '/^names\.lthn\.io$/', + '/^names\.(test|localhost)$/', ]; public static array $listens = [ @@ -30,8 +31,6 @@ class Boot extends ServiceProvider public function boot(): void { - $this->loadViewsFrom(__DIR__ . '/Views', 'names'); - foreach (static::$listens as $event => $method) { Event::listen($event, [$this, $method]); } @@ -47,8 +46,15 @@ class Boot extends ServiceProvider } } - public function onWebRoutes(): void + public function onWebRoutes(WebRoutesRegistering $event): void { - Route::prefix('names')->group(__DIR__ . '/Routes/web.php'); + $host = $_SERVER['HTTP_HOST'] ?? ''; + + foreach (static::$domains as $pattern) { + if (preg_match($pattern, $host)) { + $event->routes(fn () => Route::group([], __DIR__ . '/Routes/web.php')); + return; + } + } } } diff --git a/app/Website/Pool/Boot.php b/app/Website/Pool/Boot.php index dae5066..690a1d5 100644 --- a/app/Website/Pool/Boot.php +++ b/app/Website/Pool/Boot.php @@ -11,14 +11,15 @@ use Illuminate\Support\Facades\Route; use Illuminate\Support\ServiceProvider; /** - * Mining pool dashboard website. + * Mining pool dashboard. * - * Serves pool.lthn.io (prod) or /pool path on lthn.io. + * On pool.lthn.io: serves at root. On lthn.io: Mod/Pool handles /pool prefix. */ class Boot extends ServiceProvider { public static array $domains = [ '/^pool\.lthn\.io$/', + '/^pool\.(test|localhost)$/', ]; public static array $listens = [ @@ -30,8 +31,6 @@ class Boot extends ServiceProvider public function boot(): void { - $this->loadViewsFrom(__DIR__ . '/Views', 'pool'); - foreach (static::$listens as $event => $method) { Event::listen($event, [$this, $method]); } @@ -47,8 +46,15 @@ class Boot extends ServiceProvider } } - public function onWebRoutes(): void + public function onWebRoutes(WebRoutesRegistering $event): void { - Route::prefix('pool')->group(__DIR__ . '/Routes/web.php'); + $host = $_SERVER['HTTP_HOST'] ?? ''; + + foreach (static::$domains as $pattern) { + if (preg_match($pattern, $host)) { + $event->routes(fn () => Route::group([], __DIR__ . '/Routes/web.php')); + return; + } + } } } diff --git a/app/Website/Trade/Boot.php b/app/Website/Trade/Boot.php index f8e206a..8405ef4 100644 --- a/app/Website/Trade/Boot.php +++ b/app/Website/Trade/Boot.php @@ -13,12 +13,13 @@ use Illuminate\Support\ServiceProvider; /** * DEX trade website. * - * Serves trade.lthn.io (prod) or /trade path on lthn.io. + * On trade.lthn.io: serves at root. On lthn.io: Mod/Trade handles /trade prefix. */ class Boot extends ServiceProvider { public static array $domains = [ '/^trade\.lthn\.io$/', + '/^trade\.(test|localhost)$/', ]; public static array $listens = [ @@ -30,8 +31,6 @@ class Boot extends ServiceProvider public function boot(): void { - $this->loadViewsFrom(__DIR__ . '/Views', 'trade'); - foreach (static::$listens as $event => $method) { Event::listen($event, [$this, $method]); } @@ -47,8 +46,15 @@ class Boot extends ServiceProvider } } - public function onWebRoutes(): void + public function onWebRoutes(WebRoutesRegistering $event): void { - Route::prefix('trade')->group(__DIR__ . '/Routes/web.php'); + $host = $_SERVER['HTTP_HOST'] ?? ''; + + foreach (static::$domains as $pattern) { + if (preg_match($pattern, $host)) { + $event->routes(fn () => Route::group([], __DIR__ . '/Routes/web.php')); + return; + } + } } }