diff --git a/agents/MeshCmd-signed.exe b/agents/MeshCmd-signed.exe index 9e94e121ee..b4e3758829 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 4efa2e0d78..aaee20d61b 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 6232f01773..a46f9bd910 100644 Binary files a/agents/MeshService-signed.exe and b/agents/MeshService-signed.exe differ diff --git a/agents/MeshService.exe b/agents/MeshService.exe index a0af0adb9f..41f1142e58 100644 Binary files a/agents/MeshService.exe and b/agents/MeshService.exe differ diff --git a/agents/MeshService64-signed.exe b/agents/MeshService64-signed.exe index fda7a01c02..c1bc727cf3 100644 Binary files a/agents/MeshService64-signed.exe and b/agents/MeshService64-signed.exe differ diff --git a/agents/MeshService64.exe b/agents/MeshService64.exe index 3033e49da0..83f6b8197f 100644 Binary files a/agents/MeshService64.exe and b/agents/MeshService64.exe differ diff --git a/package.json b/package.json index c4e017ba07..804a7431f6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.1.9-p", + "version": "0.1.9-q", "keywords": [ "Remote Management", "Intel AMT", diff --git a/public/compress.bat b/public/compress.bat index eb11924be6..fb06b4f858 100644 --- a/public/compress.bat +++ b/public/compress.bat @@ -1,6 +1,11 @@ @ECHO OFF -REM *** default.handlebars +REM *** Remove all old minified files DEL ..\views\default-min.handlebars +DEL ..\views\default-mobile-min.handlebars +DEL ..\views\login-min.handlebars +DEL ..\views\login-mobile-min.handlebars + +REM *** default.handlebars COPY ..\views\default.handlebars index.html ..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe compress.wcc -c COPY compress.htm ..\views\default-min.handlebars @@ -8,7 +13,6 @@ DEL compress.htm DEL index.html REM *** default-mobile.handlebars -DEL ..\views\default-mobile-min.handlebars COPY ..\views\default-mobile.handlebars index.html ..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe compress.wcc -c COPY compress.htm ..\views\default-mobile-min.handlebars @@ -16,7 +20,6 @@ DEL compress.htm DEL index.html REM *** login.handlebars -DEL ..\views\login-min.handlebars COPY ..\views\login.handlebars index.html ..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe compress.wcc -c COPY compress.htm ..\views\login-min.handlebars @@ -24,7 +27,6 @@ DEL compress.htm DEL index.html REM *** login-mobile.handlebars -DEL ..\views\login-mobile-min.handlebars COPY ..\views\login-mobile.handlebars index.html ..\..\WebSiteCompiler\bin\Debug\WebSiteCompiler.exe compress.wcc -c COPY compress.htm ..\views\login-mobile-min.handlebars diff --git a/sample-config.json b/sample-config.json index 77fae33b6f..1d8c67bfd5 100644 --- a/sample-config.json +++ b/sample-config.json @@ -5,6 +5,7 @@ "_MongoDbCol": "meshcentral", "_WANonly": true, "_LANonly": true, + "_Minify": 1, "_SessionTime": 30, "_SessionKey": "MyReallySecretPassword", "_Port": 443, diff --git a/views/default-min.handlebars b/views/default-min.handlebars index dc37353c83..2984646424 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/default.handlebars b/views/default.handlebars index a9a55af02f..97aeefa929 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -773,6 +773,9 @@ var files; var debugLevel = parseInt("{{{debuglevel}}}"); var features = parseInt("{{{features}}}"); + var sessionTime = parseInt("{{{sessiontime}}}"); + var domain = "{{{domain}}}"; + var domainUrl = "{{{domainurl}}}"; var multiDesktop = {}; var multiDesktopFilter = null; var serverPublicNamePort = "{{{serverDnsName}}}:{{{serverPublicPort}}}"; @@ -826,7 +829,7 @@ center(); // Connect to the mesh server - meshserver = MeshServerCreateControl("{{{domainurl}}}"); + meshserver = MeshServerCreateControl(domainUrl); meshserver.onStateChanged = onStateChanged; meshserver.onMessage = onMessage; meshserver.Start(); @@ -1173,13 +1176,13 @@ case 'accountremove': { // An account was removed if (users == null) break; - delete users['user/{{{domain}}}/' + message.event.username.toLowerCase()]; + delete users['user/' + domain + '/' + message.event.username.toLowerCase()]; updateUsers(); break; } case 'createmesh': { // A new mesh was created - if (message.event.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()] != null) { // Check if this is a mesh create for a mesh we own. If site administrator, we get all messages so need to ignore some. + if (message.event.links['user/' + domain + '/' + userinfo.name.toLowerCase()] != null) { // Check if this is a mesh create for a mesh we own. If site administrator, we get all messages so need to ignore some. meshes[message.event.meshid] = { _id: message.event.meshid, name: message.event.name, mtype: message.event.mtype, desc: message.event.desc, links: message.event.links }; updateMeshes(); updateDevices(); @@ -1200,7 +1203,7 @@ meshes[message.event.meshid].links = message.event.links; // Check if we lost rights to this mesh in this change. - if (meshes[message.event.meshid].links['user/{{{domain}}}/' + userinfo.name.toLowerCase()] == null) { + if (meshes[message.event.meshid].links['user/' + domain + '/' + userinfo.name.toLowerCase()] == null) { if ((xxcurrentView == 20) && (currentMesh == meshes[message.event.meshid])) go(2); delete meshes[message.event.meshid]; @@ -1338,10 +1341,10 @@ case 'wssessioncount': { // Update the active web socket session count for a user if (wssessions != null) { - if (message.event.count == 0 && wssessions['user/{{{domain}}}/' + message.event.username.toLowerCase()]) { - delete wssessions['user/{{{domain}}}/' + message.event.username.toLowerCase()]; + if (message.event.count == 0 && wssessions['user/' + domain + '/' + message.event.username.toLowerCase()]) { + delete wssessions['user/' + domain + '/' + message.event.username.toLowerCase()]; } else { - wssessions['user/{{{domain}}}/' + message.event.username.toLowerCase()] = message.event.count; + wssessions['user/' + domain + '/' + message.event.username.toLowerCase()] = message.event.count; } updateUsers(); } @@ -1354,7 +1357,7 @@ } case 'login': { // Update the last login time - if (users != null && users['user/{{{domain}}}/' + message.event.username.toLowerCase()]) { users['user/{{{domain}}}/' + message.event.username.toLowerCase()].login = message.event.time; } + if (users != null && users['user/' + domain + '/' + message.event.username.toLowerCase()]) { users['user/' + domain + '/' + message.event.username.toLowerCase()].login = message.event.time; } break; } case 'scanamtdevice': { @@ -1541,7 +1544,7 @@ // Go thru the list of nodes and display them for (var i in nodes) { if (nodes[i].v == false) continue; - var mesh2 = meshes[nodes[i].meshid], meshlinks = mesh2.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()]; + var mesh2 = meshes[nodes[i].meshid], meshlinks = mesh2.links['user/' + domain + '/' + userinfo.name.toLowerCase()]; if (meshlinks == null) continue; var meshrights = meshlinks.rights; if ((view == 3) && (mesh2.mtype == 1)) continue; @@ -1645,7 +1648,7 @@ // Display all empty meshes, we need to do this because users can add devices to these at any time. if ((sort == 0) && (Q('SearchInput').value == '') && (view < 3)) { for (var i in meshes) { - var mesh = meshes[i], meshlink = mesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()]; + var mesh = meshes[i], meshlink = mesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()]; if (meshlink != null) { var meshrights = meshlink.rights; if (displayedMeshes[mesh._id] == null) { @@ -1747,7 +1750,7 @@ } function toggleKvmDevice(nodeid) { - var node = getNodeFromId(nodeid), mesh = meshes[node.meshid], meshrights = mesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights; + var node = getNodeFromId(nodeid), mesh = meshes[node.meshid], meshrights = mesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights; if ((meshrights & 8) != 0) { // Requires remote control rights //var conn = 0; //if ((node.conn & 1) != 0) { conn = 1; } else if ((node.conn & 6) != 0) { conn = 2; } // Check what type of connect we can do (Agent vs AMT) @@ -2835,7 +2838,7 @@ function getNodeRights(nodeid) { var node = getNodeFromId(nodeid), mesh = meshes[node.meshid]; - return mesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights; + return mesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights; } var currentNode; @@ -2848,7 +2851,7 @@ //disconnectAllKvmFunction(); var node = getNodeFromId(nodeid); var mesh = meshes[node.meshid]; - var meshrights = mesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights; + var meshrights = mesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights; if (!currentNode || currentNode._id != node._id || refresh == true) { currentNode = node; @@ -3067,7 +3070,7 @@ function deviceActionFunction() { if (xxdialogMode) return; - var meshrights = meshes[currentNode.meshid].links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights; + var meshrights = meshes[currentNode.meshid].links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights; var x = "Select an operation to perform on this device.

