diff --git a/agents/MeshCmd-signed.exe b/agents/MeshCmd-signed.exe index 8159ae21..089899d8 100644 Binary files a/agents/MeshCmd-signed.exe and b/agents/MeshCmd-signed.exe differ diff --git a/agents/MeshCmd64-signed.exe b/agents/MeshCmd64-signed.exe index cd1d2266..ed23dd54 100644 Binary files a/agents/MeshCmd64-signed.exe and b/agents/MeshCmd64-signed.exe differ diff --git a/agents/MeshService-signed.exe b/agents/MeshService-signed.exe index e0d3e23c..8eabf604 100644 Binary files a/agents/MeshService-signed.exe and b/agents/MeshService-signed.exe differ diff --git a/agents/MeshService64-signed.exe b/agents/MeshService64-signed.exe index e8e8b086..e0a7eedd 100644 Binary files a/agents/MeshService64-signed.exe and b/agents/MeshService64-signed.exe differ diff --git a/agents/modules_meshcore/monitor-info.js b/agents/modules_meshcore/monitor-info.js index c809d923..b89509a8 100644 --- a/agents/modules_meshcore/monitor-info.js +++ b/agents/modules_meshcore/monitor-info.js @@ -8,6 +8,33 @@ var _NET_WM_STATE_TOGGLE = 2; // toggle property var SubstructureRedirectMask = (1 << 20); var SubstructureNotifyMask = (1 << 19); +function getLibInfo(libname) +{ + if (process.platform != 'linux') { throw ('Only supported on linux'); } + + var child = require('child_process').execFile('/bin/sh', ['sh']); + child.stdout.str = ''; + child.stdout.on('data', function (chunk) { this.str += chunk.toString(); }); + child.stdin.write("ldconfig -p | grep '" + libname + ".so.'\nexit\n"); + child.waitExit(); + + var v = []; + var lines = child.stdout.str.split('\n'); + for (var i in lines) { + if (lines[i]) { + var info = lines[i].split('=>'); + var pth = info[1].trim(); + var libinfo = info[0].trim().split(' '); + var lib = libinfo[0]; + var plat = libinfo[1].substring(1, libinfo[1].length - 1).split(','); + + if (lib.startsWith(libname + '.so.')) { + v.push({ lib: lib, path: pth, info: plat }); + } + } + } + return (v); +} function monitorinfo() { @@ -44,46 +71,67 @@ function monitorinfo() if (info._user32.EnumDisplayMonitors(0, 0, this._monitorinfo.callback, this._monitorinfo.dwData).Val == 0) { rejector('LastError=' + info._kernel32.GetLastError().Val); return; - } else { + } + else { resolver(this._monitorinfo.callback.results); } })); } } - else if (process.platform == 'linux') + else if(process.platform == 'linux') { // First thing we need to do, is determine where the X11 libraries are var askOS = false; - try { if (require('user-sessions').isRoot()) { askOS = true; } } catch (e) { } + try + { + if (require('user-sessions').isRoot()) { askOS = true; } + } + catch (e) + { } if (askOS) { // Sufficient access rights to use ldconfig - var p = require('child_process').execFile('/bin/sh', ['sh']); - p.stdout._lines = ''; - p.stdout.on('data', function (chunk) { this._lines += chunk.toString(); }); - p.stdin.write('ldconfig -v\nexit\n'); - p.waitExit(); + var x11info = getLibInfo('libX11'); + var xtstinfo = getLibInfo('libXtst'); + var xextinfo = getLibInfo('libXext'); + var ix; - var paths = p.stdout._lines.split('\n'); - var searchPath = ''; - for (var i in paths) { - if (paths[i].endsWith(':')) { - searchPath = paths[i].substring(0, paths[i].length - 1); - } else { - try { // Added by Ylian: Try/catch to fix X11 detection, not sure if this is correct. - if (paths[i].split('libX11.').length > 1) - { - //require('MeshAgent').SendCommand({ "action": "msg", "type": "console", "value": "path = " + searchPath + '/' + paths[i].split('->')[1].trim() }); - Object.defineProperty(this, 'Location_X11LIB', { value: searchPath + '/' + paths[i].split('->')[1].trim() }); - } - if (paths[i].split('libXtst.').length > 1) { Object.defineProperty(this, 'Location_X11TST', { value: searchPath + '/' + paths[i].split('->')[1].trim() }); } - if (paths[i].split('libXext.').length > 1) { Object.defineProperty(this, 'Location_X11EXT', { value: searchPath + '/' + paths[i].split('->')[1].trim() }); } - } catch (ex) - { - //require('MeshAgent').SendCommand({ "action": "msg", "type": "console", "value": "[" + searchPath + '/' + paths[i].split('->')[1].trim() + "] uncaughtException7: " + ex }); - } + for(ix in x11info) + { + try + { + this._gm.CreateNativeProxy(x11info[ix].path); + Object.defineProperty(this, 'Location_X11LIB', { value: x11info[ix].path }); + break; + } + catch(ex) + { + } + } + for (ix in xtstinfo) + { + try + { + this._gm.CreateNativeProxy(xtstinfo[ix].path); + Object.defineProperty(this, 'Location_X11TST', { value: xtstinfo[ix].path }); + break; + } + catch (ex) + { + } + } + for (ix in xextinfo) + { + try + { + this._gm.CreateNativeProxy(xextinfo[ix].path); + Object.defineProperty(this, 'Location_X11EXT', { value: xextinfo[ix].path }); + break; + } + catch (ex) + { } } } diff --git a/package.json b/package.json index d2228b0a..2b99bd2a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.2.3-l", + "version": "0.2.3-o", "keywords": [ "Remote Management", "Intel AMT", diff --git a/views/default-min.handlebars b/views/default-min.handlebars index 1e6958b2..13e428ad 100644 --- a/views/default-min.handlebars +++ b/views/default-min.handlebars @@ -1 +1 @@ - MeshCentral
{{{title}}}
{{{title2}}}

