More MeshCore cleanup.

This commit is contained in:
Ylian Saint-Hilaire 2022-01-16 19:12:13 -08:00
parent 43682bf47f
commit 47a215951f
3 changed files with 9 additions and 5028 deletions

View File

@ -22,7 +22,7 @@
<ItemGroup> <ItemGroup>
<Compile Include="agents\meshcmd.js" /> <Compile Include="agents\meshcmd.js" />
<Compile Include="agents\meshcmd.min.js" /> <Compile Include="agents\meshcmd.min.js" />
<Compile Include="agents\meshcore.js" /> <Compile Include="agents\meshcore-clean.js" />
<Compile Include="agents\meshcore.min.js" /> <Compile Include="agents\meshcore.min.js" />
<Compile Include="agents\meshinstall-linux.js" /> <Compile Include="agents\meshinstall-linux.js" />
<Compile Include="agents\modules_meshcmd\amt-apfclient.js" /> <Compile Include="agents\modules_meshcmd\amt-apfclient.js" />

File diff suppressed because it is too large Load Diff

View File

@ -1122,7 +1122,7 @@ function handleServerCommand(data) {
// Kill a process // Kill a process
if (data.value) { if (data.value) {
MeshServerLogEx(19, [data.value], "Killing process " + data.value, data); MeshServerLogEx(19, [data.value], "Killing process " + data.value, data);
try { process.kill(data.value); } catch (ex) { sendConsoleText("pskill: " + JSON.stringify(e)); } try { process.kill(data.value); } catch (ex) { sendConsoleText("pskill: " + JSON.stringify(ex)); }
} }
break; break;
} }
@ -1188,7 +1188,7 @@ function handleServerCommand(data) {
require('linux-gnome-helpers').setDesktopWallpaper(id, current != '/dev/null' ? undefined : require('MeshAgent')._wallpaper); require('linux-gnome-helpers').setDesktopWallpaper(id, current != '/dev/null' ? undefined : require('MeshAgent')._wallpaper);
} }
} catch (ex) { } catch (ex) {
sendConsoleText(e); sendConsoleText(ex);
} }
break; break;
} }
@ -1683,7 +1683,7 @@ function getSystemInformation(func) {
func(results); func(results);
} }
*/ */
} catch (ex) { func(null, e); } } catch (ex) { func(null, ex); }
} }
// Get a formated response for a given directory path // Get a formated response for a given directory path
@ -2446,8 +2446,7 @@ function onTunnelData(data) {
try { try {
this.ws.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.ws.httprequest.privacybartext.replace('{0}', this.ws.httprequest.desktop.kvm.rusers.join(', ')).replace('{1}', this.ws.httprequest.desktop.kvm.users.join(', ')), require('MeshAgent')._tsid); this.ws.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.ws.httprequest.privacybartext.replace('{0}', this.ws.httprequest.desktop.kvm.rusers.join(', ')).replace('{1}', this.ws.httprequest.desktop.kvm.users.join(', ')), require('MeshAgent')._tsid);
MeshServerLogEx(31, null, "Remote Desktop Connection Bar Activated/Updated (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest); MeshServerLogEx(31, null, "Remote Desktop Connection Bar Activated/Updated (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest);
} } catch (ex) {
catch (ex) {
if (process.platform != 'darwin') { if (process.platform != 'darwin') {
MeshServerLogEx(32, null, "Remote Desktop Connection Bar Failed or Not Supported (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest); MeshServerLogEx(32, null, "Remote Desktop Connection Bar Failed or Not Supported (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest);
} }
@ -2499,8 +2498,7 @@ function onTunnelData(data) {
try { try {
this.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.httprequest.privacybartext.replace('{0}', this.httprequest.desktop.kvm.rusers.join(', ')).replace('{1}', this.httprequest.desktop.kvm.users.join(', ')), require('MeshAgent')._tsid); this.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.httprequest.privacybartext.replace('{0}', this.httprequest.desktop.kvm.rusers.join(', ')).replace('{1}', this.httprequest.desktop.kvm.users.join(', ')), require('MeshAgent')._tsid);
MeshServerLogEx(31, null, "Remote Desktop Connection Bar Activated/Updated (" + this.httprequest.remoteaddr + ")", this.httprequest); MeshServerLogEx(31, null, "Remote Desktop Connection Bar Activated/Updated (" + this.httprequest.remoteaddr + ")", this.httprequest);
} } catch (ex) {
catch (ex) {
MeshServerLogEx(32, null, "Remote Desktop Connection Bar Failed or not Supported (" + this.httprequest.remoteaddr + ")", this.httprequest); MeshServerLogEx(32, null, "Remote Desktop Connection Bar Failed or not Supported (" + this.httprequest.remoteaddr + ")", this.httprequest);
} }
if (this.httprequest.desktop.kvm.connectionBar) { if (this.httprequest.desktop.kvm.connectionBar) {
@ -2906,7 +2904,7 @@ function onTunnelData(data) {
switch (cmd.action) { switch (cmd.action) {
case 'plugin': { case 'plugin': {
try { require(cmd.plugin).consoleaction(cmd, null, null, this); } catch (ex) { throw e; } try { require(cmd.plugin).consoleaction(cmd, null, null, this); } catch (ex) { throw ex; }
break; break;
} }
default: { default: {
@ -3577,10 +3575,10 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
if (process.platform == 'win32') { if (process.platform == 'win32') {
// Check the Agent Uninstall MetaData for correctness, as the installer may have written an incorrect value // Check the Agent Uninstall MetaData for correctness, as the installer may have written an incorrect value
var writtenSize = 0; var writtenSize = 0;
try { writtenSize = require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeshCentralAgent', 'EstimatedSize'); } catch (ex) { response = e; } try { writtenSize = require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeshCentralAgent', 'EstimatedSize'); } catch (ex) { response = ex; }
if (writtenSize != actualSize) { if (writtenSize != actualSize) {
response = "Size updated from: " + writtenSize + " to: " + actualSize; response = "Size updated from: " + writtenSize + " to: " + actualSize;
try { require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeshCentralAgent', 'EstimatedSize', actualSize); } catch (ex) { response = e; } try { require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeshCentralAgent', 'EstimatedSize', actualSize); } catch (ex) { response = ex; }
} else } else
{ response = "Agent Size: " + actualSize + " kb"; } { response = "Agent Size: " + actualSize + " kb"; }
} else } else