feat: add integration with status
All checks were successful
eleventy / build (push) Successful in 1m12s

This commit is contained in:
rizaldy 2024-09-22 17:54:10 +07:00
parent 608698ce58
commit fead895405
3 changed files with 47 additions and 1 deletions

View File

@ -350,3 +350,20 @@ footer a {
font-size: 3rem;
}
}
#status {
display: none;
box-sizing: border-box;
width: 100%;
position: fixed;
top: 0;
left: 0;
background-color: #cf7328;
overflow-x: auto;
text-align: center;
padding: 0 10px;
color: #fff;
font-weight: bold;
height: 30px;
white-space: nowrap;
}

View File

@ -1,5 +1,7 @@
---
<div id="status"></div>
<footer>
I collect a bit of data—for the sake of vanity metrics—that is reported to my self-hosted [Umami](https://umami.is) instance. No personal data is collected and you can opt out by using [uBlock Origin](https://ublockorigin.com/) just like the rest of us.

View File

@ -9,5 +9,32 @@
<script async src="https://u.faultables.net/umami.js" data-website-id="82853ef5-d8ca-4a3d-8170-784698eff79f"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
fetch("https://status.edgy0.workers.dev/")
.then(res => res.json())
.then(payload => {
const data = payload.data
if (data.downCount > 0) {
const container = document.getElementById("status")
const learnMore = document.createElement("a")
learnMore.href = "https://status.faultables.net"
learnMore.rel = "noopener noreferer"
learnMore.target = "_blank"
learnMore.innerText = "learn more here"
const text = document.createElement("p")
text.innerText = `${data.downCount} out of ${data.servicesCount} services from faultables homelab are down — `
container.style.display = "block"
text.appendChild(learnMore)
container.appendChild(text)
}
})
})
</script>
</body>
</html>