Added domain urlswitching option.

Ylian Saint-Hilaire committed May 6, 2020 at 12:15 UTC c6001dde5774382d839822654c3ca01e43e343a6
3 files changed +7 -5
sample-config.json
+1
@@ -119,6 +119,7 @@
119 "_UserSessionIdleTimeout" : 30,
120 "__UserConsentFlags__" : "Set to: 1 for desktop, 2 for terminal, 3 for files, 7 for all",
121 "_UserConsentFlags" : 7,
122 + "_UrlSwitching": false,
123 "_DesktopPrivacyBarText": "Your privacy bar message",
124 "_Limits": {
125 "_MaxDevices": 100,
views/default.handlebars
+5 -5
@@ -5255,7 +5255,7 @@
5255
5256 // Change the URL
5257 var urlviewmode = '';
5258 - if ((xxcurrentView >= 10) && (xxcurrentView <= 19) && (currentNode != null)) {
5258 + if (((features & 0x10000000) == 0) && (xxcurrentView >= 10) && (xxcurrentView <= 19) && (currentNode != null)) {
5259 urlviewmode = '?viewmode=' + xxcurrentView + '&gotonode=' + currentNode._id.split('/')[2];
5260 for (var i in urlargs) { urlviewmode += ('&' + i + '=' + urlargs[i]); }
5261 try { window.history.replaceState({}, document.title, window.location.pathname + urlviewmode); } catch (ex) { }
@@ -8594,7 +8594,7 @@
8594
8595 // Change the URL
8596 var urlviewmode = '';
8597 - if ((xxcurrentView >= 20) && (xxcurrentView <= 29) && (currentMesh != null)) {
8597 + if (((features & 0x10000000) == 0) && (xxcurrentView >= 20) && (xxcurrentView <= 29) && (currentMesh != null)) {
8598 urlviewmode = '?viewmode=' + xxcurrentView + '&gotomesh=' + currentMesh._id.split('/')[2];
8599 for (var i in urlargs) { urlviewmode += ('&' + i + '=' + urlargs[i]); }
8600 try { window.history.replaceState({}, document.title, window.location.pathname + urlviewmode); } catch (ex) { }
@@ -10562,7 +10562,7 @@
10562
10563 // Change the URL
10564 var urlviewmode = '';
10565 - if ((xxcurrentView >= 51) && (xxcurrentView <= 59) && (currentUserGroup != null)) {
10565 + if (((features & 0x10000000) == 0) && (xxcurrentView >= 51) && (xxcurrentView <= 59) && (currentUserGroup != null)) {
10566 urlviewmode = '?viewmode=' + xxcurrentView + '&gotougrp=' + currentUserGroup._id.split('/')[2];
10567 for (var i in urlargs) { urlviewmode += ('&' + i + '=' + urlargs[i]); }
10568 try { window.history.replaceState({}, document.title, window.location.pathname + urlviewmode); } catch (ex) { }
@@ -10836,7 +10836,7 @@
10836
10837 // Change the URL
10838 var urlviewmode = '';
10839 - if ((xxcurrentView >= 30) && (xxcurrentView <= 39) && (currentUser != null)) {
10839 + if (((features & 0x10000000) == 0) && (xxcurrentView >= 30) && (xxcurrentView <= 39) && (currentUser != null)) {
10840 urlviewmode = '?viewmode=' + xxcurrentView + '&gotouser=' + currentUser._id.split('/')[2];
10841 for (var i in urlargs) { urlviewmode += ('&' + i + '=' + urlargs[i]); }
10842 try { window.history.replaceState({}, document.title, window.location.pathname + urlviewmode); } catch (ex) { }
@@ -11857,7 +11857,7 @@
11857 if (fullscreen) { deskToggleFull(); }
11858
11859 // Change the URL
11860 - if (xxcurrentView > 0) {
11860 + if (((features & 0x10000000) == 0) && (xxcurrentView > 0)) {
11861 var urlviewmode = '';
11862 if ((xxcurrentView >= 10) && (xxcurrentView <= 19)) { // Device Link
11863 if (currentNode != null) { urlviewmode = '?viewmode=' + xxcurrentView + '&gotonode=' + currentNode._id.split('/')[2]; }
webserver.js
+1
@@ -1880,6 +1880,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
1880 if (parent.smsserver != null) { features += 0x02000000; } // SMS messaging is supported
1881 if ((parent.smsserver != null) && ((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.sms2factor != false))) { features += 0x04000000; } // SMS 2FA is allowed
1882 if (domain.sessionrecording != null) { features += 0x08000000; } // Server recordings enabled
1883 + if (domain.urlswitching === false) { features += 0x10000000; } // Disables the URL switching feature
1884
1885 // Create a authentication cookie
1886 const authCookie = obj.parent.encodeCookie({ userid: user._id, domainid: domain.id, ip: cleanRemoteAddr(req.ip) }, obj.parent.loginCookieEncryptionKey);