1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

New MeshAgents, much improved Linux terminal.

This commit is contained in:
Ylian Saint-Hilaire 2020-02-05 10:59:52 -08:00
parent 9046a946f7
commit 9ed44cef5f
22 changed files with 25 additions and 7 deletions

View file

@ -64,6 +64,7 @@
<div id="termShellContextMenuLinux" class="contextMenu noselect" style="display:none;min-width:0px">
<div id="cxtermnorm" class="cmtext" onclick="cmtermaction(1,event)"><b>Root Shell</b></div>
<div id="cxtermps" class="cmtext" onclick="cmtermaction(8,event)">User Shell</div>
<div id="cxtermps" class="cmtext" onclick="cmtermaction(100,event)">Login Shell</div>
</div>
<div id="altPortContextMenu" class="contextMenu noselect" style="display:none;min-width:0px">
<div id="cxaltport" class="cmtext" onclick="cmaltportaction(1,event)"><b>Alternate Port</b></div>
@ -4014,7 +4015,11 @@
}
function cmtermaction(action) {
connectTerminal(null, 1, { protocol: action });
if (action < 100) {
connectTerminal(null, 1, { protocol: action });
} else if (action == 100) {
connectTerminal(null, 1, { protocol: 1, requireLogin: true });
}
}
function cmaltportaction(action) {
@ -6343,6 +6348,7 @@
} else {
// Setup a mesh agent terminal
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 == 3) {
@ -6363,6 +6369,7 @@
}
terminal = CreateAgentRedirect(meshserver, CreateAmtRemoteTerminal('Term', termoptions), serverPublicNamePort, authCookie, authRelayCookie, domainUrl);
terminal.options = termoptions;
terminal.debugmode = debugmode;
terminal.m.debugmode = debugmode;
terminal.m.onTitleChange = function (sender, title) { QH('termtitle', ' - ' + EscapeHtml(title)); }

View file

@ -27,6 +27,7 @@
<div id="termShellContextMenuLinux" class="contextMenu noselect" style="display:none;min-width:0px">
<div id="cxtermnorm" class="cmtext" onclick="cmtermaction(1,event)"><b>Root Shell</b></div>
<div id="cxtermps" class="cmtext" onclick="cmtermaction(8,event)">User Shell</div>
<div id="cxtermps" class="cmtext" onclick="cmtermaction(100,event)">Login Shell</div>
</div>
<div id=p11 class="noselect" style="overflow:hidden">
<div id=deskarea0 style="position:relative">
@ -161,11 +162,12 @@
if (resizeTimer) clearTimeout(resizeTimer);
resizeTimer = setTimeout(sendResize, 200);
});
term.setOption('convertEol', true); // Consider \n to be \r\n, this should be taken care of by "termios"
//term.setOption('convertEol', true); // Consider \n to be \r\n, this should be taken care of by "termios"
// Setup a terminal tunnel to the agent
tunnel = CreateAgentRedirect(meshserver, CreateRemoteTunnel(tunnelUpdate, options), serverPublicNamePort, authCookie, authRelayCookie, domainUrl);
tunnel.options = { cols: term.cols, rows: term.rows };
if (options && options.requireLogin) { tunnel.options.requireLogin = true; }
tunnel.Start(args.nodeid);
tunnel.onStateChanged = onTunnelStateChange;
tunnel.onConsoleMessageChange = function (server, msg) { setConsoleMsg(msg); };
@ -245,9 +247,11 @@
}
function cmtermaction(action) {
//console.log('cmtermaction', action);
connectButton({ protocol: action })
//connectTerminal(null, 1, { protocol: action });
if (action < 100) {
connectButton({ protocol: action })
} else if (action == 100) {
connectButton({ protocol: 1, requireLogin: true })
}
}
function hideContextMenu() {