Commit 09245516 authored by nextime's avatar nextime

Fix terminal echo: restore local command echoing in web terminal

- Add proper xterm.js configuration with disableStdin: false and other settings
- Implement local echo handling for printable characters, backspace, and enter
- Ensure terminal input is visible to user while maintaining server communication
- Fix input handling to properly display typed commands in the web interface
parent f3fe7c6d
...@@ -62,7 +62,17 @@ function connect() { ...@@ -62,7 +62,17 @@ function connect() {
allowTransparency: true, allowTransparency: true,
scrollback: 1000, scrollback: 1000,
tabStopWidth: 4, tabStopWidth: 4,
convertEol: true convertEol: true,
disableStdin: false,
cursorWidth: 2,
bellStyle: 'none',
rightClickSelectsWord: true,
fastScrollModifier: 'alt',
fastScrollSensitivity: 5,
screenReaderMode: false,
macOptionIsMeta: false,
macOptionClickForcesSelection: false,
minimumContrastRatio: 1
}); });
term.open(document.getElementById('terminal')); term.open(document.getElementById('terminal'));
...@@ -119,10 +129,22 @@ function connect() { ...@@ -119,10 +129,22 @@ function connect() {
disconnect(); disconnect();
}); });
// Handle input - let SSH server handle echoing // Handle input - send to server and handle local echo
term.onData(data => { term.onData(data => {
if (!connected || !requestId) return; if (!connected || !requestId) return;
// Handle special characters for local echo
if (data === '\r' || data === '\n') {
// Enter key - let server handle the command execution
term.write('\r\n');
} else if (data === '\x7f' || data === '\b') {
// Backspace - handle locally
term.write('\b \b');
} else if (data >= ' ' && data <= '~') {
// Printable characters - echo locally
term.write(data);
}
// Send data to server // Send data to server
fetch('/terminal/{{ client_id }}/data', { fetch('/terminal/{{ client_id }}/data', {
method: 'POST', method: 'POST',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment