diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-09-21 10:55:54 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-09-21 10:55:54 +0200 |
commit | 6dba41cadc82785f23773f219d30403f6b12956e (patch) | |
tree | 73a569358ad81b43e213d65463253972c5c592a4 /modules/luci-base/htdocs/luci-static/resources | |
parent | 119c6319cbbcaa033cf2b027866fe1bb3bbdbb75 (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.js | 12 |
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) {} |