From 7e5ca3dce4e1f5b870cf20f5a7041469bd4a24ed Mon Sep 17 00:00:00 2001 From: isaacclad Date: Fri, 26 Jun 2026 20:17:17 +0000 Subject: [PATCH] Surface connected domains in Ladill Domains' My Domains Push the customer's connected domain to the central connected-domains registry so it appears under My Domains (with Transfer in if not registered with Ladill). Co-Authored-By: Claude Opus 4.8 --- app/Jobs/ProvisionHostingSslJob.php | 10 ++++++++++ app/Services/Ssl/CentralSslRegistry.php | 22 ++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/app/Jobs/ProvisionHostingSslJob.php b/app/Jobs/ProvisionHostingSslJob.php index e305be3..61cf610 100644 --- a/app/Jobs/ProvisionHostingSslJob.php +++ b/app/Jobs/ProvisionHostingSslJob.php @@ -56,6 +56,16 @@ class ProvisionHostingSslJob implements ShouldQueue $site->update(['ssl_status' => 'provisioning']); + // Surface this site's domain in Ladill Domains' "My Domains" (best-effort, + // independent of SSL outcome). + if ($account->user?->public_id) { + app(\App\Services\Ssl\CentralSslRegistry::class)->registerConnectedDomain( + $site->domain, + (string) $account->user->public_id, + 'Hosting: '.$site->domain, + ); + } + try { $provider->requestLetsEncryptCertificate($site); diff --git a/app/Services/Ssl/CentralSslRegistry.php b/app/Services/Ssl/CentralSslRegistry.php index d72fb40..2627f3b 100644 --- a/app/Services/Ssl/CentralSslRegistry.php +++ b/app/Services/Ssl/CentralSslRegistry.php @@ -31,4 +31,26 @@ class CentralSslRegistry Log::info('CentralSslRegistry: register skipped', ['host' => $host, 'error' => $e->getMessage()]); } } + + /** Surface a hosted-site domain in Ladill Domains' "My Domains" (best-effort). */ + public function registerConnectedDomain(string $host, string $ownerPublicId, ?string $label = null, ?string $linkUrl = null): void + { + $url = rtrim((string) config('domains.api_url'), '/'); + $key = (string) config('domains.api_key'); + if ($url === '' || $key === '' || $host === '' || $ownerPublicId === '') { + return; + } + + try { + Http::withToken($key)->acceptJson()->timeout(10) + ->post($url.'/connected-domains', array_filter([ + 'host' => $host, + 'owner_public_id' => $ownerPublicId, + 'label' => $label, + 'link_url' => $linkUrl, + ])); + } catch (\Throwable $e) { + Log::info('CentralSslRegistry: connected register skipped', ['host' => $host, 'error' => $e->getMessage()]); + } + } }