{{{logoutControl}}}

 

\ No newline at end of file + MeshCentral
{{{title}}}
{{{title2}}}

{{{logoutControl}}}

 

\ No newline at end of file diff --git a/views/terms.handlebars b/views/terms.handlebars index 6f1c0d31..9e4b83a9 100644 --- a/views/terms.handlebars +++ b/views/terms.handlebars @@ -242,6 +242,10 @@ if (webPageFullScreen == 'true') { webPageFullScreen = true; } toggleFullScreen(); + var terms = "{{{terms}}}"; + if (terms != "") { QH('column_l', decodeURIComponent(terms)); } + QV('column_l', true); + // Toggle the web page to full screen function toggleFullScreen(toggle) { if (toggle === 1) { webPageFullScreen = !webPageFullScreen; putstore('webPageFullScreen', webPageFullScreen); } diff --git a/webserver.js b/webserver.js index 0b2f8e32..27c6e8b2 100644 --- a/webserver.js +++ b/webserver.js @@ -804,13 +804,33 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { function handleTermsRequest(req, res) { var domain = checkUserIpAddress(req, res); if (domain == null) return; - res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0' }); - if (req.session && req.session.userid) { - if (req.session.domainid != domain.id) { req.session = null; res.redirect(domain.url); return; } // Check is the session is for the correct domain - var user = obj.users[req.session.userid]; - res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/terms-mobile' : 'views/terms'), { title: domain.title, title2: domain.title2, logoutControl: 'Welcome ' + user.name + '. Logout' }); + + // See if there is a terms.txt file in meshcentral-data + var p = obj.path.join(obj.parent.datapath, 'terms.txt'); + if (obj.fs.existsSync(p)) { + readEntireTextFile(p, function (data) { + if (data == null) { res.sendStatus(404); return; } + + // Send the terms + res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0' }); + if (req.session && req.session.userid) { + if (req.session.domainid != domain.id) { req.session = null; res.redirect(domain.url); return; } // Check is the session is for the correct domain + var user = obj.users[req.session.userid]; + res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/terms-mobile' : 'views/terms'), { title: domain.title, title2: domain.title2, terms: encodeURIComponent(data), logoutControl: 'Welcome ' + user.name + '. Logout' }); + } else { + res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/terms-mobile' : 'views/terms'), { title: domain.title, title2: domain.title2, terms: encodeURIComponent(data) }); + } + }); } else { - res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/terms-mobile' : 'views/terms'), { title: domain.title, title2: domain.title2 }); + // Send the terms + res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0' }); + if (req.session && req.session.userid) { + if (req.session.domainid != domain.id) { req.session = null; res.redirect(domain.url); return; } // Check is the session is for the correct domain + var user = obj.users[req.session.userid]; + res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/terms-mobile' : 'views/terms'), { title: domain.title, title2: domain.title2, logoutControl: 'Welcome ' + user.name + '. Logout' }); + } else { + res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/terms-mobile' : 'views/terms'), { title: domain.title, title2: domain.title2 }); + } } }