From 3e1ad11a67b8649cf880238dad39669648108d08 Mon Sep 17 00:00:00 2001 From: Raymond Bailie Date: Wed, 17 Jun 2026 11:41:56 +0200 Subject: [PATCH] Add firmware update button and update endpoint --- html/index.html | 2 +- webserver.py | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/html/index.html b/html/index.html index 0de86f3..374d872 100644 --- a/html/index.html +++ b/html/index.html @@ -272,7 +272,7 @@
- +
diff --git a/webserver.py b/webserver.py index 1cd032e..5233ad9 100644 --- a/webserver.py +++ b/webserver.py @@ -2,6 +2,7 @@ import json import gc import time import uasyncio as asyncio +#import update # Import config value from config import TANK_CAPACITY_L, VERSION @@ -68,6 +69,25 @@ class WebServer: json.dumps({"ok": True}).encode() ) + # ---------- UPDATE ---------- + elif path == "/update": + + writer.write( + b"HTTP/1.1 200 OK\r\n" + b"Content-Type: application/json\r\n\r\n" + + json.dumps({ + "ok": True, + "message": "Starting update" + }).encode() + ) + + await writer.drain() + + import update + +# # ---------- JAVASCRIPT ---------- +# elif path == "/app.js": + # ---------- JAVASCRIPT (CONFIG INJECTED) ---------- elif path == "/app.js": with open("/html/app.js") as f: