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

Compare commits

..

No commits in common. "master" and "1.1.41" have entirely different histories.

13 changed files with 10088 additions and 10493 deletions

Binary file not shown.

Binary file not shown.

View file

@ -295,9 +295,8 @@ if (process.platform == 'win32' && require('user-sessions').isRoot()) {
// Check the Agent Uninstall MetaData for correctness, as the installer may have written an incorrect value
try {
var writtenSize = 0, actualSize = Math.floor(require('fs').statSync(process.execPath).size / 1024);
var serviceName = (_MSH().serviceName ? _MSH().serviceName : (require('_agentNodeId').serviceName() ? require('_agentNodeId').serviceName() : 'Mesh Agent'));
try { writtenSize = require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\' + serviceName, 'EstimatedSize'); } catch (ex) { }
if (writtenSize != actualSize) { try { require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\' + serviceName, 'EstimatedSize', actualSize); } catch (ex) { } }
try { writtenSize = require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeshCentralAgent', 'EstimatedSize'); } catch (ex) { }
if (writtenSize != actualSize) { try { require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeshCentralAgent', 'EstimatedSize', actualSize); } catch (ex) { } }
} catch (ex) { }
// Check to see if we are the Installed Mesh Agent Service, if we are, make sure we can run in Safe Mode
@ -311,16 +310,6 @@ if (process.platform == 'win32' && require('user-sessions').isRoot()) {
try { meshCheck = require('service-manager').manager.getService(svcname).isMe(); } catch (ex) { }
if (meshCheck && require('win-bcd').isSafeModeService && !require('win-bcd').isSafeModeService(svcname)) { require('win-bcd').enableSafeModeService(svcname); }
} catch (ex) { }
// Check the Agent Uninstall MetaData for DisplayVersion and update if not the same and only on windows
if (process.platform == 'win32') {
try {
var writtenDisplayVersion = 0, actualDisplayVersion = process.versions.commitDate.toString();
var serviceName = (_MSH().serviceName ? _MSH().serviceName : (require('_agentNodeId').serviceName() ? require('_agentNodeId').serviceName() : 'Mesh Agent'));
try { writtenDisplayVersion = require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\' + serviceName, 'DisplayVersion'); } catch (ex) { }
if (writtenDisplayVersion != actualDisplayVersion) { try { require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\' + serviceName, 'DisplayVersion', actualDisplayVersion); } catch (ex) { } }
} catch (ex) { }
}
}
if (process.platform != 'win32') {
@ -4584,11 +4573,10 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
if (process.platform == 'win32') {
// Check the Agent Uninstall MetaData for correctness, as the installer may have written an incorrect value
var writtenSize = 0;
var serviceName = (_MSH().serviceName ? _MSH().serviceName : (require('_agentNodeId').serviceName() ? require('_agentNodeId').serviceName() : 'Mesh Agent'));
try { writtenSize = require('win-registry').QueryKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\' + serviceName, 'EstimatedSize'); } catch (ex) { response = ex; }
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) {
response = "Size updated from: " + writtenSize + " to: " + actualSize;
try { require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\' + serviceName, 'EstimatedSize', actualSize); } catch (ex) { response = ex; }
try { require('win-registry').WriteKey(require('win-registry').HKEY.LocalMachine, 'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeshCentralAgent', 'EstimatedSize', actualSize); } catch (ex) { response = ex; }
} else
{ response = "Agent Size: " + actualSize + " kb"; }
} else
@ -5668,7 +5656,7 @@ function windows_execve(name, agentfilename, sessionid) {
sendAgentMessage('Self Update failed because msvcrt.dll is missing', 3);
return;
}
var cmd = require('_GenericMarshal').CreateVariable(process.env['windir'] + '\\system32\\cmd.exe', { wide: true });
var args = require('_GenericMarshal').CreateVariable(3 * require('_GenericMarshal').PointerSize);
var arg1 = require('_GenericMarshal').CreateVariable('cmd.exe', { wide: true });

View file

@ -601,11 +601,11 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
}
if (typeof domain.userconsentflags == 'number') { serverinfo.consent = domain.userconsentflags; }
if ((typeof domain.usersessionidletimeout == 'number') && (domain.usersessionidletimeout > 0)) {serverinfo.timeout = (domain.usersessionidletimeout * 60 * 1000); }
if (typeof domain.logoutonidlesessiontimeout == 'boolean') {
serverinfo.logoutonidlesessiontimeout = domain.logoutonidlesessiontimeout;
if (typeof domain.logoutOnIdleSessionTimeout == 'boolean') {
serverinfo.logoutOnIdleSessionTimeout = domain.logoutOnIdleSessionTimeout;
} else {
// Default
serverinfo.logoutonidlesessiontimeout = true;
serverinfo.logoutOnIdleSessionTimeout = true;
}
if (user.siteadmin === SITERIGHT_ADMIN) {
if (parent.parent.config.settings.managealldevicegroups.indexOf(user._id) >= 0) { serverinfo.manageAllDeviceGroups = true; }

View file

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

View file

@ -139,7 +139,7 @@ module.exports.pluginHandler = function (parent) {
try {
obj.plugins[p][hookName](...args);
} catch (e) {
console.log("Error occurred while running plugin hook " + p + ':' + hookName, e);
console.log("Error occurred while running plugin hook" + p + ':' + hookName + ' (' + e + ')');
}
}
}

File diff suppressed because one or more lines are too long

View file

@ -39,7 +39,6 @@ var meshCentralSourceFiles = [
"../views/messenger.handlebars",
"../views/player.handlebars",
"../views/sharing.handlebars",
"../views/sharing-mobile.handlebars",
"../views/mstsc.handlebars",
"../views/ssh.handlebars",
"../emails/account-check.html",

File diff suppressed because it is too large Load diff

View file

@ -1524,22 +1524,8 @@
function setSessionActivity() { sessionActivity = Date.now(); }
function checkIdleSessionTimeout() {
var delta = (Date.now() - sessionActivity);
if (delta > serverinfo.timeout) {
if (desktop != null) { // Disconnect remote desktop
desktop.Stop();
desktopNode = desktop = null;
}
if (terminal != null) { // Disconnect terminal
terminal.Stop();
terminal = null;
}
if (files != null) { // Disconnect files
files.Stop();
files = null;
}
if (serverinfo.logoutonidlesessiontimeout) {
window.location.href = 'logout';
}
if (delta > serverinfo.timeout && serverinfo.logoutOnIdleSessionTimeout) {
window.location.href = 'logout';
}
}
@ -6819,19 +6805,7 @@
if (e.shiftKey == true) { meshserver.send({ action: 'uploadagentcore', nodeid: consoleNode._id, type: 'default' }); } // Upload default core
else if (e.altKey == true) { meshserver.send({ action: 'uploadagentcore', nodeid: consoleNode._id, type: 'clear' }); } // Clear the core
else if (e.ctrlKey == true) { p15uploadCore2(); } // Upload the core from a file
else {
var htmlValue = '<select id=d3coreMode style=width:230px>' +
'<option value=1>' + "Upload default server core" + '</option>' +
'<option value=2>' + "Clear the core" + '</option>' +
'<option value=3>' + "Upload a core file" + '</option>' +
'<option value=4>' + "Soft disconnect agent" + '</option>' +
'<option value=5>' + "Hard disconnect agent" + '</option>' +
'<option value=6>' + "Upload recovery core" + '</option>' +
'<option value=7>' + "Upload tiny core" + '</option>' +
'<option value=8>' + "Restart agent service" + '</option>' +
'<option value=9>' + "Force agent update" + '</option></select>';
setDialogMode(2, "Perform Agent Action", 3, p15uploadCoreEx, addHtmlValue("Action", htmlValue));
}
else { setDialogMode(2, "Perform Agent Action", 3, p15uploadCoreEx, addHtmlValue("Action", '<select id=d3coreMode style=width:230px><option value=1>' + "Upload default server core" + '</option><option value=2>' + "Clear the core" + '</option><option value=6>' + "Upload recovery core" + '</option><option value=7>' + "Upload tiny core" + '</option><option value=3>' + "Upload a core file" + '</option><option value=4>' + "Soft disconnect agent" + '</option><option value=5>' + "Hard disconnect agent" + '</option><option value=8>' + "Restart agent service" + '</select>')); }
}
function p15uploadCoreEx() {
@ -6859,9 +6833,6 @@
} else if (Q('d3coreMode').value == 8) {
// Restart MeshAgent service
meshserver.send({ action: 'msg', type: 'console', nodeid: consoleNode._id, value:'service restart' });
} else if (Q('d3coreMode').value == 9) {
// Update mesh agent
meshserver.send({ action: 'updateAgents', nodeids: [consoleNode._id] });
}
}

View file

@ -2447,28 +2447,17 @@
files.Stop();
files = null;
}
if (serverinfo.logoutonidlesessiontimeout) {
if (serverinfo.logoutOnIdleSessionTimeout) {
window.location.href = 'logout';
}
} else {
var ds = Math.round((serverinfo.timeout - delta) / 1000);
var sessionInProgress = desktop != null || terminal != null || files != null;
var show = serverinfo.logoutonidlesessiontimeout || sessionInProgress;
var isLogout = serverinfo.logoutonidlesessiontimeout;
var theText = ''; // Initialize theText
if (ds <= 60) {
theText = isLogout
? (ds == 1 ? "1 second until logout" : "{0} seconds until logout")
: (ds == 1 ? "1 second until disconnect" : "{0} seconds until disconnect");
QH('idleTimeoutNotify', '<br />' + format((ds == 1)?"1 second until disconnect":"{0} seconds until disconnect", ds));
} else {
ds = Math.round(ds / 60);
if (ds <= 5) {
theText = isLogout
? (ds == 1 ? "1 minute until logout" : "{0} minutes until logout")
: (ds == 1 ? "1 minute until disconnect" : "{0} minutes until disconnect");
}
if (ds <= 5) { QH('idleTimeoutNotify', '<br />' + format((ds == 1)?"1 minute until disconnect":"{0} minutes until disconnect", ds)); }
}
QH('idleTimeoutNotify', show && theText ? '<br />' + format(theText, ds) : '');
}
}
@ -11367,7 +11356,7 @@
}
function p13openfilefolder() {
setDialogMode(2, "Open File/Folder", 3, p13openfilefolderEx, "Are you sure you want to open this file/folder on the remote devices desktop?");
setDialogMode(2, "Open File/Folder", 3, p13openfilefolderEx, "Are you sure you want to open this file/folder on the remote devices desktop ?");
}
function p13openfilefolderEx() {
var openfilefolder = "", checkboxes = document.getElementsByName('fd');
@ -12744,19 +12733,7 @@
if (e.shiftKey == true) { meshserver.send({ action: 'uploadagentcore', nodeids: [ consoleNode._id ], type: 'default' }); } // Upload default core
else if (e.altKey == true) { meshserver.send({ action: 'uploadagentcore', nodeids: [ consoleNode._id ], type: 'clear' }); } // Clear the core
else if (e.ctrlKey == true) { p15uploadCore2(); } // Upload the core from a file
else {
var htmlValue = '<select id=d3coreMode style=width:230px>' +
'<option value=1>' + "Upload default server core" + '</option>' +
'<option value=2>' + "Clear the core" + '</option>' +
'<option value=3>' + "Upload a core file" + '</option>' +
'<option value=4>' + "Soft disconnect agent" + '</option>' +
'<option value=5>' + "Hard disconnect agent" + '</option>' +
'<option value=6>' + "Upload recovery core" + '</option>' +
'<option value=7>' + "Upload tiny core" + '</option>' +
'<option value=8>' + "Restart agent service" + '</option>' +
'<option value=9>' + "Force agent update" + '</option></select>';
setDialogMode(2, "Perform Agent Action", 3, p15uploadCoreEx, addHtmlValue("Action", htmlValue));
}
else { setDialogMode(2, "Perform Agent Action", 3, p15uploadCoreEx, addHtmlValue("Action", '<select id=d3coreMode style=width:230px><option value=1>' + "Upload default server core" + '</option><option value=2>' + "Clear the core" + '</option><option value=6>' + "Upload recovery core" + '</option><option value=7>' + "Upload tiny core" + '</option><option value=3>' + "Upload a core file" + '</option><option value=4>' + "Soft disconnect agent" + '</option><option value=5>' + "Hard disconnect agent" + '</option><option value=8>' + "Restart agent service" + '</select>')); }
}
function p15uploadCoreEx() {
@ -12784,9 +12761,6 @@
} else if (Q('d3coreMode').value == 8) {
// Restart MeshAgent service
meshserver.send({ action: 'msg', type: 'console', nodeid: consoleNode._id, value:'service restart' });
} else if (Q('d3coreMode').value == 9) {
// Update mesh agent
meshserver.send({ action: 'updateAgents', nodeids: [ consoleNode._id ] });
}
}

View file

@ -2897,28 +2897,17 @@
files.Stop();
files = null;
}
if (serverinfo.logoutonidlesessiontimeout) {
if (serverinfo.logoutOnIdleSessionTimeout) {
window.location.href = 'logout';
}
} else {
var ds = Math.round((serverinfo.timeout - delta) / 1000);
var sessionInProgress = (desktop != null || terminal != null || files != null);
var show = serverinfo.logoutonidlesessiontimeout || sessionInProgress;
var isLogout = serverinfo.logoutonidlesessiontimeout;
var theText = '';
if (ds <= 60) {
theText = isLogout
? (ds == 1 ? "1 second until logout" : "{0} seconds until logout")
: (ds == 1 ? "1 second until disconnect" : "{0} seconds until disconnect");
QH('idleTimeoutNotify', '<br />' + format((ds == 1) ? "1 second until disconnect" : "{0} seconds until disconnect", ds));
} else {
ds = Math.round(ds / 60);
if (ds <= 5) {
theText = isLogout
? (ds == 1 ? "1 minute until logout" : "{0} minutes until logout")
: (ds == 1 ? "1 minute until disconnect" : "{0} minutes until disconnect");
}
if (ds <= 5) { QH('idleTimeoutNotify', '<br />' + format((ds == 1) ? "1 minute until disconnect" : "{0} minutes until disconnect", ds)); }
}
QH('idleTimeoutNotify', show && theText ? '<br />' + format(theText, ds) : '');
}
}
@ -12161,7 +12150,7 @@
}
function p13openfilefolder() {
setModalContent('xxAddAgent', "Open File/Folder", "Are you sure you want to open this file/folder on the remote devices desktop?");
setModalContent('xxAddAgent', "Open File/Folder", 'Are you sure you want to open this file/folder on the remote devices desktop ?');
showModal('xxAddAgentModal', 'idx_dlgOkButton', () => p13openfilefolderEx());
}
function p13openfilefolderEx() {
@ -13578,17 +13567,7 @@
else if (e.altKey == true) { meshserver.send({ action: 'uploadagentcore', nodeids: [consoleNode._id], type: 'clear' }); } // Clear the core
else if (e.ctrlKey == true) { p15uploadCore2(); } // Upload the core from a file
else {
var htmlValue = '<select id=d3coreMode class="form-select me-2">' +
'<option value=1>' + "Upload default server core" + '</option>' +
'<option value=2>' + "Clear the core" + '</option>' +
'<option value=3>' + "Upload a core file" + '</option>' +
'<option value=4>' + "Soft disconnect agent" + '</option>' +
'<option value=5>' + "Hard disconnect agent" + '</option>' +
'<option value=6>' + "Upload recovery core" + '</option>' +
'<option value=7>' + "Upload tiny core" + '</option>' +
'<option value=8>' + "Restart agent service" + '</option>' +
'<option value=9>' + "Force agent update" + '</option></select>';
setModalContent('xxAddAgent', "Perform Agent Action", addHtmlFormFloating("Action", htmlValue));
setModalContent('xxAddAgent', "Perform Agent Action", addHtmlFormFloating("Action", '<select id=d3coreMode class="form-select me-2"><option value=1>' + "Upload default server core" + '</option><option value=2>' + "Clear the core" + '</option><option value=6>' + "Upload recovery core" + '</option><option value=7>' + "Upload tiny core" + '</option><option value=3>' + "Upload a core file" + '</option><option value=4>' + "Soft disconnect agent" + '</option><option value=5>' + "Hard disconnect agent" + '</option><option value=8>' + "Restart agent service" + '</select>'));
showModal('xxAddAgentModal', 'idx_dlgOkButton', p15uploadCoreEx);
}
}
@ -13618,9 +13597,6 @@
} else if (Q('d3coreMode').value == 8) {
// Restart MeshAgent service
meshserver.send({ action: 'msg', type: 'console', nodeid: consoleNode._id, value:'service restart' });
} else if (Q('d3coreMode').value == 9) {
// Update mesh agent
meshserver.send({ action: 'updateAgents', nodeids: [consoleNode._id] });
}
}

View file

@ -746,7 +746,7 @@
var domainUrl = '{{{domainurl}}}';
var authCookie = '{{{authCookie}}}';
var authRelayCookie = '{{{authRelayCookie}}}';
var viewOnly = parseInt('{{{viewOnly}}}');
var viewOnly = (parseInt('{{{viewOnly}}}') == 1);
var authCookieRenewTimer = null;
var serverPublicNamePort = '{{{serverDnsName}}}:{{{serverPublicPort}}}';
var debugmode = false;
@ -822,22 +822,8 @@
function setSessionActivity() { sessionActivity = Date.now(); }
function checkIdleSessionTimeout() {
var delta = (Date.now() - sessionActivity);
if (delta > serverinfo.timeout) {
if (desktop != null) { // Disconnect remote desktop
desktop.Stop();
desktopNode = desktop = null;
}
if (terminal != null) { // Disconnect terminal
terminal.Stop();
terminal = null;
}
if (files != null) { // Disconnect files
files.Stop();
files = null;
}
if (serverinfo.logoutonidlesessiontimeout) {
window.location.href = 'logout';
}
if (delta > serverinfo.timeout && serverinfo.logoutOnIdleSessionTimeout) {
window.location.href = 'logout';
}
}
@ -864,7 +850,7 @@
gotKeyPressEvent = true;
Q('softKeyboard').value = '';
// Check what keys we are allows to send
if (viewOnly == 1) return false;
if (viewOnly) return false;
return desktop.m.handleKeys(e);
}
if (terminal && !xxdialogMode && (xxcurrentView == 10) && (currentDevicePanel == 5) && (t !== 1)) {
@ -892,7 +878,7 @@
gotKeyPressEvent = false;
Q('softKeyboard').value = '';
// Check what keys we are allows to send
if (viewOnly == 1) return false;
if (viewOnly) return false;
return desktop.m.handleKeyDown(e);
}
if (terminal && !xxdialogMode && (xxcurrentView == 10) && (currentDevicePanel == 5) && (t !== 1)) {
@ -921,7 +907,7 @@
var inputStr = Q('softKeyboard').value;
Q('softKeyboard').value = '';
// Check what keys we are allows to send
if (viewOnly == 1) return;
if (viewOnly) return;
if ((gotKeyPressEvent == false) && (inputStr.length > 0) && desktop.m.SendKeyUnicode) {
// This is a mobile keyboard, we need to send that is in the input control.
var inputchar = inputStr[inputStr.length - 1].charCodeAt(0);
@ -1081,7 +1067,6 @@
desktop = CreateAmtRedirect(CreateAmtRemoteDesktop('Desk'), authCookie);
desktop.debugmode = debugmode;
desktop.onStateChanged = onDesktopStateChange;
desktop.m.stopInput = (viewOnly == 1);
desktop.m.bpp = (desktopsettings.encoding == 1 || desktopsettings.encoding == 3) ? 1 : 2;
desktop.m.useZRLE = (desktopsettings.encoding < 3);
desktop.m.showmouse = true;
@ -1091,8 +1076,6 @@
} else if ((contype == null) || (contype == 1) || ((contype == 3))) {
// Setup the Mesh Agent remote desktop
desktop = CreateAgentRedirect(null, CreateAgentRemoteDesktop('Desk'), serverPublicNamePort, authCookie, null, domainUrl);
desktop.m.stopInput = (viewOnly == 1);
desktop.m.mouseCursorActive(true);
desktop.debugmode = debugmode;
desktop.m.debugmode = debugmode;
desktop.attemptWebRTC = attemptWebRTC;
@ -1464,7 +1447,7 @@
QV('deskarea4', !fullscreen);
QV('termarea1', !fullscreen);
QV('termarea4', !fullscreen);
var inputAllowed = (viewOnly == 0);
var inputAllowed = !viewOnly;
// Show full screen buttons if needed
QV('deskkeybutton1', fullscreen);