Shutdown will redirect to home if it comes back up

This commit is contained in:
Taylor Helsper 2019-09-12 20:12:57 -05:00
parent 5a67cc2c62
commit eeae60e9c1

View File

@ -7,6 +7,38 @@
<meta name="google" content="notranslate">
<script src="{{ url_for('static', filename="js/jquery-3.3.1.min.js")}}"></script>
<script src="{{ url_for('static', filename="js/mynode.js")}}"></script>
<script>
$(document).ready(function() {
hasShutdown = 0
function redirectHome() {
window.location.replace("/");
}
function checkStatus() {
var jqxhr = $.get("/settings/ping", function() {
if (hasShutdown) {
// Redirect to home
setTimeout(redirectHome, 2500)
}
})
.done(function() {
if (hasShutdown) {
// Redirect to home
setTimeout(redirectHome, 2500)
}
})
.fail(function() {
hasShutdown = 1
})
}
checkStatus()
setInterval(checkStatus, 2500);
});
</script>
</head>
<body>