clear stats interval on shutdown button, remove deprecated sync httpget
parent
02fde0ad70
commit
b66e1d852e
|
@ -25,6 +25,8 @@ totalRec = document.getElementById('totalRec')
|
||||||
securityLevel = document.getElementById('securityLevel')
|
securityLevel = document.getElementById('securityLevel')
|
||||||
sec_description_str = 'unknown'
|
sec_description_str = 'unknown'
|
||||||
|
|
||||||
|
statsInterval = null
|
||||||
|
|
||||||
function showSecStatNotice(){
|
function showSecStatNotice(){
|
||||||
var secWarnEls = document.getElementsByClassName('secRequestNotice')
|
var secWarnEls = document.getElementsByClassName('secRequestNotice')
|
||||||
for (el = 0; el < secWarnEls.length; el++){
|
for (el = 0; el < secWarnEls.length; el++){
|
||||||
|
@ -143,7 +145,7 @@ document.addEventListener("visibilitychange", function() {
|
||||||
})
|
})
|
||||||
|
|
||||||
getStats()
|
getStats()
|
||||||
setInterval(function(){getStats()}, 1000)
|
statsInterval = setInterval(function(){getStats()}, 1000)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -65,18 +65,7 @@ function arrayContains(needle, arrhaystack) {
|
||||||
return (arrhaystack.indexOf(needle) > -1);
|
return (arrhaystack.indexOf(needle) > -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function httpGet(theUrl) {
|
|
||||||
var xmlHttp = new XMLHttpRequest()
|
|
||||||
xmlHttp.open( "GET", theUrl, false ) // false for synchronous request
|
|
||||||
xmlHttp.setRequestHeader('token', webpass)
|
|
||||||
xmlHttp.send( null )
|
|
||||||
if (xmlHttp.status == 200){
|
|
||||||
return xmlHttp.responseText
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function overlay(overlayID) {
|
function overlay(overlayID) {
|
||||||
el = document.getElementById(overlayID)
|
el = document.getElementById(overlayID)
|
||||||
el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible"
|
el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible"
|
||||||
|
|
|
@ -23,8 +23,13 @@ restartBtn = document.getElementById('restartNode')
|
||||||
shutdownBtn.onclick = function(){
|
shutdownBtn.onclick = function(){
|
||||||
if (! nowebpass){
|
if (! nowebpass){
|
||||||
if (confirm("Really shutdown Onionr?")){
|
if (confirm("Really shutdown Onionr?")){
|
||||||
httpGet('/shutdownclean')
|
fetch('/shutdownclean', {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
"token": webpass
|
||||||
|
}})
|
||||||
overlay('shutdownNotice')
|
overlay('shutdownNotice')
|
||||||
|
clearInterval(statsInterval)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue