mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-14 16:17:10 +00:00
fix(domains): preserve ports in split URL inputs (#11328)
This commit is contained in:
1 parent
5872cc095c
commit
282227b238
17 files changed
+182
-161
No files matched your search
@@ -6,6 +6,7 @@ use App\Livewire\Concerns\InteractsWithCloudflareDomainConnect;
|
||||
use App\Livewire\Project\Shared\ConfigurationChecker;
|
||||
use App\Models\Application;
|
||||
use App\Models\Server;
|
||||
use App\Support\DomainUrlParts;
|
||||
use App\Support\ValidationPatterns;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Support\Collection;
|
||||
@@ -35,12 +36,20 @@ class Domains extends Component
|
||||
|
||||
public string $newDomain = '';
|
||||
|
||||
public array $newDomainParts = ['scheme' => 'https', 'host' => '', 'port' => '', 'path' => ''];
|
||||
|
||||
public bool $newDomainPartsChanged = false;
|
||||
|
||||
public ?string $newDomainService = null;
|
||||
|
||||
public ?int $editingIndex = null;
|
||||
|
||||
public string $editingDomain = '';
|
||||
|
||||
public array $editingDomainParts = ['scheme' => 'https', 'host' => '', 'port' => '', 'path' => ''];
|
||||
|
||||
public bool $editingDomainPartsChanged = false;
|
||||
|
||||
public ?string $editingService = null;
|
||||
|
||||
/** @var array<int, array{url: string, service: ?string, dns_status: string, dns_message: string, expected_ip: ?string, checked_at?: ?string, is_suggested?: bool, suggested_for?: ?string, suggestion_label?: ?string, needs_force_add?: bool}> */
|
||||
@@ -662,6 +671,12 @@ class Domains extends Component
|
||||
$this->resetAddDomainDnsGate();
|
||||
}
|
||||
|
||||
public function updatedNewDomainParts(): void
|
||||
{
|
||||
$this->newDomainPartsChanged = true;
|
||||
$this->resetAddDomainDnsGate();
|
||||
}
|
||||
|
||||
public function updatedNewDomainService(): void
|
||||
{
|
||||
$this->resetAddDomainDnsGate();
|
||||
@@ -677,6 +692,8 @@ class Domains extends Component
|
||||
public function resetAddDomainForm(): void
|
||||
{
|
||||
$this->newDomain = '';
|
||||
$this->newDomainParts = DomainUrlParts::empty();
|
||||
$this->newDomainPartsChanged = false;
|
||||
$this->resetAddDomainDnsGate();
|
||||
$this->resetErrorBag('newDomain');
|
||||
}
|
||||
@@ -743,6 +760,9 @@ class Domains extends Component
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->newDomainPartsChanged) {
|
||||
$this->newDomain = DomainUrlParts::compose(...$this->newDomainParts);
|
||||
}
|
||||
$this->validateOnly('newDomain');
|
||||
|
||||
$normalized = ValidationPatterns::normalizeApplicationDomains($this->newDomain);
|
||||
@@ -893,6 +913,12 @@ class Domains extends Component
|
||||
$this->resetEditDomainDnsGate();
|
||||
}
|
||||
|
||||
public function updatedEditingDomainParts(): void
|
||||
{
|
||||
$this->editingDomainPartsChanged = true;
|
||||
$this->resetEditDomainDnsGate();
|
||||
}
|
||||
|
||||
public function resetEditDomainDnsGate(): void
|
||||
{
|
||||
$this->editDomainDnsFailed = false;
|
||||
@@ -908,10 +934,13 @@ class Domains extends Component
|
||||
|
||||
$this->editingIndex = $index;
|
||||
$this->editingDomain = $this->domainRows[$index]['url'];
|
||||
$this->editingDomainParts = DomainUrlParts::split($this->editingDomain);
|
||||
$this->editingDomainPartsChanged = false;
|
||||
$this->editingService = $this->domainRows[$index]['service'];
|
||||
$this->resetEditDomainDnsGate();
|
||||
$this->resetErrorBag('editingDomain');
|
||||
$this->showEditDomainModal = true;
|
||||
$this->dispatch('open-edit-domain');
|
||||
}
|
||||
|
||||
public function addSuggestedDomain(int $index): void
|
||||
@@ -990,6 +1019,8 @@ class Domains extends Component
|
||||
$this->showEditDomainModal = false;
|
||||
$this->editingIndex = null;
|
||||
$this->editingDomain = '';
|
||||
$this->editingDomainParts = DomainUrlParts::empty();
|
||||
$this->editingDomainPartsChanged = false;
|
||||
$this->editingService = null;
|
||||
$this->resetEditDomainDnsGate();
|
||||
$this->resetErrorBag('editingDomain');
|
||||
@@ -1021,6 +1052,9 @@ class Domains extends Component
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->editingDomainPartsChanged) {
|
||||
$this->editingDomain = DomainUrlParts::compose(...$this->editingDomainParts);
|
||||
}
|
||||
$this->validateOnly('editingDomain');
|
||||
|
||||
$normalized = ValidationPatterns::normalizeApplicationDomains($this->editingDomain);
|
||||
|
||||
@@ -43,10 +43,18 @@ class Domains extends Component
|
||||
|
||||
public string $newDomain = '';
|
||||
|
||||
public array $newDomainParts = ['scheme' => 'https', 'host' => '', 'port' => '', 'path' => ''];
|
||||
|
||||
public bool $newDomainPartsChanged = false;
|
||||
|
||||
public ?int $editingIndex = null;
|
||||
|
||||
public string $editingDomain = '';
|
||||
|
||||
public array $editingDomainParts = ['scheme' => 'https', 'host' => '', 'port' => '', 'path' => ''];
|
||||
|
||||
public bool $editingDomainPartsChanged = false;
|
||||
|
||||
public ?int $editingServiceApplicationId = null;
|
||||
|
||||
public bool $showEditDomainModal = false;
|
||||
@@ -515,6 +523,12 @@ class Domains extends Component
|
||||
$this->forceSaveDns = false;
|
||||
}
|
||||
|
||||
public function updatedNewDomainParts(): void
|
||||
{
|
||||
$this->newDomainPartsChanged = true;
|
||||
$this->resetAddDomainDnsGate();
|
||||
}
|
||||
|
||||
public function updatedEditingDomain(): void
|
||||
{
|
||||
$this->editDomainDnsFailed = false;
|
||||
@@ -522,6 +536,12 @@ class Domains extends Component
|
||||
$this->forceSaveEditDns = false;
|
||||
}
|
||||
|
||||
public function updatedEditingDomainParts(): void
|
||||
{
|
||||
$this->editingDomainPartsChanged = true;
|
||||
$this->updatedEditingDomain();
|
||||
}
|
||||
|
||||
public function confirmAddDomainDespiteDns(): void
|
||||
{
|
||||
$this->forceSaveDns = true;
|
||||
@@ -842,6 +862,9 @@ class Domains extends Component
|
||||
{
|
||||
try {
|
||||
$this->authorize('update', $this->service);
|
||||
if ($this->newDomainPartsChanged) {
|
||||
$this->newDomain = DomainUrlParts::compose(...$this->newDomainParts);
|
||||
}
|
||||
$this->validateOnly('newDomain');
|
||||
|
||||
$app = $this->findServiceApp($this->newServiceApplicationId);
|
||||
@@ -893,6 +916,8 @@ class Domains extends Component
|
||||
}
|
||||
|
||||
$this->newDomain = '';
|
||||
$this->newDomainParts = DomainUrlParts::empty();
|
||||
$this->newDomainPartsChanged = false;
|
||||
$this->addDomainDnsFailed = false;
|
||||
$this->addDomainDnsMessage = '';
|
||||
$this->forceSaveDns = false;
|
||||
@@ -916,12 +941,15 @@ class Domains extends Component
|
||||
|
||||
$this->editingIndex = $index;
|
||||
$this->editingDomain = $this->domainRows[$index]['url'];
|
||||
$this->editingDomainParts = DomainUrlParts::split($this->editingDomain);
|
||||
$this->editingDomainPartsChanged = false;
|
||||
$this->editingServiceApplicationId = (int) $this->domainRows[$index]['service_application_id'];
|
||||
$this->editDomainDnsFailed = false;
|
||||
$this->editDomainDnsMessage = '';
|
||||
$this->forceSaveEditDns = false;
|
||||
$this->resetErrorBag('editingDomain');
|
||||
$this->showEditDomainModal = true;
|
||||
$this->dispatch('open-edit-domain');
|
||||
}
|
||||
|
||||
public function cancelEdit(): void
|
||||
@@ -929,6 +957,8 @@ class Domains extends Component
|
||||
$this->showEditDomainModal = false;
|
||||
$this->editingIndex = null;
|
||||
$this->editingDomain = '';
|
||||
$this->editingDomainParts = DomainUrlParts::empty();
|
||||
$this->editingDomainPartsChanged = false;
|
||||
$this->editingServiceApplicationId = null;
|
||||
$this->editDomainDnsFailed = false;
|
||||
$this->editDomainDnsMessage = '';
|
||||
@@ -945,6 +975,9 @@ class Domains extends Component
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->editingDomainPartsChanged) {
|
||||
$this->editingDomain = DomainUrlParts::compose(...$this->editingDomainParts);
|
||||
}
|
||||
$this->validateOnly('editingDomain');
|
||||
|
||||
$app = $this->findServiceApp($this->editingServiceApplicationId);
|
||||
@@ -1130,6 +1163,8 @@ class Domains extends Component
|
||||
}
|
||||
|
||||
$this->newDomain = $domain;
|
||||
$this->newDomainParts = DomainUrlParts::split($domain);
|
||||
$this->newDomainPartsChanged = true;
|
||||
$this->updatedNewDomain();
|
||||
} catch (\Throwable $e) {
|
||||
handleError($e, $this);
|
||||
|
||||
Reference in new issue
Block a user