Skip to content
Snippets Groups Projects
Unverified Commit f2a52c28 authored by Brother-Lal's avatar Brother-Lal Committed by Matthias Schiffer
Browse files

fix error in statuspage if cookies are disabled (#912)

If cookies are disabled, the Statuspage only displays an empty ("Not connected")
This checks if the localStorage API is available and working and only uses it in this case
Also allows better backwards compatibility.
parent e857bbc5
No related branches found
No related tags found
No related merge requests found
......@@ -83,7 +83,17 @@ require([ "bacon"
return a
}
if (localStorage.nodes)
var lsavailable = false
try {
localStorage.setItem("t", "t")
localStorage.removeItem("t")
lsavailable = true
} catch(e) {
lsavailable = false
}
if ( lsavailable && localStorage.nodes)
JSON.parse(localStorage.nodes).forEach(nodesBusIn.push)
nodesBus.map(".nodes").onValue(function (nodes) {
......@@ -92,7 +102,8 @@ require([ "bacon"
for (var k in nodes)
out.push(nodes[k])
localStorage.nodes = JSON.stringify(out)
if (lsavailable)
localStorage.nodes = JSON.stringify(out)
})
var bootstrap = Helper.getJSON(bootstrapUrl)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment