Fix for incorrect MeshMessenger URL when using a multi-domain server. #2882

Ylian Saint-Hilaire committed Jul 9, 2021 at 15:36 UTC 913ed9f033f3cca128a8aa43d58919505697e301
3 files changed +4 -1
meshuser.js
+2 -1
@@ -489,7 +489,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
489 var agentHttpsPort = ((parent.args.aliasport == null) ? parent.args.port : parent.args.aliasport); // Use HTTPS alias port is specified
490 if (parent.args.agentport != null) { agentHttpsPort = parent.args.agentport; } // If an agent only port is enabled, use that.
491 if (parent.args.agentaliasport != null) { agentHttpsPort = parent.args.agentaliasport; } // If an agent alias port is specified, use that.
492 - serverinfo.magenturl = 'mc://' + agentServerName + ((agentHttpsPort != 443)?(':' + agentHttpsPort):'') + ((xdomain != '')?('/' + xdomain):'');
492 + serverinfo.magenturl = 'mc://' + agentServerName + ((agentHttpsPort != 443) ? (':' + agentHttpsPort) : '') + ((xdomain != '') ? ('/' + xdomain) : '');
493 + serverinfo.domainsuffix = xdomain;
494
495 if (domain.guestdevicesharing === false) { serverinfo.guestdevicesharing = false; }
496 if (typeof domain.userconsentflags == 'number') { serverinfo.consent = domain.userconsentflags; }
views/default-mobile.handlebars
+1
@@ -3694,6 +3694,7 @@
3694 if (xxdialogMode) return;
3695 setDialogMode(2, "Device Action", 3, function () {
3696 var url = '/messenger?id=meshmessenger/' + encodeURIComponentEx(currentNode._id) + '/' + encodeURIComponentEx(userinfo._id) + '&title=' + currentNode.name;
3697 + if (serverinfo.domainsuffix != '') { url = '/' + serverinfo.domainsuffix + url; }
3698 if ((authCookie != null) && (authCookie != '')) { url += '&auth=' + authCookie; }
3699 if (e && (e.shiftKey == true)) {
3700 safeNewWindow(url, 'meshmessenger:' + currentNode._id);
views/default.handlebars
+1
@@ -6913,6 +6913,7 @@
6913 function deviceChat(e) {
6914 if (xxdialogMode) return;
6915 var url = '/messenger?id=meshmessenger/' + encodeURIComponentEx(currentNode._id) + '/' + encodeURIComponentEx(userinfo._id) + '&title=' + currentNode.name;
6916 + if (serverinfo.domainsuffix != '') { url = '/' + serverinfo.domainsuffix + url; }
6917 if ((authCookie != null) && (authCookie != '')) { url += '&auth=' + authCookie; }
6918 if ((currentNode.pmt == 1) && ((features2 & 2) != 0)) { url += '&pmt=1'; } // Push messaging is possible for this device
6919 if (e && (e.shiftKey == true)) {