summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs/luci-static/resources
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-09-21 10:55:54 +0200
committerJo-Philipp Wich <jo@mein.io>2019-09-21 10:55:54 +0200
commit6dba41cadc82785f23773f219d30403f6b12956e (patch)
tree73a569358ad81b43e213d65463253972c5c592a4 /modules/luci-base/htdocs/luci-static/resources
parent119c6319cbbcaa033cf2b027866fe1bb3bbdbb75 (diff)
luci-base: tie cached system features to user session
Store the cached system feature flags keyed by the current session id, this ensures that the features are refreshed on login. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/luci.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/luci.js b/modules/luci-base/htdocs/luci-static/resources/luci.js
index 1d349ebc17..4e3c8445a9 100644
--- a/modules/luci-base/htdocs/luci-static/resources/luci.js
+++ b/modules/luci-base/htdocs/luci-static/resources/luci.js
@@ -823,9 +823,14 @@
},
probeSystemFeatures: function() {
+ var sessionid = classes.rpc.getSessionID();
+
if (sysFeatures == null) {
try {
- sysFeatures = JSON.parse(window.sessionStorage.getItem('sysFeatures'));
+ var data = JSON.parse(window.sessionStorage.getItem('sysFeatures'));
+
+ if (this.isObject(data) && this.isObject(data[sessionid]))
+ sysFeatures = data[sessionid];
}
catch (e) {}
}
@@ -837,7 +842,10 @@
expect: { '': {} }
})().then(function(features) {
try {
- window.sessionStorage.setItem('sysFeatures', JSON.stringify(features));
+ var data = {};
+ data[sessionid] = features;
+
+ window.sessionStorage.setItem('sysFeatures', JSON.stringify(data));
}
catch (e) {}