Improved web application URL replacement.
Ylian Saint-Hilaire committed
Jan 29, 2020 at 15:24 UTC
0a24f2495959ce1c87bf84bb131df69f5d6a6bdd
3 files changed
+18
-8
package.json
+1
-1
@@ -1,6 +1,6 @@
1
{
2
"name": "meshcentral",
3
- "version": "0.4.8-e",
3
+ "version": "0.4.8-f",
4
"keywords": [
5
"Remote Management",
6
"Intel AMT",
translate/translate.json
+3
-3
@@ -1579,8 +1579,8 @@
1579
},
1580
{
1581
"en": "Action File",
1582
- "nl": "Actie bestand",
1582
"es": "Archivo de acción",
1583
+ "nl": "Actie bestand",
1584
"xloc": [
1585
"default.handlebars->25->579",
1586
"default.handlebars->25->581"
@@ -13425,8 +13425,8 @@
13425
},
13426
{
13427
"en": "Place link to this device in the clipboard",
13428
- "nl": "Plaats de link naar dit apparaat op het klembord",
13428
"es": "Coloque el enlace a este dispositivo en el portapapeles",
13429
+ "nl": "Plaats de link naar dit apparaat op het klembord"
13430
},
13431
{
13432
"cs": "Umístit uzel sem",
@@ -20734,4 +20734,4 @@
20734
]
20735
}
20736
]
20737
-}
20737
+}
\ No newline at end of file
views/default.handlebars
+14
-4
@@ -1116,7 +1116,7 @@
1116
for (var i in webState) { localStorage.setItem(i, webState[i]); }
1117
if (!webState.loctag) { try { delete localStorage.removeItem('loctag'); } catch (ex) { } }
1118
1119
- var args;
1119
+ var args, urlargs;
1120
var autoReconnect = true;
1121
var powerStatetable = ['', "Powered", "Sleep", "Sleep", "Sleep", "Hibernating", "Power off", "Present"];
1122
var StatusStrs = ["Disconnected", "Connecting...", "Setup...", "Connected", "Intel® AMT Connected"];
@@ -1192,6 +1192,14 @@
1192
if (top != self && (loc == null || top.active == false)) { top.location = self.location; return; }
1193
}
1194
1195
+ // Fetch URL arguments
1196
+ urlargs = parseUriArgs();
1197
+ delete urlargs.viewmode;
1198
+ delete urlargs.gotonode;
1199
+ delete urlargs.gotomesh;
1200
+ delete urlargs.gotouser;
1201
+ delete urlargs.gotougrp;
1202
+
1203
// Check if we are in debug mode
1204
args = parseUriArgs();
1205
if (!args.locale) { var x = getstore('loctag', 0); if ((x != null) && (x != '*')) { args.locale = x; } }
@@ -1202,9 +1210,6 @@
1210
QV('autoconnectbutton1', debugmode); // Desktop
1211
//QV('DeskClip', debugmode); // Clipboard feature, not completed so show in in debug mode only.
1212
1205
- // Clean up the URL
1206
- try { window.history.replaceState({}, document.title, window.location.pathname); } catch (ex) { }
1207
-
1213
if (nightMode) { QC('body').add('night'); QS('body')['background-color'] = '#000'; }
1214
toggleFullScreen();
1215
@@ -4955,6 +4960,7 @@
4960
var urlviewmode = '';
4961
if ((xxcurrentView >= 10) && (xxcurrentView <= 19) && (currentNode != null)) {
4962
urlviewmode = '?viewmode=' + xxcurrentView + '&gotonode=' + currentNode._id.split('/')[2];
4963
+ for (var i in urlargs) { urlviewmode += ('&' + i + '=' + urlargs[i]); }
4964
try { window.history.replaceState({}, document.title, window.location.pathname + urlviewmode); } catch (ex) { }
4965
}
4966
}
@@ -7809,6 +7815,7 @@
7815
var urlviewmode = '';
7816
if ((xxcurrentView >= 20) && (xxcurrentView <= 29) && (currentMesh != null)) {
7817
urlviewmode = '?viewmode=' + xxcurrentView + '&gotomesh=' + currentMesh._id.split('/')[2];
7818
+ for (var i in urlargs) { urlviewmode += ('&' + i + '=' + urlargs[i]); }
7819
try { window.history.replaceState({}, document.title, window.location.pathname + urlviewmode); } catch (ex) { }
7820
}
7821
}
@@ -9350,6 +9357,7 @@
9357
var urlviewmode = '';
9358
if ((xxcurrentView >= 51) && (xxcurrentView <= 59) && (currentUserGroup != null)) {
9359
urlviewmode = '?viewmode=' + xxcurrentView + '&gotougrp=' + currentUserGroup._id.split('/')[2];
9360
+ for (var i in urlargs) { urlviewmode += ('&' + i + '=' + urlargs[i]); }
9361
try { window.history.replaceState({}, document.title, window.location.pathname + urlviewmode); } catch (ex) { }
9362
}
9363
}
@@ -9591,6 +9599,7 @@
9599
var urlviewmode = '';
9600
if ((xxcurrentView >= 30) && (xxcurrentView <= 39) && (currentUser != null)) {
9601
urlviewmode = '?viewmode=' + xxcurrentView + '&gotouser=' + currentUser._id.split('/')[2];
9602
+ for (var i in urlargs) { urlviewmode += ('&' + i + '=' + urlargs[i]); }
9603
try { window.history.replaceState({}, document.title, window.location.pathname + urlviewmode); } catch (ex) { }
9604
}
9605
}
@@ -10405,6 +10414,7 @@
10414
} else if ((xxcurrentView >= 51) && (xxcurrentView <= 59)) { // User Group Link
10415
if (currentUserGroup != null) { urlviewmode = '?viewmode=' + xxcurrentView + '&gotougrp=' + currentUserGroup._id.split('/')[2]; }
10416
} else if (xxcurrentView > 1) { urlviewmode = '?viewmode=' + xxcurrentView; }
10417
+ for (var i in urlargs) { urlviewmode += (((urlviewmode == '')?'?':'&') + i + '=' + urlargs[i]); }
10418
try { window.history.replaceState({}, document.title, window.location.pathname + urlviewmode); } catch (ex) { }
10419
}
10420