Add debug output showing launched wsssh command

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