From c6001dde5774382d839822654c3ca01e43e343a6 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Wed, 6 May 2020 12:15:47 -0700 Subject: [PATCH] Added domain urlswitching option. --- sample-config.json | 1 + views/default.handlebars | 10 +++++----- webserver.js | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sample-config.json b/sample-config.json index be1ce83c..29064190 100644 --- a/sample-config.json +++ b/sample-config.json @@ -119,6 +119,7 @@ "_UserSessionIdleTimeout" : 30, "__UserConsentFlags__" : "Set to: 1 for desktop, 2 for terminal, 3 for files, 7 for all", "_UserConsentFlags" : 7, + "_UrlSwitching": false, "_DesktopPrivacyBarText": "Your privacy bar message", "_Limits": { "_MaxDevices": 100, diff --git a/views/default.handlebars b/views/default.handlebars index 90994789..55b8b4f7 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -5255,7 +5255,7 @@ // Change the URL var urlviewmode = ''; - if ((xxcurrentView >= 10) && (xxcurrentView <= 19) && (currentNode != null)) { + if (((features & 0x10000000) == 0) && (xxcurrentView >= 10) && (xxcurrentView <= 19) && (currentNode != null)) { urlviewmode = '?viewmode=' + xxcurrentView + '&gotonode=' + currentNode._id.split('/')[2]; for (var i in urlargs) { urlviewmode += ('&' + i + '=' + urlargs[i]); } try { window.history.replaceState({}, document.title, window.location.pathname + urlviewmode); } catch (ex) { } @@ -8594,7 +8594,7 @@ // Change the URL var urlviewmode = ''; - if ((xxcurrentView >= 20) && (xxcurrentView <= 29) && (currentMesh != null)) { + if (((features & 0x10000000) == 0) && (xxcurrentView >= 20) && (xxcurrentView <= 29) && (currentMesh != null)) { urlviewmode = '?viewmode=' + xxcurrentView + '&gotomesh=' + currentMesh._id.split('/')[2]; for (var i in urlargs) { urlviewmode += ('&' + i + '=' + urlargs[i]); } try { window.history.replaceState({}, document.title, window.location.pathname + urlviewmode); } catch (ex) { } @@ -10562,7 +10562,7 @@ // Change the URL var urlviewmode = ''; - if ((xxcurrentView >= 51) && (xxcurrentView <= 59) && (currentUserGroup != null)) { + if (((features & 0x10000000) == 0) && (xxcurrentView >= 51) && (xxcurrentView <= 59) && (currentUserGroup != null)) { urlviewmode = '?viewmode=' + xxcurrentView + '&gotougrp=' + currentUserGroup._id.split('/')[2]; for (var i in urlargs) { urlviewmode += ('&' + i + '=' + urlargs[i]); } try { window.history.replaceState({}, document.title, window.location.pathname + urlviewmode); } catch (ex) { } @@ -10836,7 +10836,7 @@ // Change the URL var urlviewmode = ''; - if ((xxcurrentView >= 30) && (xxcurrentView <= 39) && (currentUser != null)) { + if (((features & 0x10000000) == 0) && (xxcurrentView >= 30) && (xxcurrentView <= 39) && (currentUser != null)) { urlviewmode = '?viewmode=' + xxcurrentView + '&gotouser=' + currentUser._id.split('/')[2]; for (var i in urlargs) { urlviewmode += ('&' + i + '=' + urlargs[i]); } try { window.history.replaceState({}, document.title, window.location.pathname + urlviewmode); } catch (ex) { } @@ -11857,7 +11857,7 @@ if (fullscreen) { deskToggleFull(); } // Change the URL - if (xxcurrentView > 0) { + if (((features & 0x10000000) == 0) && (xxcurrentView > 0)) { var urlviewmode = ''; if ((xxcurrentView >= 10) && (xxcurrentView <= 19)) { // Device Link if (currentNode != null) { urlviewmode = '?viewmode=' + xxcurrentView + '&gotonode=' + currentNode._id.split('/')[2]; } diff --git a/webserver.js b/webserver.js index 6522d4de..8628ec44 100644 --- a/webserver.js +++ b/webserver.js @@ -1880,6 +1880,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { if (parent.smsserver != null) { features += 0x02000000; } // SMS messaging is supported if ((parent.smsserver != null) && ((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.sms2factor != false))) { features += 0x04000000; } // SMS 2FA is allowed if (domain.sessionrecording != null) { features += 0x08000000; } // Server recordings enabled + if (domain.urlswitching === false) { features += 0x10000000; } // Disables the URL switching feature // Create a authentication cookie const authCookie = obj.parent.encodeCookie({ userid: user._id, domainid: domain.id, ip: cleanRemoteAddr(req.ip) }, obj.parent.loginCookieEncryptionKey);