Invitation link fixes, xTerm terminal title support.

This commit is contained in:
Ylian Saint-Hilaire 2019-06-04 13:01:32 -07:00
parent 769e6b7211
commit ff9e92ccc8
7 changed files with 14194 additions and 13 deletions

View File

@ -834,9 +834,10 @@ function createMeshCore(agent) {
} else {
if (fs.existsSync("/bin/bash")) {
this.httprequest.process = childProcess.execFile("/bin/bash", ["bash", "-i"], { type: childProcess.SpawnTypes.TERM });
if (process.platform == 'linux') { this.httprequest.process.stdin.write("stty erase ^H\nalias ls='ls --color=auto'\nPS1='\\u@\\h:\\w\\$ '\nclear\n"); }
if (process.platform == 'linux') { this.httprequest.process.stdin.write("alias ls='ls --color=auto'\nclear\n"); }
} else {
this.httprequest.process = childProcess.execFile("/bin/sh", ["sh"], { type: childProcess.SpawnTypes.TERM });
if (process.platform == 'linux') { this.httprequest.process.stdin.write("stty erase ^H\nalias ls='ls --color=auto'\nPS1='\\u@\\h:\\w\\$ '\nclear\n"); }
}
//if (this.httprequest.process == null) { }
this.httprequest.process.tunnel = this;

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "meshcentral",
"version": "0.3.5-x",
"version": "0.3.5-y",
"keywords": [
"Remote Management",
"Intel AMT",

View File

@ -47,6 +47,8 @@ var CreateAmtRemoteTerminal = function (divid) {
var _scrollRegion = [0, 24];
var _altKeypadMode = false;
var scrollBackBuffer = [];
obj.title = null;
obj.onTitleChange = null;
obj.Start = function () { }
@ -104,6 +106,9 @@ var CreateAmtRemoteTerminal = function (divid) {
case ')':
_termstate = 5;
break;
case ']':
_termstate = 6; // xterm strings
break;
case '=':
// Set alternate keypad mode
_altKeypadMode = true;
@ -169,6 +174,26 @@ var CreateAmtRemoteTerminal = function (divid) {
case 5: // ')' Code
_termstate = 0;
break;
case 6: // ']' Code, xterm
const bx = b.charCodeAt(0);
if (b == ';') {
_escNumberPtr++;
} else if (bx == 7) {
_ProcessXTermHandler(_escNumber);
_termstate = 0;
} else {
if (!_escNumber[_escNumberPtr]) { _escNumber[_escNumberPtr] = b; }
else { _escNumber[_escNumberPtr] += b; }
}
break;
}
}
function _ProcessXTermHandler(_escNumber) {
if (_escNumber.length == 0) return;
var cmd = parseInt(_escNumber[0]);
if ((cmd == 0 || cmd == 2) && (_escNumber.length > 1) && (_escNumber[1] != '?')) {
if (obj.onTitleChange) { obj.onTitleChange(obj, obj.title = _escNumber[1]); }
}
}

View File

@ -278,10 +278,10 @@
QH('unlinuxinstall', linuxUnInstall);
// Attempt to detect the most likely operating system for this browser
if (navigator.userAgent.indexOf('Win64')) { openTab(null, 'wintab64'); }
else if (navigator.userAgent.indexOf('Windows')) { openTab(null, 'wintab32'); }
else if (navigator.userAgent.indexOf('Linux')) { openTab(null, 'linuxtab'); }
else if (navigator.userAgent.indexOf('Macintosh')) { openTab(null, 'macostab'); }
if (navigator.userAgent.indexOf('Win64') >= 0) { openTab(null, 'wintab64'); }
else if (navigator.userAgent.indexOf('Windows') >= 0) { openTab(null, 'wintab32'); }
else if (navigator.userAgent.indexOf('Linux') >= 0) { openTab(null, 'linuxtab'); }
else if (navigator.userAgent.indexOf('Macintosh') >= 0) { openTab(null, 'macostab'); }
else { openTab(null, 'wintab64'); }
}

File diff suppressed because one or more lines are too long

View File

@ -525,7 +525,7 @@
<span id="connectbutton2span"><input type="button" id="connectbutton2" value="Connect" onclick=connectTerminal(event,1) onkeypress="return false" onkeydown="return false" disabled="disabled"></span>
<span id="connectbutton2hspan">&nbsp;<input type="button" id="connectbutton2h" value="HW Connect" onclick=connectTerminal(event,2) onkeypress="return false" onkeydown="return false" disabled="disabled"></span>
<span id="disconnectbutton2span">&nbsp;<input type="button" id="disconnectbutton2" value="Disconnect" onclick=connectTerminal(event,0) onkeypress="return false" onkeydown="return false"></span>
&nbsp;<span id="termstatus">Disconnected</span>
&nbsp;<span id="termstatus">Disconnected</span><span id="termtitle"></span>
</div>
</td>
</tr>
@ -5035,12 +5035,10 @@
switch (state) {
case 0:
// Disconnected, clear the terminal
QH('termtitle', '');
xterminal.m.TermResetScreen();
xterminal.m.TermDraw();
if (terminal != null) {
terminal.Stop();
terminal = null;
}
if (terminal != null) { terminal.Stop(); terminal = null; }
break;
case 3:
break;
@ -5063,6 +5061,7 @@
terminal = CreateAmtRedirect(CreateAmtRemoteTerminal('Term'), authCookie);
terminal.debugmode = debugmode;
terminal.m.debugmode = debugmode;
terminal.m.onTitleChange = function (sender, title) { QH('termtitle', ' - ' + EscapeHtml(title)); }
terminal.onStateChanged = onTerminalStateChange;
terminal.Start(terminalNode._id, 16994, '*', '*', 0);
terminal.contype = 2;
@ -5072,6 +5071,7 @@
terminal = CreateAgentRedirect(meshserver, CreateAmtRemoteTerminal('Term'), serverPublicNamePort, authCookie, domainUrl);
terminal.debugmode = debugmode;
terminal.m.debugmode = debugmode;
terminal.m.onTitleChange = function (sender, title) { QH('termtitle', ' - ' + EscapeHtml(title)); }
terminal.m.lineFeed = ([1, 2, 3, 4, 21, 22].indexOf(currentNode.agent.id) >= 0) ? '\r\n' : '\r'; // On windows, send \r\n, on Linux only \r
terminal.attemptWebRTC = attemptWebRTC;
terminal.onStateChanged = onTerminalStateChange;