Fixed desktop/terminal on platfroms that don't support user notification.

This commit is contained in:
Ylian Saint-Hilaire 2019-05-08 16:18:44 -07:00
parent 51ad07cb73
commit 885b10f975
5 changed files with 20 additions and 17 deletions

View File

@ -525,7 +525,9 @@ function createMeshCore(agent) {
} }
case 'toast': { case 'toast': {
// Display a toast message // Display a toast message
if (data.title && data.msg) { require('toaster').Toast(data.title, data.msg); } if (data.title && data.msg) {
try { require('toaster').Toast(data.title, data.msg); } catch (ex) { }
}
break; break;
} }
case 'openUrl': { case 'openUrl': {
@ -736,9 +738,9 @@ function createMeshCore(agent) {
return; return;
} }
// Perform notification if needed // Perform notification if needed. Toast messages may not be supported on all platforms.
if (this.httprequest.consent && (this.httprequest.consent & 2)) { if (this.httprequest.consent && (this.httprequest.consent & 2)) {
require('toaster').Toast('MeshCentral', this.httprequest.username + ' started a remote terminal session.'); try { require('toaster').Toast('MeshCentral', this.httprequest.username + ' started a remote terminal session.'); } catch (ex) { }
} }
// Remote terminal using native pipes // Remote terminal using native pipes
@ -794,9 +796,9 @@ function createMeshCore(agent) {
return; return;
} }
// Perform notification if needed // Perform notification if needed. Toast messages may not be supported on all platforms.
if (this.httprequest.consent && (this.httprequest.consent & 1)) { if (this.httprequest.consent && (this.httprequest.consent & 1)) {
require('toaster').Toast('MeshCentral', this.httprequest.username + ' started a remote desktop session.'); try { require('toaster').Toast('MeshCentral', this.httprequest.username + ' started a remote desktop session.'); } catch (ex) { }
} }
// Remote desktop using native pipes // Remote desktop using native pipes
@ -818,8 +820,9 @@ function createMeshCore(agent) {
} }
if (this.desktop.kvm.connectionCount == 0) { if (this.desktop.kvm.connectionCount == 0) {
// Display a toast message // Display a toast message. This may not be supported on all platforms.
//require('toaster').Toast('MeshCentral', 'Remote Desktop Control Ended.'); // try { require('toaster').Toast('MeshCentral', 'Remote Desktop Control Ended.'); } catch (ex) { }
this.httprequest.desktop.kvm.end(); this.httprequest.desktop.kvm.end();
} }
}; };
@ -850,7 +853,7 @@ function createMeshCore(agent) {
// Perform notification if needed // Perform notification if needed
if (this.httprequest.consent && (this.httprequest.consent & 4)) { if (this.httprequest.consent && (this.httprequest.consent & 4)) {
require('toaster').Toast('MeshCentral', this.httprequest.username + ' started a remote file access.'); try { require('toaster').Toast('MeshCentral', this.httprequest.username + ' started a remote file access.'); } catch (ex) { }
} }
// Setup files // Setup files
@ -1277,8 +1280,7 @@ function createMeshCore(agent) {
case 'toast': { case 'toast': {
if (process.platform == 'win32') { if (process.platform == 'win32') {
if (args['_'].length < 1) { response = 'Proper usage: toast "message"'; } else { if (args['_'].length < 1) { response = 'Proper usage: toast "message"'; } else {
require('toaster').Toast('MeshCentral', args['_'][0]); try { require('toaster').Toast('MeshCentral', args['_'][0]); response = 'ok'; } catch (ex) { response = ex; }
response = 'ok';
} }
} else { } else {
response = 'Only supported on Windows.'; response = 'Only supported on Windows.';
@ -1718,9 +1720,11 @@ function createMeshCore(agent) {
// Update the network interfaces information data // Update the network interfaces information data
var netInfo = mesh.NetInfo; var netInfo = mesh.NetInfo;
netInfo.action = 'netinfo'; if (netInfo) {
var netInfoStr = JSON.stringify(netInfo); netInfo.action = 'netinfo';
if ((force == true) || (clearGatewayMac(netInfoStr) != clearGatewayMac(lastNetworkInfo))) { mesh.SendCommand(netInfo); lastNetworkInfo = netInfoStr; } var netInfoStr = JSON.stringify(netInfo);
if ((force == true) || (clearGatewayMac(netInfoStr) != clearGatewayMac(lastNetworkInfo))) { mesh.SendCommand(netInfo); lastNetworkInfo = netInfoStr; }
}
} }
// Called periodically to check if we need to send updates to the server // Called periodically to check if we need to send updates to the server

File diff suppressed because one or more lines are too long

View File

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

File diff suppressed because one or more lines are too long

View File

@ -3832,7 +3832,6 @@
if (terminalAccess) { setupTerminal(); } if (terminalAccess) { setupTerminal(); }
if (fileAccess) { setupFiles(); } if (fileAccess) { setupFiles(); }
var consoleRights = ((meshrights & 16) != 0); var consoleRights = ((meshrights & 16) != 0);
console.log('consoleRights', consoleRights);
if (consoleRights) { setupConsole(); } else { if (panel == 15) { panel = 10; } } if (consoleRights) { setupConsole(); } else { if (panel == 15) { panel = 10; } }
// Show or hide the tabs // Show or hide the tabs