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:
@@ -172,7 +172,11 @@ class TerminalService {
|
||||
// Handle WebSocket ping (respond with pong)
|
||||
ws.on('ping', () => {
|
||||
console.log(`[TerminalService] Ping received from ${terminalId}`);
|
||||
ws.pong();
|
||||
try {
|
||||
ws.pong();
|
||||
} catch (error) {
|
||||
console.error(`[TerminalService] Error sending pong:`, error);
|
||||
}
|
||||
});
|
||||
|
||||
// Handle WebSocket pong (response to our ping)
|
||||
@@ -183,14 +187,18 @@ class TerminalService {
|
||||
|
||||
// Handle PTY output - send to client
|
||||
terminal.pty.onData((data) => {
|
||||
console.log(`[TerminalService] PTY data from ${terminalId}: ${data.replace(/\n/g, '\\n').replace(/\r/g, '\\r')}`);
|
||||
if (ws.readyState === ws.OPEN) {
|
||||
ws.send(JSON.stringify({
|
||||
type: 'data',
|
||||
data: data
|
||||
}));
|
||||
} else {
|
||||
console.log(`[TerminalService] Cannot send PTY data - WebSocket not open (state: ${ws.readyState})`);
|
||||
try {
|
||||
console.log(`[TerminalService] PTY data from ${terminalId}: ${data.replace(/\n/g, '\\n').replace(/\r/g, '\\r')}`);
|
||||
if (ws.readyState === ws.OPEN) {
|
||||
ws.send(JSON.stringify({
|
||||
type: 'data',
|
||||
data: data
|
||||
}));
|
||||
} else {
|
||||
console.log(`[TerminalService] Cannot send PTY data - WebSocket not open (state: ${ws.readyState})`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`[TerminalService] ERROR sending PTY data to client:`, error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -199,13 +207,17 @@ class TerminalService {
|
||||
console.log(`[TerminalService] PTY EXIT for ${terminalId}: exitCode=${exitCode}, signal=${signal}`);
|
||||
this.logCommand(terminalId, null, `Terminal exited: ${exitCode || signal}`);
|
||||
|
||||
if (ws.readyState === ws.OPEN) {
|
||||
ws.send(JSON.stringify({
|
||||
type: 'exit',
|
||||
exitCode,
|
||||
signal
|
||||
}));
|
||||
ws.close();
|
||||
try {
|
||||
if (ws.readyState === ws.OPEN) {
|
||||
ws.send(JSON.stringify({
|
||||
type: 'exit',
|
||||
exitCode,
|
||||
signal
|
||||
}));
|
||||
ws.close();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`[TerminalService] Error sending exit message:`, error);
|
||||
}
|
||||
|
||||
this.terminals.delete(terminalId);
|
||||
@@ -221,7 +233,12 @@ class TerminalService {
|
||||
|
||||
// Handle WebSocket error
|
||||
ws.on('error', (error) => {
|
||||
console.error(`[TerminalService] WebSocket error for terminal ${terminalId}:`, error);
|
||||
console.error(`[TerminalService] ✖✖✖ WebSocket ERROR for terminal ${terminalId} ✖✖✖`);
|
||||
console.error(`[TerminalService] Error:`, error);
|
||||
console.error(`[TerminalService] Message: ${error.message}`);
|
||||
if (error.stack) {
|
||||
console.error(`[TerminalService] Stack: ${error.stack}`);
|
||||
}
|
||||
});
|
||||
|
||||
// Send initial welcome message
|
||||
@@ -239,9 +256,13 @@ class TerminalService {
|
||||
|
||||
// Send a ping immediately after ready to ensure connection stays alive
|
||||
setTimeout(() => {
|
||||
if (ws.readyState === ws.OPEN) {
|
||||
ws.ping();
|
||||
console.log(`[TerminalService] Sent ping after ready message`);
|
||||
try {
|
||||
if (ws.readyState === ws.OPEN) {
|
||||
ws.ping();
|
||||
console.log(`[TerminalService] Sent ping after ready message`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`[TerminalService] Error sending ping after ready:`, error);
|
||||
}
|
||||
}, 100);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user