fix webstate not saving #7490
Signed-off-by: si458 <simonsmith5521@gmail.com>
si458 committed
Dec 17, 2025 at 18:18 UTC
f036fe5830a704e16ee3197a96839c06fc51c640
4 files changed
+11
-7
views/default-mobile.handlebars
+2
-2
@@ -1293,8 +1293,8 @@
1293
// Process server-side web state
1294
var webState = '{{{webstate}}}';
1295
if (webState != '') { webState = JSON.parse(decodeURIComponent(webState)); }
1296
- for (var i in webState) { localStorage.setItem(i, webState[i]); }
1297
- if (webState && !webState.loctag) { delete localStorage.removeItem('loctag'); }
1296
+ for (var i in webState) { try { localStorage.setItem(i, webState[i]); } catch (ex) { } }
1297
+ if (webState && !webState.loctag) { try { delete localStorage.removeItem('loctag'); } catch (ex) { } }
1298
1299
// Fetch URL arguments & do sanitation
1300
var urlargs = parseUriArgs();
views/default.handlebars
+2
-2
@@ -1515,8 +1515,8 @@
1515
var webState = '{{{webstate}}}';
1516
if (webState != '') { webState = JSON.parse(decodeURIComponent(webState)); }
1517
if ((webState == null) || (typeof webState != 'object')) { webState = {}; }
1518
- for (var i in webState) { if (i != 'desktopsettings') { try { localStorage.setItem(i, webState[i]); } catch (ex) {} } }
1519
- if (!webState.loctag) { try { delete localStorage.removeItem('loctag'); } catch (ex) { } }
1518
+ for (var i in webState) { try { localStorage.setItem(i, webState[i]); } catch (ex) {} }
1519
+ if (webState && !webState.loctag) { try { delete localStorage.removeItem('loctag'); } catch (ex) { } }
1520
1521
var args, urlargs;
1522
var autoReconnect = true;
views/default3.handlebars
+2
-2
@@ -2028,8 +2028,8 @@
2028
var webState = '{{{webstate}}}';
2029
if (webState != '') { webState = JSON.parse(decodeURIComponent(webState)); }
2030
if ((webState == null) || (typeof webState != 'object')) { webState = {}; }
2031
- for (var i in webState) { if (i != 'desktopsettings') { try { localStorage.setItem(i, webState[i]); } catch (ex) { } } }
2032
- if (!webState.loctag) { try { delete localStorage.removeItem('loctag'); } catch (ex) { } }
2031
+ for (var i in webState) { try { localStorage.setItem(i, webState[i]); } catch (ex) { } }
2032
+ if (webState && !webState.loctag) { try { delete localStorage.removeItem('loctag'); } catch (ex) { } }
2033
2034
var args, urlargs;
2035
var autoReconnect = true;
webserver.js
+5
-1
@@ -9389,7 +9389,11 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
9389
9390
// Filter the user web site and only output state that we need to keep
9391
const acceptableUserWebStateStrings = ['webPageStackMenu', 'notifications', 'deviceView', 'nightMode', 'webPageFullScreen', 'search', 'showRealNames', 'sort', 'deskAspectRatio', 'viewsize', 'DeskControl', 'uiMode', 'footerBar','loctag','theme','lastThemes','uiViewMode'];
9392
- const acceptableUserWebStateDesktopStrings = ['encoding', 'showfocus', 'showmouse', 'showcad', 'limitFrameRate', 'noMouseRotate', 'quality', 'scaling', 'agentencoding']
9392
+ const acceptableUserWebStateDesktopStrings = [
9393
+ 'encoding', 'showfocus', 'showmouse', 'quality', 'scaling', 'framerate', 'agentencoding', 'swapmouse',
9394
+ 'rmw', 'remotekeymap', 'autoclipboard', 'autolock', 'localkeymap', 'kvmrmw', 'rdpsize', 'rdpsmb',
9395
+ 'rdprmw', 'rdpautoclipboard', 'rdpflags'
9396
+ ];
9397
obj.filterUserWebState = function (state) {
9398
if (typeof state == 'string') { try { state = JSON.parse(state); } catch (ex) { return null; } }
9399
if ((state == null) || (typeof state != 'object')) { return null; }