Version 0.8.46

This commit is contained in:
Ylian Saint-Hilaire 2021-05-24 20:37:48 -07:00
parent f3c180a2c2
commit ecc7292f37
6 changed files with 1745 additions and 1682 deletions

View File

@ -710,7 +710,6 @@ module.exports.CreateSshFilesRelay = function (parent, db, ws, req, domain, user
}); });
}); });
obj.sshClient.on('error', function (err) { obj.sshClient.on('error', function (err) {
console.log('error', err);
if (err.level == 'client-authentication') { try { obj.ws.send(JSON.stringify({ action: 'autherror' })); } catch (ex) { } } if (err.level == 'client-authentication') { try { obj.ws.send(JSON.stringify({ action: 'autherror' })); } catch (ex) { } }
if (err.level == 'client-timeout') { try { obj.ws.send(JSON.stringify({ action: 'sessiontimeout' })); } catch (ex) { } } if (err.level == 'client-timeout') { try { obj.ws.send(JSON.stringify({ action: 'sessiontimeout' })); } catch (ex) { } }
obj.close(); obj.close();

View File

@ -1,6 +1,6 @@
{ {
"name": "meshcentral", "name": "meshcentral",
"version": "0.8.45", "version": "0.8.46",
"keywords": [ "keywords": [
"Remote Device Management", "Remote Device Management",
"Remote Device Monitoring", "Remote Device Monitoring",

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -944,9 +944,10 @@
<div id=p10files style="position:absolute;top:55px;bottom:0px;width:100%;display:none"> <div id=p10files style="position:absolute;top:55px;bottom:0px;width:100%;display:none">
<table id="p13toolbar" style="width:100%;height:111px" cellpadding="0" cellspacing="0"> <table id="p13toolbar" style="width:100%;height:111px" cellpadding="0" cellspacing="0">
<tr> <tr>
<td style="background-color:#C0C0C0;border-bottom:2px solid black;padding:2px"> <td style="background-color:#C0C0C0;border-bottom:2px solid black;padding:2px;line-height:24px">
<div style="float:right;text-align:right"> <div style="float:right;text-align:right">
<input id="filesActionsBtn" type=button onkeypress="return false" onkeydown="return false" value=Actions onclick=deviceActionFunction() style=margin-right:2px /> <input id="filesActionsBtn" type=button onkeypress="return false" onkeydown="return false" value=Actions onclick=deviceActionFunction() style=margin-right:2px />
<div id="filesCustomUpperRight" style="float:left;margin-right:6px"></div>
</div> </div>
<div style="margin-left:2px"> <div style="margin-left:2px">
<input id=p13AutoConnect value="AutoConnect" onclick=autoConnectFiles(event) onkeypress="return false" onkeydown="return false" type="button" style="display:none"> <input id=p13AutoConnect value="AutoConnect" onclick=autoConnectFiles(event) onkeypress="return false" onkeydown="return false" type="button" style="display:none">
@ -3444,8 +3445,8 @@
QH('p10html', x); QH('p10html', x);
// If we are looking at a local non-windows device, enable terminal capability. // If we are looking at a local non-windows device, enable terminal and files capability.
if ((node.mtype == 3) && (node.agent != null) && (node.agent.id > 4) && (features2 & 0x00000200)) { node.agent.caps = 2; } if ((node.mtype == 3) && (node.agent != null) && (node.agent.id > 4) && (features2 & 0x00000200)) { node.agent.caps = 6; }
// Show node last 7 days timeline // Show node last 7 days timeline
//drawDeviceTimeline(); //drawDeviceTimeline();
@ -3539,7 +3540,7 @@
(((currentNode.agent == null) && ((typeof currentNode.intelamt.sku !== 'number') || ((currentNode.intelamt.sku & 8) != 0))) || (currentNode.agent && (currentNode.agent.caps & 2))) (((currentNode.agent == null) && ((typeof currentNode.intelamt.sku !== 'number') || ((currentNode.intelamt.sku & 8) != 0))) || (currentNode.agent && (currentNode.agent.caps & 2)))
) { menus.push({ n: "Terminal", f: 'setupDeviceMenu(5)' }); } ) { menus.push({ n: "Terminal", f: 'setupDeviceMenu(5)' }); }
if ((currentDevicePanel != 2) && (currentNode != null) && (meshrights & 8) && ((meshrights == 0xFFFFFFFF) || ((meshrights & 1024) == 0)) && ((currentNode.mtype == 2) && (currentNode.agent.caps & 4))) { menus.push({ n: "Files", f: 'setupDeviceMenu(2)' }); } if ((currentDevicePanel != 2) && (currentNode != null) && (meshrights & 8) && ((meshrights == 0xFFFFFFFF) || ((meshrights & 1024) == 0)) && ((currentNode.mtype != 1) && (currentNode.agent.caps & 4))) { menus.push({ n: "Files", f: 'setupDeviceMenu(2)' }); }
if ((currentDevicePanel != 3) && (currentNode != null) && (currentNode.mtype != 3)) { menus.push({ n: "Details", f: 'setupDeviceMenu(3)' }); } if ((currentDevicePanel != 3) && (currentNode != null) && (currentNode.mtype != 3)) { menus.push({ n: "Details", f: 'setupDeviceMenu(3)' }); }
if ((currentDevicePanel != 4) && (currentNode != null) && (meshrights & 0x00000010) && (currentNode.mtype == 2)) { menus.push({ n: "Console", f: 'setupDeviceMenu(4)' }); } if ((currentDevicePanel != 4) && (currentNode != null) && (meshrights & 0x00000010) && (currentNode.mtype == 2)) { menus.push({ n: "Console", f: 'setupDeviceMenu(4)' }); }
updateFooterMenu(menus); updateFooterMenu(menus);
@ -4023,6 +4024,17 @@
} }
} }
function p13setConsoleMsg(msg, timeout) {
if (msg) {
Q('p13FilesConsoleMsg').innerHTML += msg;
QV('p13FilesConsoleMsg', true);
if (p13FilesConsoleMsgTimer != null) { clearTimeout(p13FilesConsoleMsgTimer); }
if (timeout) { p13FilesConsoleMsgTimer = setTimeout(p13clearConsoleMsg, timeout); }
} else {
p13clearConsoleMsg();
}
}
function onDesktopStateChange(xdesktop, state) { function onDesktopStateChange(xdesktop, state) {
var xstate = state; var xstate = state;
if ((xstate == 3) && (xdesktop.contype == 2)) { xstate++; } if ((xstate == 3) && (xdesktop.contype == 2)) { xstate++; }
@ -4510,8 +4522,8 @@
var termState = ((terminal != null) && (terminal.state != 0)); var termState = ((terminal != null) && (terminal.state != 0));
QE('termFullScreen', (termState != 0)); QE('termFullScreen', (termState != 0));
// If we are looking at a local non-windows device, enable terminal capability. // If we are looking at a local non-windows device, enable terminal and files capability.
if ((terminalNode.mtype == 3) && (terminalNode.agent != null) && (terminalNode.agent.id > 4) && (features2 & 0x00000200)) { terminalNode.agent.caps = 2; } if ((terminalNode.mtype == 3) && (terminalNode.agent != null) && (terminalNode.agent.id > 4) && (features2 & 0x00000200)) { terminalNode.agent.caps = 6; }
// Show the right buttons // Show the right buttons
QV('disconnectbutton2span', (termState == true)); QV('disconnectbutton2span', (termState == true));
@ -4720,9 +4732,10 @@
// Setup the files tab // Setup the files tab
var samenode = (filesNode == currentNode); var samenode = (filesNode == currentNode);
filesNode = currentNode; filesNode = currentNode;
var online = ((filesNode.conn & 1) != 0) ? true : false; // If Agent (1) connected, enable Terminal var online = ((filesNode.conn & 1) != 0) || (filesNode.mtype == 3); // If Agent (1) connected, enable Terminal
QE('p13Connect', online); QE('p13Connect', online);
if (((samenode == false) || (online == false)) && files) { files.Stop(); files = null; } if (((samenode == false) || (online == false)) && files) { files.Stop(); files = null; }
p13setActions();
} }
function onFilesStateChange(xfiles, state) { function onFilesStateChange(xfiles, state) {
@ -4769,6 +4782,7 @@
if (!files) { if (!files) {
// Setup a mesh agent files // Setup a mesh agent files
files = CreateAgentRedirect(meshserver, CreateRemoteFiles(p13gotFiles), serverPublicNamePort, authCookie, authRelayCookie, domainUrl); files = CreateAgentRedirect(meshserver, CreateRemoteFiles(p13gotFiles), serverPublicNamePort, authCookie, authRelayCookie, domainUrl);
if (filesNode.mtype == 3) { files.urlname = 'sshfilesrelay.ashx'; } // If this is a SSH session, change the URL to the SSH application relay.
files.attemptWebRTC = attemptWebRTC; files.attemptWebRTC = attemptWebRTC;
files.onStateChanged = onFilesStateChange; files.onStateChanged = onFilesStateChange;
files.onConsoleMessageChange = function () { files.onConsoleMessageChange = function () {
@ -4802,6 +4816,23 @@
try { data = JSON.parse(decode_utf8(data)); } catch (ex) { data = JSON.parse(data); } try { data = JSON.parse(decode_utf8(data)); } catch (ex) { data = JSON.parse(data); }
if (data.action == 'download') { p13gotDownloadCommand(data); return; } if (data.action == 'download') { p13gotDownloadCommand(data); return; }
// Process any SSH actions
switch (data.action) {
case 'sshauth': {
var x = '';
x += addHtmlValue("Username", '<input id=dp2user style=width:190px maxlength=64 autocomplete=off onkeyup=sshAuthKeyUp(event) />');
x += addHtmlValue("Password", '<input type=password id=dp2pass style=width:190px maxlength=64 autocomplete=off onkeyup=sshAuthKeyUp(event) />');
x += '<label><input id=dp2keep type=checkbox>' + "Remember credentials" + '</label>';
setDialogMode(2, "Authentication", 11, p13sshConnectEx, x, 'ssh');
setTimeout(sshAuthKeyUp, 50);
return;
}
case 'autherror': { p13setConsoleMsg("Authentication Error", 5000); return; }
case 'connectionerror': { p13setConsoleMsg("Connection Error", 5000); return; }
case 'sessionerror': { p13setConsoleMsg("Session expired", 5000); return; }
case 'sessiontimeout': { p13setConsoleMsg("Session timeout", 5000); return; }
}
// Process file upload commands // Process file upload commands
if ((data.action != null) && (data.action.startsWith('upload'))) { p13gotUploadData(data); return; } if ((data.action != null) && (data.action.startsWith('upload'))) { p13gotUploadData(data); return; }
@ -4826,6 +4857,14 @@
} }
} }
function p13sshConnectEx(b) {
if (b == 0) {
if (files != null) { connectFiles(); } // Disconnect
} else {
files.socket.send(JSON.stringify({ action: 'sshauth', username: Q('dp2user').value, password: Q('dp2pass').value, keep: Q('dp2keep').checked }));
}
}
function p13getCheckedNames() { function p13getCheckedNames() {
// Save all existing checked boxes // Save all existing checked boxes
var checkedNames = [], checkboxes = document.getElementsByName('fd'); var checkedNames = [], checkboxes = document.getElementsByName('fd');
@ -4933,10 +4972,16 @@
QE('p13SelectAllButton', tc > 0); QE('p13SelectAllButton', tc > 0);
Q('p13SelectAllButton').value = (cc > 0 ? "None" : "All"); Q('p13SelectAllButton').value = (cc > 0 ? "None" : "All");
QE('p13RefreshButton', true); QE('p13RefreshButton', true);
QE('p13CutButton', advancedFeatures && (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13CutButton', advancedFeatures && (cc > 0) && (cc == sfc) && (currentNode.mtype != 3) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13CopyButton', advancedFeatures && (cc > 0) && (cc == sfc) && ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13CopyButton', advancedFeatures && (cc > 0) && (cc == sfc) && (currentNode.mtype != 3) && ((p13filetreelocation.length > 0) || (winAgent == false)));
QE('p13PasteButton', advancedFeatures && ((p13filetreelocation.length > 0) || (winAgent == false)) && ((p13clipboard != null) && (p13clipboard.length > 0))); QE('p13PasteButton', advancedFeatures && (currentNode.mtype != 3) && ((p13filetreelocation.length > 0) || (winAgent == false)) && ((p13clipboard != null) && (p13clipboard.length > 0)));
} }
if (filesNode.mtype != 3) {
QH('filesCustomUpperRight', '');
} else {
QH('filesCustomUpperRight', '<a style=cursor:pointer onclick=cmsshportaction(1,event)>' + format("SSH Port {0}", (filesNode.sshport ? filesNode.sshport : 22)) + '</a>');
}
QV('filesActionsBtn', filesNode.mtype != 3);
} }
function p13getFileSelCount(includeDirs) { var cc = 0; var checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && ((includeDirs != false) || (checkboxes[i].attributes.file.value == '3'))) cc++; } return cc; } function p13getFileSelCount(includeDirs) { var cc = 0; var checkboxes = document.getElementsByName('fd'); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && ((includeDirs != false) || (checkboxes[i].attributes.file.value == '3'))) cc++; } return cc; }

