fix: remove debug panel close button to keep it always visible

The close button would hide the debug panel with display: none,
making it impossible to see debug messages without reloading.

Also includes HTTP POST workaround changes for terminal command
execution that bypass the WebSocket send issue.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
uroma
2026-01-19 20:26:27 +00:00
Unverified
parent 815f7095fd
commit 9f35b68ea2
3 changed files with 94 additions and 28 deletions

View File

@@ -893,18 +893,24 @@ class TerminalManager {
const ws = new WebSocket(wsUrl);
ws.onopen = () => {
this.debugLog('WS', `WebSocket OPENED for terminal ${terminalId}`);
this.debugLog('WS', `WebSocket OPENED for terminal ${terminalId}`);
this.debugLog('WS', `Checking if terminal exists in map...`);
// Store WebSocket in terminal entry
// NOTE: This assumes initializeXTerm() has already been called
// and this.terminals has the entry
const terminal = this.terminals.get(terminalId);
if (terminal) {
this.debugLog('WS', `✅ Terminal found in map, storing WebSocket`);
terminal.ws = ws;
terminal.ready = false; // Will be set to true when 'ready' message received
this.debugLog('WS', `WebSocket stored in terminal map, waiting for 'ready' message`);
this.debugLog('WS', `WebSocket stored in terminal map, waiting for 'ready' message`);
} else {
this.debugLog('ERROR', `CRITICAL: Terminal ${terminalId} not found in map!`, { terminalsInMap: Array.from(this.terminals.keys()) });
this.debugLog('ERROR', `CRITICAL: Terminal ${terminalId} not found in map!`);
this.debugLog('ERROR', `Available terminals:`, {
count: this.terminals.size,
ids: Array.from(this.terminals.keys())
});
reject(new Error(`Terminal ${terminalId} not initialized`));
ws.close();
return;
@@ -932,12 +938,52 @@ class TerminalManager {
};
ws.onerror = (error) => {
this.debugLog('ERROR', `WebSocket error for terminal ${terminalId}`, error);
this.debugLog('ERROR', `✖✖✖ WebSocket ERROR for terminal ${terminalId} ✖✖✖`, {
type: error.type || 'unknown',
message: error.message || 'No error message',
error: error
});
this.debugLog('ERROR', `Check browser console (F12) for full error details`);
reject(error);
};
ws.onclose = (event) => {
this.debugLog('WS', `WebSocket CLOSED for terminal ${terminalId}`, { code: event.code, reason: event.reason, wasClean: event.wasClean });
const closeReasons = {
1000: 'Normal Closure',
1001: 'Endpoint Going Away',
1002: 'Protocol Error',
1003: 'Unsupported Data',
1004: '(Reserved)',
1005: 'No Status Received',
1006: 'Abnormal Closure (connection dropped)',
1007: 'Invalid frame payload data',
1008: 'Policy Violation',
1009: 'Message Too Big',
1010: 'Mandatory Extension',
1011: 'Internal Server Error',
1015: 'TLS Handshake'
};
const closeReason = closeReasons[event.code] || `Unknown (${event.code})`;
this.debugLog('ERROR', `🔌 WebSocket CLOSED for terminal ${terminalId}`, {
code: event.code,
reasonName: closeReason,
reason: event.reason || 'None provided',
wasClean: event.wasClean,
timestamp: new Date().toISOString()
});
if (event.code === 1006) {
this.debugLog('ERROR', `💡 Code 1006 means connection was dropped abnormally - check server logs`);
this.debugLog('ERROR', `💡 Common causes: server crash, network issue, or timeout`);
}
// Show terminals currently in map for debugging
this.debugLog('ERROR', `Current terminals in map:`, {
count: this.terminals.size,
ids: Array.from(this.terminals.keys())
});
};
} catch (error) {
this.debugLog('ERROR', `Exception connecting WebSocket`, error);