From 1725cdaa85d4107ab9206e30c3f17b5ee5831144 Mon Sep 17 00:00:00 2001 From: billchurch Date: Wed, 1 Feb 2017 18:36:05 -0500 Subject: [PATCH] fixing banner formatting issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit when Unix hosts use lf vs cr/lf it doesn’t quite format right. converting these to fix that. I’m not sure if this is something to be solved in xterm.js, haven’t had time really review it. --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index cb93b90..cbbb257 100644 --- a/index.js +++ b/index.js @@ -59,8 +59,10 @@ app.use(express.static(__dirname + '/public')).use(function(req, res, next) { io.on('connection', function(socket) { var conn = new ssh(); - conn.on('banner', function(msg, lng) { - socket.emit('data', msg); + conn.on('banner', function(d) { + //need to convert to cr/lf for proper formatting + d = d.replace(/\n/g, "\r\n"); + socket.emit('data', d.toString('binary')); }).on('ready', function() { socket.emit('title', 'ssh://' + config.ssh.host); socket.emit('headerBackground', config.header.background);