v1.1.6: fix LXC xterm.js terminal (termproxy auth handshake)

- Add mandatory Proxmox termproxy auth: send 'USERNAME:VNCTICKET\n' as
  first WebSocket message, wait for 'OK' before starting PTY proxy
- Fix server.username → server.api_user (token suffix stripped)
- Fix CSRFPreventionToken sent in body → header only
- Fix additional_headers → extra_headers (websockets v12)
- Add URL-encoding for vncticket, PVEAuthCookie WS header, subprotocols=['binary']
- Forward initial terminal data arriving with OK frame
- Bump VERSION 1.1.5 → 1.1.6
This commit is contained in:
markmorado
2026-03-16 03:07:14 +01:00
parent 5a67981f9a
commit 4940cbe77f
8 changed files with 174 additions and 130 deletions

View File

@@ -1460,12 +1460,17 @@ async function connectTerminal() {
statusEl.style.color = 'var(--success)';
terminalInstance.focus();
// Send initial resize
const dims = fitAddon.proposeDimensions();
if (dims) {
const resizeMsg = `1:${dims.cols}:${dims.rows}:`;
terminalWebSocket.send(resizeMsg);
}
// Send initial resize — fallback to 80x24 if proposeDimensions returns null
// (happens when xterm.css not loaded yet)
const sendResize = () => {
const dims = fitAddon.proposeDimensions();
const cols = dims ? dims.cols : 80;
const rows = dims ? dims.rows : 24;
terminalWebSocket.send(`1:${cols}:${rows}:`);
};
// Send immediately and re-send after layout settles
sendResize();
setTimeout(sendResize, 200);
};
terminalWebSocket.onmessage = (event) => {