An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
refactor(terminal-access): streamline resource retrieval and enhance terminal access messaging in UI
Andras Bacsai9d719009529a
diff --git a/app/Livewire/Project/Shared/ExecuteContainerCommand.php b/app/Livewire/Project/Shared/ExecuteContainerCommand.phpindex 3c2323206c..ce6314d634 100644--- a/app/Livewire/Project/Shared/ExecuteContainerCommand.php+++ b/app/Livewire/Project/Shared/ExecuteContainerCommand.php@@ -55,7 +55,7 @@ class ExecuteContainerCommand extends Component$this->servers = collect();if (data_get($this->parameters, 'application_uuid')) {$this->type = 'application';- $this->resource = Application::where('uuid', $this->parameters['application_uuid'])->firstOrFail();+ $this->resource = Application::whereUuid($this->parameters['application_uuid'])->firstOrFail();if ($this->resource->destination->server->isFunctional() && $this->resource->destination->server->isTerminalEnabled()) {$this->servers = $this->servers->push($this->resource->destination->server);}@@ -78,14 +78,14 @@ class ExecuteContainerCommand extends Component$this->loadContainers();} elseif (data_get($this->parameters, 'service_uuid')) {$this->type = 'service';- $this->resource = Service::where('uuid', $this->parameters['service_uuid'])->firstOrFail();+ $this->resource = Service::whereUuid($this->parameters['service_uuid'])->firstOrFail();if ($this->resource->server->isFunctional() && $this->resource->server->isTerminalEnabled()) {$this->servers = $this->servers->push($this->resource->server);}$this->loadContainers();} elseif (data_get($this->parameters, 'server_uuid')) {$this->type = 'server';- $this->resource = Server::where('uuid', $this->parameters['server_uuid'])->firstOrFail();+ $this->resource = Server::ownedByCurrentTeam()->whereUuid($this->parameters['server_uuid'])->firstOrFail();$this->server = $this->resource;}}@@ -175,6 +175,9 @@ class ExecuteContainerCommand extends Componentif ($this->server->isForceDisabled()) {throw new \RuntimeException('Server is disabled.');}+ if (! $this->server->isTerminalEnabled()) {+ throw new \RuntimeException('Terminal access is disabled on this server.');+ }$this->hasShell = true;$this->dispatch('send-terminal-command',diff --git a/resources/views/livewire/project/shared/execute-container-command.blade.php b/resources/views/livewire/project/shared/execute-container-command.blade.phpindex 3625c43181..f007c3cbb8 100644--- a/resources/views/livewire/project/shared/execute-container-command.blade.php+++ b/resources/views/livewire/project/shared/execute-container-command.blade.php@@ -35,13 +35,17 @@</div>@else@if ($type === 'server')- <form class="w-full" wire:submit="$dispatchSelf('connectToServer')"- wire:init="$dispatchSelf('connectToServer')">- <x-forms.button class="w-full" type="submit">Reconnect</x-forms.button>- </form>- <div class="mx-auto w-full">- <livewire:project.shared.terminal />- </div>+ @if ($server->isTerminalEnabled())+ <form class="w-full" wire:submit="$dispatchSelf('connectToServer')"+ wire:init="$dispatchSelf('connectToServer')">+ <x-forms.button class="w-full" type="submit">Reconnect</x-forms.button>+ </form>+ <div class="mx-auto w-full">+ <livewire:project.shared.terminal />+ </div>+ @else+ <div>Terminal access is disabled on this server.</div>+ @endif@else@if (count($containers) === 0)<div class="pt-4">No containers are running on this server or terminal access is disabled.</div>