Improved web application URL replacement.

This commit is contained in:
Ylian Saint-Hilaire 2020-01-29 15:24:06 -08:00
parent 91d09923f3
commit 0a24f24959
3 changed files with 18 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "meshcentral", "name": "meshcentral",
"version": "0.4.8-e", "version": "0.4.8-f",
"keywords": [ "keywords": [
"Remote Management", "Remote Management",
"Intel AMT", "Intel AMT",

View File

@ -1579,8 +1579,8 @@
}, },
{ {
"en": "Action File", "en": "Action File",
"nl": "Actie bestand",
"es": "Archivo de acción", "es": "Archivo de acción",
"nl": "Actie bestand",
"xloc": [ "xloc": [
"default.handlebars->25->579", "default.handlebars->25->579",
"default.handlebars->25->581" "default.handlebars->25->581"
@ -13425,8 +13425,8 @@
}, },
{ {
"en": "Place link to this device in the clipboard", "en": "Place link to this device in the clipboard",
"nl": "Plaats de link naar dit apparaat op het klembord",
"es": "Coloque el enlace a este dispositivo en el portapapeles", "es": "Coloque el enlace a este dispositivo en el portapapeles",
"nl": "Plaats de link naar dit apparaat op het klembord"
}, },
{ {
"cs": "Umístit uzel sem", "cs": "Umístit uzel sem",
@ -20734,4 +20734,4 @@
] ]
} }
] ]
} }

View File

@ -1116,7 +1116,7 @@
for (var i in webState) { localStorage.setItem(i, webState[i]); } for (var i in webState) { localStorage.setItem(i, webState[i]); }
if (!webState.loctag) { try { delete localStorage.removeItem('loctag'); } catch (ex) { } } if (!webState.loctag) { try { delete localStorage.removeItem('loctag'); } catch (ex) { } }
var args; var args, urlargs;
var autoReconnect = true; var autoReconnect = true;
var powerStatetable = ['', "Powered", "Sleep", "Sleep", "Sleep", "Hibernating", "Power off", "Present"]; var powerStatetable = ['', "Powered", "Sleep", "Sleep", "Sleep", "Hibernating", "Power off", "Present"];
var StatusStrs = ["Disconnected", "Connecting...", "Setup...", "Connected", "Intel® AMT Connected"]; var StatusStrs = ["Disconnected", "Connecting...", "Setup...", "Connected", "Intel® AMT Connected"];
@ -1192,6 +1192,14 @@
if (top != self && (loc == null || top.active == false)) { top.location = self.location; return; } if (top != self && (loc == null || top.active == false)) { top.location = self.location; return; }
} }
// Fetch URL arguments
urlargs = parseUriArgs();
delete urlargs.viewmode;
delete urlargs.gotonode;
delete urlargs.gotomesh;
delete urlargs.gotouser;
delete urlargs.gotougrp;
// Check if we are in debug mode // Check if we are in debug mode
args = parseUriArgs(); args = parseUriArgs();
if (!args.locale) { var x = getstore('loctag', 0); if ((x != null) && (x != '*')) { args.locale = x; } } if (!args.locale) { var x = getstore('loctag', 0); if ((x != null) && (x != '*')) { args.locale = x; } }
@ -1202,9 +1210,6 @@
QV('autoconnectbutton1', debugmode); // Desktop QV('autoconnectbutton1', debugmode); // Desktop
//QV('DeskClip', debugmode); // Clipboard feature, not completed so show in in debug mode only. //QV('DeskClip', debugmode); // Clipboard feature, not completed so show in in debug mode only.
// Clean up the URL
try { window.history.replaceState({}, document.title, window.location.pathname); } catch (ex) { }
if (nightMode) { QC('body').add('night'); QS('body')['background-color'] = '#000'; } if (nightMode) { QC('body').add('night'); QS('body')['background-color'] = '#000'; }
toggleFullScreen(); toggleFullScreen();
@ -4955,6 +4960,7 @@
var urlviewmode = ''; var urlviewmode = '';
if ((xxcurrentView >= 10) && (xxcurrentView <= 19) && (currentNode != null)) { if ((xxcurrentView >= 10) && (xxcurrentView <= 19) && (currentNode != null)) {
urlviewmode = '?viewmode=' + xxcurrentView + '&gotonode=' + currentNode._id.split('/')[2]; 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) { } try { window.history.replaceState({}, document.title, window.location.pathname + urlviewmode); } catch (ex) { }
} }
} }
@ -7809,6 +7815,7 @@
var urlviewmode = ''; var urlviewmode = '';
if ((xxcurrentView >= 20) && (xxcurrentView <= 29) && (currentMesh != null)) { if ((xxcurrentView >= 20) && (xxcurrentView <= 29) && (currentMesh != null)) {
urlviewmode = '?viewmode=' + xxcurrentView + '&gotomesh=' + currentMesh._id.split('/')[2]; 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) { } try { window.history.replaceState({}, document.title, window.location.pathname + urlviewmode); } catch (ex) { }
} }
} }
@ -9350,6 +9357,7 @@
var urlviewmode = ''; var urlviewmode = '';
if ((xxcurrentView >= 51) && (xxcurrentView <= 59) && (currentUserGroup != null)) { if ((xxcurrentView >= 51) && (xxcurrentView <= 59) && (currentUserGroup != null)) {
urlviewmode = '?viewmode=' + xxcurrentView + '&gotougrp=' + currentUserGroup._id.split('/')[2]; 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) { } try { window.history.replaceState({}, document.title, window.location.pathname + urlviewmode); } catch (ex) { }
} }
} }
@ -9591,6 +9599,7 @@
var urlviewmode = ''; var urlviewmode = '';
if ((xxcurrentView >= 30) && (xxcurrentView <= 39) && (currentUser != null)) { if ((xxcurrentView >= 30) && (xxcurrentView <= 39) && (currentUser != null)) {
urlviewmode = '?viewmode=' + xxcurrentView + '&gotouser=' + currentUser._id.split('/')[2]; 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) { } try { window.history.replaceState({}, document.title, window.location.pathname + urlviewmode); } catch (ex) { }
} }
} }
@ -10405,6 +10414,7 @@
} else if ((xxcurrentView >= 51) && (xxcurrentView <= 59)) { // User Group Link } else if ((xxcurrentView >= 51) && (xxcurrentView <= 59)) { // User Group Link
if (currentUserGroup != null) { urlviewmode = '?viewmode=' + xxcurrentView + '&gotougrp=' + currentUserGroup._id.split('/')[2]; } if (currentUserGroup != null) { urlviewmode = '?viewmode=' + xxcurrentView + '&gotougrp=' + currentUserGroup._id.split('/')[2]; }
} else if (xxcurrentView > 1) { urlviewmode = '?viewmode=' + xxcurrentView; } } else if (xxcurrentView > 1) { urlviewmode = '?viewmode=' + xxcurrentView; }
for (var i in urlargs) { urlviewmode += (((urlviewmode == '')?'?':'&') + i + '=' + urlargs[i]); }
try { window.history.replaceState({}, document.title, window.location.pathname + urlviewmode); } catch (ex) { } try { window.history.replaceState({}, document.title, window.location.pathname + urlviewmode); } catch (ex) { }
} }