mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-02-09 04:38:07 -05:00
Fixed user group permissions in web app.
This commit is contained in:
commit
0876ae6ac7
Binary file not shown.
@ -1788,6 +1788,51 @@ function createMeshCore(agent) {
|
|||||||
response = 'Available commands: \r\n' + fin + '.';
|
response = 'Available commands: \r\n' + fin + '.';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 'wallpaper':
|
||||||
|
if (process.platform != 'win32')
|
||||||
|
{
|
||||||
|
response = 'wallpaper only supported on Windows Platforms'
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (args['_'].length != 1)
|
||||||
|
{
|
||||||
|
response = 'Proper usage: wallpaper (GET|TOGGLE)'; // Display usage
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (args['_'][0].toUpperCase())
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
response = 'Proper usage: wallpaper (GET|TOGGLE)'; // Display usage
|
||||||
|
break;
|
||||||
|
case 'GET':
|
||||||
|
case 'TOGGLE':
|
||||||
|
var id = require('user-sessions').getProcessOwnerName(process.pid).tsid == 0 ? 1 : 0;
|
||||||
|
var child = require('child_process').execFile(process.execPath, [process.execPath.split('\\').pop(), '-b64exec', 'dmFyIFNQSV9HRVRERVNLV0FMTFBBUEVSID0gMHgwMDczOwp2YXIgU1BJX1NFVERFU0tXQUxMUEFQRVIgPSAweDAwMTQ7CnZhciBHTSA9IHJlcXVpcmUoJ19HZW5lcmljTWFyc2hhbCcpOwp2YXIgdXNlcjMyID0gR00uQ3JlYXRlTmF0aXZlUHJveHkoJ3VzZXIzMi5kbGwnKTsKdXNlcjMyLkNyZWF0ZU1ldGhvZCgnU3lzdGVtUGFyYW1ldGVyc0luZm9BJyk7CgppZiAocHJvY2Vzcy5hcmd2Lmxlbmd0aCA9PSAzKQp7CiAgICB2YXIgdiA9IEdNLkNyZWF0ZVZhcmlhYmxlKDEwMjQpOwogICAgdXNlcjMyLlN5c3RlbVBhcmFtZXRlcnNJbmZvQShTUElfR0VUREVTS1dBTExQQVBFUiwgdi5fc2l6ZSwgdiwgMCk7CiAgICBjb25zb2xlLmxvZyh2LlN0cmluZyk7CiAgICBwcm9jZXNzLmV4aXQoKTsKfQplbHNlCnsKICAgIHZhciBuYiA9IEdNLkNyZWF0ZVZhcmlhYmxlKHByb2Nlc3MuYXJndlszXSk7CiAgICB1c2VyMzIuU3lzdGVtUGFyYW1ldGVyc0luZm9BKFNQSV9TRVRERVNLV0FMTFBBUEVSLCBuYi5fc2l6ZSwgbmIsIDApOwogICAgcHJvY2Vzcy5leGl0KCk7Cn0='], { type: id });
|
||||||
|
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
|
||||||
|
child.stderr.on('data', function () { });
|
||||||
|
child.waitExit();
|
||||||
|
var current = child.stdout.str.trim();
|
||||||
|
if(args['_'][0].toUpperCase() == 'GET')
|
||||||
|
{
|
||||||
|
response = current;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (current != '')
|
||||||
|
{
|
||||||
|
require('MeshAgent')._wallpaper = current;
|
||||||
|
}
|
||||||
|
child = require('child_process').execFile(process.execPath, [process.execPath.split('\\').pop(), '-b64exec', 'dmFyIFNQSV9HRVRERVNLV0FMTFBBUEVSID0gMHgwMDczOwp2YXIgU1BJX1NFVERFU0tXQUxMUEFQRVIgPSAweDAwMTQ7CnZhciBHTSA9IHJlcXVpcmUoJ19HZW5lcmljTWFyc2hhbCcpOwp2YXIgdXNlcjMyID0gR00uQ3JlYXRlTmF0aXZlUHJveHkoJ3VzZXIzMi5kbGwnKTsKdXNlcjMyLkNyZWF0ZU1ldGhvZCgnU3lzdGVtUGFyYW1ldGVyc0luZm9BJyk7CgppZiAocHJvY2Vzcy5hcmd2Lmxlbmd0aCA9PSAzKQp7CiAgICB2YXIgdiA9IEdNLkNyZWF0ZVZhcmlhYmxlKDEwMjQpOwogICAgdXNlcjMyLlN5c3RlbVBhcmFtZXRlcnNJbmZvQShTUElfR0VUREVTS1dBTExQQVBFUiwgdi5fc2l6ZSwgdiwgMCk7CiAgICBjb25zb2xlLmxvZyh2LlN0cmluZyk7CiAgICBwcm9jZXNzLmV4aXQoKTsKfQplbHNlCnsKICAgIHZhciBuYiA9IEdNLkNyZWF0ZVZhcmlhYmxlKHByb2Nlc3MuYXJndlszXSk7CiAgICB1c2VyMzIuU3lzdGVtUGFyYW1ldGVyc0luZm9BKFNQSV9TRVRERVNLV0FMTFBBUEVSLCBuYi5fc2l6ZSwgbmIsIDApOwogICAgcHJvY2Vzcy5leGl0KCk7Cn0=', current != '' ? '""' : require('MeshAgent')._wallpaper], { type: id });
|
||||||
|
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
|
||||||
|
child.stderr.on('data', function () { });
|
||||||
|
child.waitExit();
|
||||||
|
response = 'OK';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'safemode':
|
case 'safemode':
|
||||||
if (process.platform != 'win32')
|
if (process.platform != 'win32')
|
||||||
{
|
{
|
||||||
|
@ -1932,8 +1932,10 @@ function InstallModules(modules, func) {
|
|||||||
var missingModules = [];
|
var missingModules = [];
|
||||||
if (modules.length > 0) {
|
if (modules.length > 0) {
|
||||||
for (var i in modules) {
|
for (var i in modules) {
|
||||||
|
// Modules may contain a version tag (foobar@1.0.0), remove it so the module can be found using require
|
||||||
|
var moduleName = modules[i].split("@", 1)[0];
|
||||||
try {
|
try {
|
||||||
var xxmodule = require(modules[i]);
|
require(moduleName);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (previouslyInstalledModules[modules[i]] !== true) { missingModules.push(modules[i]); }
|
if (previouslyInstalledModules[modules[i]] !== true) { missingModules.push(modules[i]); }
|
||||||
}
|
}
|
||||||
@ -1943,7 +1945,6 @@ function InstallModules(modules, func) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if a module is present and install it if missing
|
// Check if a module is present and install it if missing
|
||||||
var InstallModuleChildProcess = null;
|
|
||||||
function InstallModule(modulename, func, tag1, tag2) {
|
function InstallModule(modulename, func, tag1, tag2) {
|
||||||
console.log('Installing ' + modulename + '...');
|
console.log('Installing ' + modulename + '...');
|
||||||
var child_process = require('child_process');
|
var child_process = require('child_process');
|
||||||
@ -1952,9 +1953,7 @@ function InstallModule(modulename, func, tag1, tag2) {
|
|||||||
// Get the working directory
|
// Get the working directory
|
||||||
if ((__dirname.endsWith('/node_modules/meshcentral')) || (__dirname.endsWith('\\node_modules\\meshcentral')) || (__dirname.endsWith('/node_modules/meshcentral/')) || (__dirname.endsWith('\\node_modules\\meshcentral\\'))) { parentpath = require('path').join(__dirname, '../..'); }
|
if ((__dirname.endsWith('/node_modules/meshcentral')) || (__dirname.endsWith('\\node_modules\\meshcentral')) || (__dirname.endsWith('/node_modules/meshcentral/')) || (__dirname.endsWith('\\node_modules\\meshcentral\\'))) { parentpath = require('path').join(__dirname, '../..'); }
|
||||||
|
|
||||||
// Looks like we need to keep a global reference to the child process object for this to work correctly.
|
child_process.exec(`npm install --no-optional ${modulename}`, { maxBuffer: 512000, timeout: 120000, cwd: parentpath }, function (error, stdout, stderr) {
|
||||||
InstallModuleChildProcess = child_process.exec('npm install --no-optional --save ' + modulename, { maxBuffer: 512000, timeout: 10000, cwd: parentpath }, function (error, stdout, stderr) {
|
|
||||||
InstallModuleChildProcess = null;
|
|
||||||
if ((error != null) && (error != '')) {
|
if ((error != null) && (error != '')) {
|
||||||
console.log('ERROR: Unable to install required module "' + modulename + '". MeshCentral may not have access to npm, or npm may not have suffisent rights to load the new module. Try "npm install ' + modulename + '" to manualy install this module.\r\n');
|
console.log('ERROR: Unable to install required module "' + modulename + '". MeshCentral may not have access to npm, or npm may not have suffisent rights to load the new module. Try "npm install ' + modulename + '" to manualy install this module.\r\n');
|
||||||
process.exit();
|
process.exit();
|
||||||
@ -2006,7 +2005,7 @@ function mainStart() {
|
|||||||
var modules = ['ws', 'cbor', 'nedb', 'https', 'yauzl', 'xmldom', 'ipcheck', 'express', 'archiver', 'multiparty', 'node-forge', 'express-ws', 'compression', 'body-parser', 'connect-redis', 'cookie-session', 'express-handlebars'];
|
var modules = ['ws', 'cbor', 'nedb', 'https', 'yauzl', 'xmldom', 'ipcheck', 'express', 'archiver', 'multiparty', 'node-forge', 'express-ws', 'compression', 'body-parser', 'connect-redis', 'cookie-session', 'express-handlebars'];
|
||||||
if (require('os').platform() == 'win32') { modules.push('node-windows'); if (sspi == true) { modules.push('node-sspi'); } } // Add Windows modules
|
if (require('os').platform() == 'win32') { modules.push('node-windows'); if (sspi == true) { modules.push('node-sspi'); } } // Add Windows modules
|
||||||
if (ldap == true) { modules.push('ldapauth-fork'); }
|
if (ldap == true) { modules.push('ldapauth-fork'); }
|
||||||
if (config.letsencrypt != null) { modules.push('greenlock'); modules.push('le-store-certbot'); modules.push('le-challenge-fs'); modules.push('le-acme-core'); } // Add Greenlock Modules
|
if (config.letsencrypt != null) { modules.push('greenlock@2.8.8'); modules.push('le-store-certbot'); modules.push('le-challenge-fs'); modules.push('le-acme-core'); } // Add Greenlock Modules
|
||||||
if (config.settings.mqtt != null) { modules.push('aedes'); } // Add MQTT Modules
|
if (config.settings.mqtt != null) { modules.push('aedes'); } // Add MQTT Modules
|
||||||
if (config.settings.mongodb != null) { modules.push('mongodb'); } // Add MongoDB, official driver.
|
if (config.settings.mongodb != null) { modules.push('mongodb'); } // Add MongoDB, official driver.
|
||||||
if (config.settings.vault != null) { modules.push('node-vault'); } // Add official HashiCorp's Vault module.
|
if (config.settings.vault != null) { modules.push('node-vault'); } // Add official HashiCorp's Vault module.
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "meshcentral",
|
"name": "meshcentral",
|
||||||
|
<<<<<<< HEAD
|
||||||
"version": "0.4.3-t",
|
"version": "0.4.3-t",
|
||||||
|
=======
|
||||||
|
"version": "0.4.3-w",
|
||||||
|
>>>>>>> b8ca6da3db12bf23b94068970eaf63ec22cb391e
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Remote Management",
|
"Remote Management",
|
||||||
"Intel AMT",
|
"Intel AMT",
|
||||||
@ -37,10 +41,8 @@
|
|||||||
"express": "^4.17.0",
|
"express": "^4.17.0",
|
||||||
"express-handlebars": "^3.1.0",
|
"express-handlebars": "^3.1.0",
|
||||||
"express-ws": "^4.0.0",
|
"express-ws": "^4.0.0",
|
||||||
"html-minifier": "^4.0.0",
|
|
||||||
"ipcheck": "^0.1.0",
|
"ipcheck": "^0.1.0",
|
||||||
"meshcentral": "*",
|
"meshcentral": "*",
|
||||||
"minify-js": "0.0.4",
|
|
||||||
"minimist": "^1.2.0",
|
"minimist": "^1.2.0",
|
||||||
"multiparty": "^4.2.1",
|
"multiparty": "^4.2.1",
|
||||||
"nedb": "^1.8.0",
|
"nedb": "^1.8.0",
|
||||||
|
@ -3394,7 +3394,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
obj.app.get(url + 'stop', function (req, res) { res.send('Stopping Server, <a href="' + url + '">click here to login</a>.'); setTimeout(function () { parent.Stop(); }, 500); });
|
//obj.app.get(url + 'stop', function (req, res) { res.send('Stopping Server, <a href="' + url + '">click here to login</a>.'); setTimeout(function () { parent.Stop(); }, 500); });
|
||||||
|
|
||||||
// Indicates to ExpressJS that the override public folder should be used to serve static files.
|
// Indicates to ExpressJS that the override public folder should be used to serve static files.
|
||||||
if (obj.parent.webPublicOverridePath != null) { obj.app.use(url, obj.express.static(obj.parent.webPublicOverridePath, { maxAge: '1h' })); }
|
if (obj.parent.webPublicOverridePath != null) { obj.app.use(url, obj.express.static(obj.parent.webPublicOverridePath, { maxAge: '1h' })); }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user