Files
Virtnet.bond/extensions/Servers/Proxmox/Livewire/VNC.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

44 lines
1.1 KiB
PHP

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