the home site for me: also iteration 3 or 4 of my site

feat: add status

dunkirk.sh acb3ec77 d8d21394

verified
+19 -30
+19 -30
templates/footer.html
··· 11 <a href="https://tangled.org/@dunkirk.sh/nixvim"><img src="/badges/made-with-neovim.png" /></a> 12 </p> 13 <p style="margin-bottom: 0.5rem"> 14 - &copy; {{ now() | date(format="%Y") }} Kieran Klukas || 15 <code id="visits">0</code> page visits || {% set hash = 16 get_env(name="CF_PAGES_COMMIT_SHA", default=load_data(path=".git/refs/heads/main", required=false))%}{% if hash is 17 not string %}{% set hash = "unknown" %}{% endif %}<a href=https://tangled.sh/@dunkirk.sh/zera/commit/{{ hash ··· 20 </p> 21 <p style="margin-bottom: 0.5rem"> 22 Webrings: 23 - <a href="https://w.elr.sh">elr</a> 24 - [<a href='javascript:void(0)' onclick='randomSite()'>random</a> | 25 - <a href='#' id='prev-link'>prev</a> | 26 - <a href='#' id='next-link'>next</a>] • 27 <a href="https://ctp-webr.ing">ctp</a> 28 [<a href="https://ctp-webr.ing/dunkirk/previous">prev</a> | 29 <a href="https://ctp-webr.ing/dunkirk/next">next</a>] 30 </p> 31 32 - <script type="text/javascript" src="https://w.elr.sh/onionring-variables.js"></script> 33 <script> 34 - thisSite = "https://dunkirk.sh" 35 - thisIndex = null; 36 - 37 - for (i = 0; i < sites.length; i++) { 38 - if (thisSite.startsWith(sites[i])) { 39 - thisIndex = i; 40 - break; 41 - } 42 - } 43 - 44 - function randomSite() { 45 - otherSites = sites.slice(); 46 - otherSites.splice(thisIndex, 1); 47 - randomIndex = Math.floor(Math.random() * otherSites.length); 48 - location.href = otherSites[randomIndex]; 49 - } 50 - 51 - 52 - previousIndex = (thisIndex - 1 < 0) ? sites.length - 1 : thisIndex - 1; 53 - nextIndex = (thisIndex + 1 >= sites.length) ? 0 : thisIndex + 1; 54 - 55 - document.getElementById('prev-link').href = sites[previousIndex]; 56 - document.getElementById('next-link').href = sites[nextIndex]; 57 </script> 58 - </div>
··· 11 <a href="https://tangled.org/@dunkirk.sh/nixvim"><img src="/badges/made-with-neovim.png" /></a> 12 </p> 13 <p style="margin-bottom: 0.5rem"> 14 + <span id="status-indicator"></span> 15 <code id="visits">0</code> page visits || {% set hash = 16 get_env(name="CF_PAGES_COMMIT_SHA", default=load_data(path=".git/refs/heads/main", required=false))%}{% if hash is 17 not string %}{% set hash = "unknown" %}{% endif %}<a href=https://tangled.sh/@dunkirk.sh/zera/commit/{{ hash ··· 20 </p> 21 <p style="margin-bottom: 0.5rem"> 22 Webrings: 23 <a href="https://ctp-webr.ing">ctp</a> 24 [<a href="https://ctp-webr.ing/dunkirk/previous">prev</a> | 25 <a href="https://ctp-webr.ing/dunkirk/next">next</a>] 26 </p> 27 28 <script> 29 + (function () { 30 + fetch("https://infra.dunkirk.sh/api/status/overall") 31 + .then(r => r.json()) 32 + .then(data => { 33 + const el = document.getElementById("status-indicator"); 34 + const labels = { 35 + up: "all systems operational", 36 + degraded: `degraded · ${data.uptime_7d}% uptime`, 37 + partial: `partial outage · ${data.uptime_7d}% uptime`, 38 + down: "systems down", 39 + unknown: "status unknown" 40 + }; 41 + el.innerHTML = `<code>${labels[data.status] || data.status}</code> ||`; 42 + el.style.cssText = "display:inline;margin-right:0.3em;"; 43 + }) 44 + .catch(() => { }); 45 + })(); 46 </script> 47 + </div>