From fca9b86d62b11c15cc82d581f40716bfa826abd5 Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Wed, 5 Feb 2020 20:45:42 +0100 Subject: [PATCH 1/2] Fix issues with linux/macos terminal --- agents/meshcore.js | 2 +- public/scripts/amt-terminal-0.0.2.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/agents/meshcore.js b/agents/meshcore.js index 84807037..40508924 100644 --- a/agents/meshcore.js +++ b/agents/meshcore.js @@ -1240,7 +1240,7 @@ function createMeshCore(agent) { var sh = fs.existsSync('/bin/sh') ? '/bin/sh' : false; var login = process.platform == 'linux' ? '/bin/login' : '/usr/bin/login'; - var env = { HISTCONTROL: 'ignoreboth', TERM: 'xterm' }; + var env = { HISTCONTROL: 'ignoreboth' }; if (this.httprequest.xoptions) { if (this.httprequest.xoptions.rows) { env.LINES = ('' + this.httprequest.xoptions.rows); } diff --git a/public/scripts/amt-terminal-0.0.2.js b/public/scripts/amt-terminal-0.0.2.js index eabce6e5..890133d7 100644 --- a/public/scripts/amt-terminal-0.0.2.js +++ b/public/scripts/amt-terminal-0.0.2.js @@ -73,7 +73,7 @@ var CreateAmtRemoteTerminal = function (divid, options) { } obj.xxStateChange = function (newstate) { - //if ((newstate == 3) && (options != null) && (options.xterm == true)) { obj.TermSendKeys(' stty rows ' + obj.height + ' cols ' + obj.width + '\n clear\n'); } + if ((newstate == 3) && (options != null) && (options.xterm == true)) { obj.TermSendKeys(' stty rows ' + obj.height + ' cols ' + obj.width + ';clear\n'); } } obj.ProcessData = function (str) { From c71c043b013f626831fda15ff3660aaecf7d6fd9 Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Wed, 5 Feb 2020 21:56:42 +0100 Subject: [PATCH 2/2] Rename width and height to cols and rows to fix size issue with non xterm terminal --- public/scripts/amt-terminal-0.0.2.js | 4 ++-- views/default.handlebars | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/public/scripts/amt-terminal-0.0.2.js b/public/scripts/amt-terminal-0.0.2.js index 890133d7..e888ce8a 100644 --- a/public/scripts/amt-terminal-0.0.2.js +++ b/public/scripts/amt-terminal-0.0.2.js @@ -73,7 +73,7 @@ var CreateAmtRemoteTerminal = function (divid, options) { } obj.xxStateChange = function (newstate) { - if ((newstate == 3) && (options != null) && (options.xterm == true)) { obj.TermSendKeys(' stty rows ' + obj.height + ' cols ' + obj.width + ';clear\n'); } + //if ((newstate == 3) && (options != null) && (options.xterm == true)) { obj.TermSendKeys(' stty rows ' + obj.height + ' cols ' + obj.width + ';clear\n'); } } obj.ProcessData = function (str) { @@ -805,6 +805,6 @@ var CreateAmtRemoteTerminal = function (divid, options) { obj.heightLock = 0; obj.DivElement.style['height'] = ''; - if ((options != null) && (options.width != null) && (options.height != null)) { obj.Init(options.width, options.height); } else { obj.Init(); } + if ((options != null) && (options.cols != null) && (options.rows != null)) { obj.Init(options.cols, options.rows); } else { obj.Init(); } return obj; } diff --git a/views/default.handlebars b/views/default.handlebars index e8db02ad..5046e0d9 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -6350,11 +6350,11 @@ var termoptions = { protocol: ((options != null) && (typeof options.protocol == 'number'))?options.protocol:1 }; if (options && options.requireLogin) { termoptions.requireLogin = true; } if ([1, 2, 3, 4, 21, 22].indexOf(currentNode.agent.id) == -1) { - if (Q('termSizeList').value == 2) { termoptions.width = 100; termoptions.height = 30; termoptions.xterm = true; } + if (Q('termSizeList').value == 2) { termoptions.cols = 100; termoptions.rows = 30; termoptions.xterm = true; } if (Q('termSizeList').value == 3) { // TODO: Try to improve terminal auto-size. - termoptions.width = Math.floor((Q('column_l').clientWidth - 60) / 10); - termoptions.height = Math.floor((Q('column_l').clientHeight - 120) / 20); + termoptions.cols = Math.floor((Q('column_l').clientWidth - 60) / 10); + termoptions.rows = Math.floor((Q('column_l').clientHeight - 120) / 20); termoptions.xterm = true; } }