"; var y = '"; x += "Password:"; x += '
'; @@ -4595,7 +4598,7 @@ function account_showChangePassword() { if (xxdialogMode) return; var x = "Change your account password by entering the new password twice in the boxes below.

"; - x += "
"; + x += "
"; x += ""; x += ""; x += ""; @@ -4660,7 +4663,7 @@ count++; // Mesh rights - var meshrights = meshes[i].links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights; + var meshrights = meshes[i].links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights; var rights = 'Partial Rights'; if (meshrights == 0xFFFFFFFF) rights = 'Full Administrator'; else if (meshrights == 0) rights = 'No Rights'; @@ -4713,7 +4716,7 @@ if (currentMesh == null) return; QH('p20meshName', EscapeHtml(currentMesh.name)); var meshtype = 'Unknown #' + currentMesh.mtype; - var meshrights = currentMesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights; + var meshrights = currentMesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights; if (currentMesh.mtype == 1) meshtype = 'Intel® AMT computer group (No Agent)'; if (currentMesh.mtype == 2) meshtype = 'Mesh agent computer group'; @@ -4726,7 +4729,7 @@ x += '
'; x += '

'; - var currentMeshLinks = currentMesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()]; + var currentMeshLinks = currentMesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()]; if (currentMeshLinks && ((currentMeshLinks.rights & 2) != 0)) { x += ' Add User'; } if ((meshrights & 4) != 0) { @@ -4834,7 +4837,7 @@ } function p20validateAddMeshUserDialog() { - var meshrights = currentMesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights; + var meshrights = currentMesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights; QE('idx_dlgOkButton', (Q('dp20username').value.length > 0)); QE('p20fulladmin', meshrights == 0xFFFFFFFF); QE('p20editmesh', (!Q('p20fulladmin').checked) && (meshrights == 0xFFFFFFFF)); @@ -4865,7 +4868,7 @@ function p20viewuser(userid) { if (xxdialogMode) return; userid = decodeURIComponent(userid); - var r = '', cmeshrights = currentMesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()].rights, meshrights = currentMesh.links[userid].rights; + var r = '', cmeshrights = currentMesh.links['user/' + domain + '/' + userinfo.name.toLowerCase()].rights, meshrights = currentMesh.links[userid].rights; if (meshrights == 0xFFFFFFFF) r = ', Full Administrator (all rights)'; else { if ((meshrights & 1) != 0) r += ', Edit Mesh'; if ((meshrights & 2) != 0) r += ', Manage Mesh Users'; @@ -4880,7 +4883,7 @@ if (r == '') { r = 'No Rights'; } var buttons = 1, x = addHtmlValue('User Name', userid.split('/')[2]); x += addHtmlValue('Permissions', r); - if ((('user/{{{domain}}}/' + userinfo.name.toLowerCase()) != userid) && (cmeshrights == 0xFFFFFFFF || (((cmeshrights & 2) != 0) && (meshrights != 0xFFFFFFFF)))) buttons += 4; + if ((('user/' + domain + '/' + userinfo.name.toLowerCase()) != userid) && (cmeshrights == 0xFFFFFFFF || (((cmeshrights & 2) != 0) && (meshrights != 0xFFFFFFFF)))) buttons += 4; setDialogMode(2, "Mesh User", buttons, p20viewuserEx, x, userid); } diff --git a/webserver.js b/webserver.js index ead22ed39d..a2dec6a0bf 100644 --- a/webserver.js +++ b/webserver.js @@ -722,17 +722,17 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { if ((!obj.args.user) && (obj.args.nousers != true) && (nologout == false)) { logoutcontrol += ' Logout'; } // If a default user is in use or no user mode, don't display the logout button var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified - if (obj.args.minify) { + if (obj.args.minify && !req.query.nominify) { // Try to server the minified version if we can. try { - res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/default-mobile-min' : 'views/default-min'), { viewmode: viewmode, currentNode: currentNode, logoutControl: logoutcontrol, title: domain.title, title2: domain.title2, domainurl: domain.url, domain: domain.id, debuglevel: parent.debugLevel, serverDnsName: getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: httpsPort, noServerBackup: (args.noserverbackup == 1 ? 1 : 0), features: features, mpspass: args.mpspass, webcerthash: obj.webCertificateHashBase64, footer: (domain.footer == null) ? '' : domain.footer }); + res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/default-mobile-min' : 'views/default-min'), { viewmode: viewmode, currentNode: currentNode, logoutControl: logoutcontrol, title: domain.title, title2: domain.title2, domainurl: domain.url, domain: domain.id, debuglevel: parent.debugLevel, serverDnsName: getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: httpsPort, noServerBackup: (args.noserverbackup == 1 ? 1 : 0), features: features, sessiontime: args.sessiontime, mpspass: args.mpspass, webcerthash: obj.webCertificateHashBase64, footer: (domain.footer == null) ? '' : domain.footer }); } catch (ex) { // In case of an exception, serve the non-minified version. - res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/default-mobile' : 'views/default'), { viewmode: viewmode, currentNode: currentNode, logoutControl: logoutcontrol, title: domain.title, title2: domain.title2, domainurl: domain.url, domain: domain.id, debuglevel: parent.debugLevel, serverDnsName: getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: httpsPort, noServerBackup: (args.noserverbackup == 1 ? 1 : 0), features: features, mpspass: args.mpspass, webcerthash: obj.webCertificateHashBase64, footer: (domain.footer == null) ? '' : domain.footer }); + res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/default-mobile' : 'views/default'), { viewmode: viewmode, currentNode: currentNode, logoutControl: logoutcontrol, title: domain.title, title2: domain.title2, domainurl: domain.url, domain: domain.id, debuglevel: parent.debugLevel, serverDnsName: getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: httpsPort, noServerBackup: (args.noserverbackup == 1 ? 1 : 0), features: features, sessiontime: args.sessiontime, mpspass: args.mpspass, webcerthash: obj.webCertificateHashBase64, footer: (domain.footer == null) ? '' : domain.footer }); } } else { // Serve non-minified version of web pages. - res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/default-mobile' : 'views/default'), { viewmode: viewmode, currentNode: currentNode, logoutControl: logoutcontrol, title: domain.title, title2: domain.title2, domainurl: domain.url, domain: domain.id, debuglevel: parent.debugLevel, serverDnsName: getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: httpsPort, noServerBackup: (args.noserverbackup == 1 ? 1 : 0), features: features, mpspass: args.mpspass, webcerthash: obj.webCertificateHashBase64, footer: (domain.footer == null) ? '' : domain.footer }); + res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/default-mobile' : 'views/default'), { viewmode: viewmode, currentNode: currentNode, logoutControl: logoutcontrol, title: domain.title, title2: domain.title2, domainurl: domain.url, domain: domain.id, debuglevel: parent.debugLevel, serverDnsName: getWebServerName(domain), serverRedirPort: args.redirport, serverPublicPort: httpsPort, noServerBackup: (args.noserverbackup == 1 ? 1 : 0), features: features, sessiontime: args.sessiontime, mpspass: args.mpspass, webcerthash: obj.webCertificateHashBase64, footer: (domain.footer == null) ? '' : domain.footer }); } } else { // Send back the login application @@ -741,17 +741,17 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { if ((parent.config != null) && (parent.config.settings != null) && (parent.config.settings.allowframing == true)) { features += 32; } // Allow site within iframe var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified - if (obj.args.minify) { + if (obj.args.minify && !req.query.nominify) { // Try to server the minified version if we can. try { - res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/login-mobile-min' : 'views/login-min'), { loginmode: loginmode, rootCertLink: getRootCertLink(), title: domain.title, title2: domain.title2, newAccount: domain.newaccounts, newAccountPass: (((domain.newaccountspass == null) || (domain.newaccountspass == '')) ? 0 : 1), serverDnsName: getWebServerName(domain), serverPublicPort: httpsPort, emailcheck: obj.parent.mailserver != null, features: features, footer: (domain.footer == null) ? '' : domain.footer }); + res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/login-mobile-min' : 'views/login-min'), { loginmode: loginmode, rootCertLink: getRootCertLink(), title: domain.title, title2: domain.title2, newAccount: domain.newaccounts, newAccountPass: (((domain.newaccountspass == null) || (domain.newaccountspass == '')) ? 0 : 1), serverDnsName: getWebServerName(domain), serverPublicPort: httpsPort, emailcheck: obj.parent.mailserver != null, features: features, sessiontime: args.sessiontime, footer: (domain.footer == null) ? '' : domain.footer }); } catch (ex) { // In case of an exception, serve the non-minified version. - res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/login-mobile' : 'views/login'), { loginmode: loginmode, rootCertLink: getRootCertLink(), title: domain.title, title2: domain.title2, newAccount: domain.newaccounts, newAccountPass: (((domain.newaccountspass == null) || (domain.newaccountspass == '')) ? 0 : 1), serverDnsName: getWebServerName(domain), serverPublicPort: httpsPort, emailcheck: obj.parent.mailserver != null, features: features, footer: (domain.footer == null) ? '' : domain.footer }); + res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/login-mobile' : 'views/login'), { loginmode: loginmode, rootCertLink: getRootCertLink(), title: domain.title, title2: domain.title2, newAccount: domain.newaccounts, newAccountPass: (((domain.newaccountspass == null) || (domain.newaccountspass == '')) ? 0 : 1), serverDnsName: getWebServerName(domain), serverPublicPort: httpsPort, emailcheck: obj.parent.mailserver != null, features: features, sessiontime: args.sessiontime, footer: (domain.footer == null) ? '' : domain.footer }); } } else { // Serve non-minified version of web pages. - res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/login-mobile' : 'views/login'), { loginmode: loginmode, rootCertLink: getRootCertLink(), title: domain.title, title2: domain.title2, newAccount: domain.newaccounts, newAccountPass: (((domain.newaccountspass == null) || (domain.newaccountspass == '')) ? 0 : 1), serverDnsName: getWebServerName(domain), serverPublicPort: httpsPort, emailcheck: obj.parent.mailserver != null, features: features, footer: (domain.footer == null) ? '' : domain.footer }); + res.render(obj.path.join(__dirname, isMobileBrowser(req) ? 'views/login-mobile' : 'views/login'), { loginmode: loginmode, rootCertLink: getRootCertLink(), title: domain.title, title2: domain.title2, newAccount: domain.newaccounts, newAccountPass: (((domain.newaccountspass == null) || (domain.newaccountspass == '')) ? 0 : 1), serverDnsName: getWebServerName(domain), serverPublicPort: httpsPort, emailcheck: obj.parent.mailserver != null, features: features, sessiontime: args.sessiontime, footer: (domain.footer == null) ? '' : domain.footer }); } /*
Password:
Password:
Password Hint: