Added SplitStat Status Checking

This commit is contained in:
Alex / Awex
2021-08-23 07:02:25 -04:00
parent 752d931d00
commit fac7c91bcb
4 changed files with 291 additions and 136 deletions
+18
View File
@@ -0,0 +1,18 @@
async function checkForOutage() {
Global = {}
Global.error = false
await fetch(`https://api-splitstat.awexxx.xyz/heartbeat`).then(response => response.json()).catch(err => {
Global.error = true;
document.getElementById(`status`).innerText = `offline!`
document.getElementById(`addon`).innerText = `API returned nothing when sent a heartbeat.`
})
if (Global.error === false) {
document.getElementById(`status`).innerText = `online!`
document.getElementById(`addon`).innerText = `API responded when sent a heartbeat!`
}
console.log(`Checked, checking in 10s`)
setTimeout(checkForOutage, 10000);
}