refactor(terminal): enhance terminal connection management and error handling, including improved reconnection logic and cleanup procedures

This commit is contained in:
Andras Bacsai
2025-05-29 14:36:13 +02:00
parent 261a2fe564
commit 05a03c44d3
3 changed files with 257 additions and 83 deletions

View File

@@ -43,7 +43,10 @@ class Terminal extends Component
#[On('send-terminal-command')]
public function sendTerminalCommand($isContainer, $identifier, $serverUuid)
{
$server = Server::ownedByCurrentTeam()->whereUuid($serverUuid)->where('settings.is_terminal_enabled', true)->firstOrFail();
$server = Server::ownedByCurrentTeam()->whereUuid($serverUuid)->firstOrFail();
if (! $server->isTerminalEnabled()) {
throw new \RuntimeException('Terminal access is disabled on this server.');
}
if ($isContainer) {
// Validate container identifier format (alphanumeric, dashes, and underscores only)