feat(ui): driver settings and code updates over ESP-NOW

Settings gets a Driver tab (/settings/editor). It sends a driver its settings through PUT /devices/<id>, which now forwards name too, and runs the tools/driver_ota.py session from the browser. The firmware embeds the led-driver files and a manifest of their hashes, because crypto.subtle is unavailable over plain HTTP.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Opus 5.5 committed 2026-11-04 23:51:41 +13:00
1 parent 2f0c26e9b8
commit 06953028ab
11 files changed
+421 -8

No files matched your search

+18 -1
View File
@@ -18,7 +18,7 @@ for f in "$SRC"/static/*; do
*) cp "$f" "$OUT/static/$b" ;;
esac
done
for p in index settings; do
for p in index settings settings_editor; do
npx --yes html-minifier-terser@7.2.0 --collapse-whitespace --remove-comments \
--minify-css true --minify-js true -o "$OUT/$p.html" "$SRC/templates/$p.html"
done
@@ -27,6 +27,23 @@ done
npx --yes html-minifier-terser@7.2.0 --collapse-whitespace --remove-comments \
--minify-css true --minify-js true -o "$OUT/audio.html" web/audio.html
# led-driver app files and their hashes, for updating drivers from the web UI (same set as tools/driver_ota.py)
python3 - "$OUT/static/driver" <<'PY'
import hashlib, json, os, shutil, sys
sys.path.insert(0, "tools")
from driver_ota import MAX_FILE, file_set
root = sys.argv[1]
files = []
for dest, local in file_set("led-driver"):
data = open(local, "rb").read()
if len(data) > MAX_FILE:
sys.exit(f"{dest}: over {MAX_FILE} B, drivers cannot be sent it")
os.makedirs(os.path.dirname(os.path.join(root, dest)), exist_ok=True)
shutil.copy(local, os.path.join(root, dest))
files.append({"path": dest, "sha": hashlib.sha256(data).hexdigest(), "size": len(data)})
json.dump({"files": files}, open(os.path.join(root, "manifest.json"), "w"))
PY
# Ship only the .gz copies; the server sends Content-Encoding: gzip
find "$OUT" -type f -exec gzip -9 -n -f {} \;
find "$OUT" -name '*.gz' -exec gzip -t {} \;