Add debug output showing launched wsssh command

parent e1c10230
......@@ -70,6 +70,9 @@ function connect() {
.then(data => {
if (data.request_id) {
requestId = data.request_id;
if (data.command) {
term.write('Launching: ' + data.command + '\r\n');
}
term.write('Connected successfully!\r\n$ ');
// Start polling for data
pollInterval = setInterval(pollData, 500);
......
......@@ -184,9 +184,10 @@ def logos_files(filename):
def connect_terminal(client_id):
username = request.form.get('username', 'root')
request_id = str(uuid.uuid4())
command = ['wsssh', '-P', str(args.port), f'{username}@{client_id}.{args.domain}']
# Spawn wsssh process
proc = subprocess.Popen(
['wsssh', '-P', str(args.port), f'{username}@{client_id}.{args.domain}'],
command,
stdout=subprocess.PIPE,
stdin=subprocess.PIPE,
stderr=subprocess.STDOUT,
......@@ -198,7 +199,7 @@ def connect_terminal(client_id):
fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
active_terminals[request_id] = {'client_id': client_id, 'username': username, 'proc': proc}
return jsonify({'request_id': request_id})
return jsonify({'request_id': request_id, 'command': ' '.join(command)})
@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