From 6103a34ae11d7dceb8e9678dadf9c2054e7f293b Mon Sep 17 00:00:00 2001 From: Stef Date: Sun, 31 Aug 2025 14:06:55 +0200 Subject: [PATCH] Switched from browser refresh to update webpage with API fetch Added an ID field to the API. Added a fetch script that updates the webpage every second. --- app.py | 2 +- mem/__init__.py | 1 + templates/home.html | 41 ++++++++++++++++++++++++++++++++++++++++- 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 52215d3..56f92a1 100644 --- a/app.py +++ b/app.py @@ -14,7 +14,7 @@ def homepage(): return render_template("home.html", services=services) -@app.route("/status") +@app.route("/api/status") def status(): return jsonify([s.to_dict() for s in services]) diff --git a/mem/__init__.py b/mem/__init__.py index 8af79dd..864ecdd 100644 --- a/mem/__init__.py +++ b/mem/__init__.py @@ -40,6 +40,7 @@ class service: "ping": self.ping, "label": self.label, "icon_filetype": self.icon_filetype, + "id": self.id, } def set_status(self, status: Optional[int]): diff --git a/templates/home.html b/templates/home.html index 4911bb5..c8d4f63 100644 --- a/templates/home.html +++ b/templates/home.html @@ -2,7 +2,7 @@ - + Debug Divs @@ -27,4 +27,43 @@ + + \ No newline at end of file