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
45 lines
1.2 KiB
PHP
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,
|
|
]);
|
|
}
|
|
}
|
|
|