2022-09-13 15:57:56 +00:00
|
|
|
var prevSha = localStorage.getItem("commitsha") ?? "ThisShouldntBeASHA";
|
|
|
|
|
2022-09-13 16:31:17 +00:00
|
|
|
setInterval(reqData, 60000);
|
2022-09-13 15:57:56 +00:00
|
|
|
|
2022-09-13 18:13:11 +00:00
|
|
|
//balls lmao
|
|
|
|
|
2022-09-13 15:57:56 +00:00
|
|
|
function reqData() {
|
|
|
|
const XHR = new XMLHttpRequest();
|
|
|
|
|
|
|
|
XHR.addEventListener("load", (event) => {
|
2022-09-13 16:24:16 +00:00
|
|
|
var resp = event.target.response;
|
2022-09-13 15:57:56 +00:00
|
|
|
|
2022-09-13 16:24:16 +00:00
|
|
|
if (event.target.status.toString().includes("40")) {
|
|
|
|
console.log(event.target.status + " error :[")
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (resp != prevSha) {
|
2022-09-13 15:57:56 +00:00
|
|
|
if (prevSha == "ThisShouldntBeASHA") {
|
2022-09-13 16:24:16 +00:00
|
|
|
localStorage.setItem("commitsha", resp);
|
2022-09-13 15:57:56 +00:00
|
|
|
} else {
|
2022-09-15 15:26:24 +00:00
|
|
|
document.querySelector("#updatedialog").classList.add("open");
|
2022-09-13 16:24:16 +00:00
|
|
|
localStorage.setItem("commitsha", resp);
|
2022-09-13 15:57:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
XHR.addEventListener("error", (event) => {
|
|
|
|
console.log('Oops! Something went wrong.');
|
|
|
|
});
|
|
|
|
|
2022-09-13 16:24:16 +00:00
|
|
|
XHR.open("GET", "https://ClockCheckGithub.meowcatheorange.repl.co");
|
2022-09-13 15:57:56 +00:00
|
|
|
|
|
|
|
XHR.send();
|
|
|
|
}
|
|
|
|
|
|
|
|
reqData();
|