Commit dc3db4b2 authored by nextime's avatar nextime

Force terminal echo by running stty echo before wsssh

- Modify wssshd.py to run 'stty echo' before launching wsssh
- Use shell command wrapper to execute stty echo && wsssh
- Ensure echo mode is forced before SSH connection is established
- Remove JavaScript-based stty echo attempts
- Fix terminal echo issue by setting echo mode at the right time
parent 675df299
...@@ -284,7 +284,8 @@ def logos_files(filename): ...@@ -284,7 +284,8 @@ def logos_files(filename):
def connect_terminal(client_id): def connect_terminal(client_id):
username = request.form.get('username', 'root') username = request.form.get('username', 'root')
request_id = str(uuid.uuid4()) request_id = str(uuid.uuid4())
command = ['wsssh', '-p', str(args.port), f'{username}@{client_id}.{args.domain}'] # Force echo mode before launching wsssh
command = ['sh', '-c', f'stty echo && wsssh -p {args.port} {username}@{client_id}.{args.domain}']
# Spawn wsssh process with pty using fallback method # Spawn wsssh process with pty using fallback method
master, slave = openpty_with_fallback() master, slave = openpty_with_fallback()
slave_name = os.ttyname(slave) slave_name = os.ttyname(slave)
...@@ -354,7 +355,9 @@ def connect_terminal(client_id): ...@@ -354,7 +355,9 @@ def connect_terminal(client_id):
# Process status will be checked in the reading thread # Process status will be checked in the reading thread
active_terminals[request_id] = {'client_id': client_id, 'username': username, 'proc': proc, 'output_buffer': output_buffer, 'master': master} active_terminals[request_id] = {'client_id': client_id, 'username': username, 'proc': proc, 'output_buffer': output_buffer, 'master': master}
return jsonify({'request_id': request_id, 'command': ' '.join(command)}) # Show the actual wsssh command being executed
actual_command = f'wsssh -p {args.port} {username}@{client_id}.{args.domain}'
return jsonify({'request_id': request_id, 'command': actual_command})
@app.route('/terminal/<client_id>/data', methods=['GET', 'POST']) @app.route('/terminal/<client_id>/data', methods=['GET', '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