Skip to content
Snippets Groups Projects
Commit e80f751a 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 30811f7f
Branches
Tags
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