Skip to content

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.

fix(terminal): distinguish application containers across servers

peaklabs-devd25edb85515d
diff --git a/app/Livewire/Project/Shared/ExecuteContainerCommand.php b/app/Livewire/Project/Shared/ExecuteContainerCommand.php
index aa26071020..e8202b8547 100644
--- a/app/Livewire/Project/Shared/ExecuteContainerCommand.php
+++ b/app/Livewire/Project/Shared/ExecuteContainerCommand.php
@@ -151,13 +151,18 @@ class ExecuteContainerCommand extends Component
});
if ($this->containers->count() === 1) {
- $this->selected_container = data_get($this->containers->first(), 'container.Names');
+ $this->selected_container = $this->containerTarget($this->containers->first());
$this->connectToContainer();
}
$this->containersLoaded = true;
}
+ private function containerTarget(array $container): string
+ {
+ return data_get($container, 'server.uuid').':'.data_get($container, 'container.Names');
+ }
+
public function updatedSelectedContainer()
{
if ($this->selected_container !== 'default') {
@@ -202,12 +207,12 @@ class ExecuteContainerCommand extends Component
try {
$this->authorize('canAccessTerminal');
// Validate container name format
- if (! ValidationPatterns::isValidContainerName($this->selected_container)) {
+ if (! ValidationPatterns::isValidContainerName(str($this->selected_container)->after(':')->value())) {
throw new \InvalidArgumentException('Invalid container name format');
}
// Verify container exists in our allowed list
- $container = collect($this->containers)->firstWhere('container.Names', $this->selected_container);
+ $container = $this->containers->first(fn ($candidate) => $this->containerTarget($candidate) === $this->selected_container);
if (is_null($container)) {
throw new \RuntimeException('Container not found.');
}
diff --git a/resources/views/livewire/project/shared/execute-container-command.blade.php b/resources/views/livewire/project/shared/execute-container-command.blade.php
index dabd523f94..ef179a4ec9 100644
--- a/resources/views/livewire/project/shared/execute-container-command.blade.php
+++ b/resources/views/livewire/project/shared/execute-container-command.blade.php
@@ -34,7 +34,7 @@
$consoleThemeNames = collect($consoleThemes)->pluck('name', 'key');
$consoleThemeAccents = collect($consoleThemes)->pluck('accent', 'key');
$containerOptions = $containers->map(fn ($container) => [
- 'value' => data_get($container, 'container.Names'),
+ 'value' => data_get($container, 'server.uuid').':'.data_get($container, 'container.Names'),
'label' => data_get($container, 'container.Names').' · '.data_get($container, 'server.name'),
])->values();
@endphp