Files
Virtnet.bond/extensions/Servers/Proxmox/Livewire/XTerm.php
Joseph.Rawlings 68043f0416 fix(proxmox): harden console sessions and firewall rollout safety
Reduce security and reliability risk across the Proxmox extension by removing password exposure from Livewire state, hardening console auth/cookie handling, and improving sanitized error paths. Improve firewall and router performance by adding safer lazy loading, bounded pagination, cross-server compatibility guards, and lower-overhead API workflows.

Made-with: Cursor
2026-03-28 19:34:46 -04:00

45 lines
1.2 KiB
PHP

<?php
namespace Paymenter\Extensions\Servers\Proxmox\Livewire;
use Paymenter\Extensions\Servers\Proxmox\Models\Server;
use Paymenter\Extensions\Servers\Proxmox\Proxmox;
class XTerm extends Component
{
public ?string $xtermUrl = null;
public bool $xtermLoadFailed = false;
public function mount(Server $server): void
{
parent::mount($server);
// Check if server node has VNC enabled (xterm uses the same VNC authentication)
if (!$this->server->node->vnc_enabled) {
abort(403, 'Console access is not enabled on this server node.');
}
try {
$proxmox = new Proxmox;
$this->xtermUrl = $proxmox->xterm($this->server);
$this->xtermLoadFailed = false;
} catch (\Throwable $e) {
$this->xtermUrl = null;
$this->xtermLoadFailed = true;
report($e);
$this->notify('Failed to connect to console. Please try again.', 'error');
}
}
public function render()
{
return view('proxmox::xterm', [
'xterm' => $this->xtermUrl,
])->layoutData([
'sidebar' => true,
]);
}
}