View File

@ -8616,7 +8616,7 @@
if (terminalNode.mtype != 3) { if (terminalNode.mtype != 3) {
QH('terminalCustomUpperRight', ''); QH('terminalCustomUpperRight', '');
} else { } else {
QH('terminalCustomUpperRight', '<a onclick=cmsshportaction(1,event)>' + format("SSH Port {0}", (terminalNode.sshport?terminalNode.sshport:22)) + '</a>'); QH('terminalCustomUpperRight', '<a style=cursor:pointer onclick=cmsshportaction(1,event)>' + format("SSH Port {0}", (terminalNode.sshport?terminalNode.sshport:22)) + '</a>');
} }
// Enable buttons // Enable buttons
@ -9295,7 +9295,7 @@
if (filesNode.mtype != 3) { if (filesNode.mtype != 3) {
QH('filesCustomUpperRight', ''); QH('filesCustomUpperRight', '');
} else { } else {
QH('filesCustomUpperRight', '<a onclick=cmsshportaction(1,event)>' + format("SSH Port {0}", (filesNode.sshport?filesNode.sshport:22)) + '</a>'); QH('filesCustomUpperRight', '<a style=cursor:pointer onclick=cmsshportaction(1,event)>' + format("SSH Port {0}", (filesNode.sshport?filesNode.sshport:22)) + '</a>');
} }
QV('filesActionsBtn', filesNode.mtype != 3); QV('filesActionsBtn', filesNode.mtype != 3);
QV('p13FindButton', filesNode.mtype != 3); QV('p13FindButton', filesNode.mtype != 3);