Version 0.7.4

This commit is contained in:
Ylian Saint-Hilaire 2020-11-27 21:40:30 -08:00
parent b0b3339c4b
commit b11b974873
6 changed files with 1923 additions and 1887 deletions

Binary file not shown.

View File

@ -241,6 +241,12 @@ function createMeshCore(agent) {
for (var i in obj.DAIPC._daipc) { if (obj.DAIPC._daipc[i]._registered != null) { obj.DAIPC._daipc[i]._send(x); } }
}
// Send this object to a specific registered local applications
function sendToRegisteredApp(appid, x) {
if ((obj.DAIPC == null) || (obj.DAIPC._daipc == null)) return;
for (var i in obj.DAIPC._daipc) { if (obj.DAIPC._daipc[i]._registered == appid) { obj.DAIPC._daipc[i]._send(x); } }
}
// Send list of registered apps to the server
function updateRegisteredAppsToServer() {
if ((obj.DAIPC == null) || (obj.DAIPC._daipc == null)) return;
@ -965,6 +971,11 @@ function createMeshCore(agent) {
cpuuse.tag = data.tag;
cpuuse.then(function (data) { mesh.SendCommand(JSON.stringify({ action: 'msg', type: 'cpuinfo', cpu: data, memory: require('sysinfo').memUtilization(), sessionid: this.sessionid, tag: this.tag })); }, function (ex) { });
break;
case 'localapp':
// Send a message to a local application
sendConsoleText('localappMsg: ' + data.appid + ', ' + JSON.stringify(data.value));
if (data.appid != null) { sendToRegisteredApp(data.appid, data.value); } else { broadcastToRegisteredApps(data.value); }
break;
default:
// Unknown action, ignore it.
break;

View File

@ -1336,6 +1336,14 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
else if (command.type == 'msg') { obj.sessions.msg = command.value; }
else if (command.type == 'app') { obj.sessions.app = command.value; }
}
// Any "help" session must have an associated app, if not, remove it.
if (obj.sessions.help != null) {
for (var i in obj.sessions.help) { if (obj.sessions.app[i] == null) { delete obj.sessions.help[i]; } }
if (Object.keys(obj.sessions.help).length == 0) { delete obj.sessions.help; }
}
// Inform everyone of updated sessions
obj.updateSessions();
break;
}

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -3837,11 +3837,16 @@
var node = null, x = '';
if (nodeid == null) { node = currentNode; } else { node = getNodeFromId(nodeid); }
if ((node == null) || (node.sessions == null)) { setDialogMode(0); return false; }
if (node.sessions.help != null) { for (var j in node.sessions.help) { x += '<div style=margin-bottom:6px><b>' + EscapeHtml(j) + '</b></div><div style=margin-bottom:6px>' + EscapeHtml(node.sessions.help[j]) + '</div>'; } }
if (node.sessions.help != null) { for (var j in node.sessions.help) { x += '<div style="background-color:#CCC;padding:6px;border-radius:6px"><a style="float:right" onclick=closeDeviceHelpRequest("' + encodeURIComponentEx(j) + '","' + encodeURIComponentEx(node._id) + '")>' + "Dismiss" + '</a><div style=margin-bottom:6px><b>' + EscapeHtml(j) + '</b></div><div style=margin-bottom:6px>' + EscapeHtml(node.sessions.help[j]) + '</div></div>'; } }
if (x != '') { setDialogMode(2, "Help Requests" + ' - ' + EscapeHtml(node.name), 1, null, x, 'HELPREQ-' + node._id); } else { setDialogMode(0); }
return false;
}
function closeDeviceHelpRequest(appid, nodeid) {
setDialogMode(0);
meshserver.send({ action: 'msg', type: 'localapp', nodeid: decodeURIComponent(nodeid), appid: decodeURIComponent(appid), value: { cmd: "cancelhelp" } });
}
// Show currently active sessions on this device
function showDeviceSessions(nodeid, force, e) {
if (e) haltEvent(e);