diff options
Diffstat (limited to 'status.js')
-rw-r--r-- | status.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/status.js b/status.js new file mode 100644 index 0000000..262a1b5 --- /dev/null +++ b/status.js @@ -0,0 +1,24 @@ +let urls = [ + WIKI_URL, RSS_URL, RSS_VIDEO_URL, GITEA_URL, FILES_URL, FILE_FEED_URL, CALENDAR_URL, BUDGET_URL +] +let ids = [ + "wiki", "rss", "rssvideo", "gitea", "files", "filefeed", "calendar", "budget" +] +let status_url = `http://localhost:8080?${urls.join("&")}` +fetch(status_url) + .then( response => response.text()) + .then( response => { + response.split("\n").forEach((el, i)=> { + if(el == "") { return } + console.log(urls[i], ids[i], el) + let htmlEl = document.getElementById(ids[i]) + let newEl = document.createElement("span") + if(el == "up"){ + newEl.className = "status-up" + } else { + newEl.className = "status-down" + } + htmlEl.insertBefore(newEl, htmlEl.lastChild); + }) + }) + |