diff --git a/app.js b/app.js index 57358b8..1ab4b0e 100644 --- a/app.js +++ b/app.js @@ -5,6 +5,9 @@ var http = require('http'), ss = require('socket.io-stream'); var config = require('./config.json'); +var use_input = true; +if (config["input"] != null) + use_input = config["input"]; var server = http.createServer() .listen(config.port, config.interface); @@ -43,7 +46,12 @@ socketio(server).of('pty').on('connection', function(socket) { var name = options.name; var pty = child_pty.spawn('/bin/sh', ['-c', config.login], options); - pty.stdout.pipe(stream).pipe(pty.stdin); + if (use_input) + pty.stdout.pipe(stream).pipe(pty.stdin); + else { + pty.stdout.pipe(stream); + stream.on('data', function(chunk) {}); + } ptys[name] = pty; socket.on('disconnect', function() { console.log("end"); diff --git a/config.json b/config.json index df48c10..51d79ed 100644 --- a/config.json +++ b/config.json @@ -1,5 +1,6 @@ { "login": "echo \"Please don't use this in productive environments as all keystrokes are sent in plain text!\"; /bin/sh", "port": 3000, - "interface": "127.0.0.1" + "interface": "127.0.0.1", + "input": true }