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: