From d7698dd342b244bdc2d52237157820f955b24c85 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Fri, 17 Apr 2020 11:27:34 -0700 Subject: [PATCH] Fixed invalid agent invite page bug. --- meshagent.js | 2 +- views/default.handlebars | 1 - webserver.js | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/meshagent.js b/meshagent.js index 60736866..f6c6f8ef 100644 --- a/meshagent.js +++ b/meshagent.js @@ -464,7 +464,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { obj.agentInfo.agentId = common.ReadInt(msg, 6); obj.agentInfo.agentVersion = common.ReadInt(msg, 10); obj.agentInfo.platformType = common.ReadInt(msg, 14); - if (obj.agentInfo.platformType > 6 || obj.agentInfo.platformType < 1) { obj.agentInfo.platformType = 1; } + if (obj.agentInfo.platformType > 8 || obj.agentInfo.platformType < 1) { obj.agentInfo.platformType = 1; } if (msg.substring(50, 66) == '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0') { obj.meshid = Buffer.from(msg.substring(18, 50), 'binary').toString('hex'); // Older HEX MeshID } else { diff --git a/views/default.handlebars b/views/default.handlebars index f73330ce..2409f228 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -1385,7 +1385,6 @@ //if (hide & 16) { QV('page_leftbar', false); QS('page_content').left = '0px'; } if (!footerBar) { QC('body').add('nofooter'); } else { QC('body').remove('nofooter'); } - console.log('args.hide', args.hide); if (args.hide != 0) { // Fix the main grid to zero-height elements we want to hide. if (uiMode == 2) { diff --git a/webserver.js b/webserver.js index 8d89136d..205e0c0d 100644 --- a/webserver.js +++ b/webserver.js @@ -1359,7 +1359,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { var installflags = cookie.f; if (typeof installflags != 'number') { installflags = 0; } parent.debug('web', 'handleAgentInviteRequest using cookie.'); - render(req, res, getRenderPage('agentinvite', req, domain), getRenderArgs({ meshid: mesh._id.split('/')[2], serverport: ((args.aliasport != null) ? args.aliasport : args.port), serverhttps: ((args.notls == true) ? '0' : '1'), servernoproxy: ((domain.agentnoproxy === true) ? '1' : '0'), meshname: encodeURIComponent(mesh.name), installflags: installflags }, domain)); + render(req, res, getRenderPage('agentinvite', req, domain), getRenderArgs({ meshid: mesh._id.split('/')[2], serverport: ((args.aliasport != null) ? args.aliasport : args.port), serverhttps: ((args.notls == true) ? '0' : '1'), servernoproxy: ((domain.agentnoproxy === true) ? '1' : '0'), meshname: encodeURIComponent(mesh.name).split('\'').join('%27'), installflags: installflags }, domain)); } else if (req.query.m != null) { // The MeshId is specified in the query string, use that var mesh = obj.meshes['mesh/' + domain.id + '/' + req.query.m.toLowerCase()]; @@ -1368,7 +1368,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { if (req.query.f) { installflags = parseInt(req.query.f); } if (typeof installflags != 'number') { installflags = 0; } parent.debug('web', 'handleAgentInviteRequest using meshid.'); - render(req, res, getRenderPage('agentinvite', req, domain), getRenderArgs({ meshid: mesh._id.split('/')[2], serverport: ((args.aliasport != null) ? args.aliasport : args.port), serverhttps: ((args.notls == true) ? '0' : '1'), servernoproxy: ((domain.agentnoproxy === true) ? '1' : '0'), meshname: encodeURIComponent(mesh.name), installflags: installflags }, domain)); + render(req, res, getRenderPage('agentinvite', req, domain), getRenderArgs({ meshid: mesh._id.split('/')[2], serverport: ((args.aliasport != null) ? args.aliasport : args.port), serverhttps: ((args.notls == true) ? '0' : '1'), servernoproxy: ((domain.agentnoproxy === true) ? '1' : '0'), meshname: encodeURIComponent(mesh.name).split('\'').join('%27'), installflags: installflags }, domain)); } }