feat: add managed online updates
Signed Release / release (push) Successful in 9m24s

This commit is contained in:
Qiufeng
2026-08-04 20:05:50 +08:00
parent 4f2ea26e8e
commit d3892320dd
20 changed files with 1365 additions and 111 deletions
+11 -2
View File
@@ -44,14 +44,23 @@ import json, os, sys, tempfile
from datetime import datetime, timezone
path, phase, progress, message, version, error = sys.argv[1:]
payload = {
payload = {}
try:
if os.path.getsize(path) <= 64 * 1024:
with open(path, encoding="utf-8") as handle:
existing = json.load(handle)
if isinstance(existing, dict):
payload = existing
except (OSError, json.JSONDecodeError, TypeError, ValueError):
pass
payload.update({
"phase": phase,
"progress": int(progress),
"message": message,
"version": version or None,
"error": error or None,
"updatedAt": datetime.now(timezone.utc).isoformat().replace("+00:00", "Z"),
}
})
parent = os.path.dirname(path) or "."
fd, tmp = tempfile.mkstemp(prefix=".update-state-", dir=parent, text=True)
try: