feat: add tag-based update check
CI / test (push) Successful in 38s

Track VERSION, compare it with Gitea tags via git ls-remote (API fallback), expose GET /api/update and a Services card with the current version.
This commit is contained in:
strsv committed 2026-11-07 02:46:05 +03:00
1 parent eb8a9bb57b
commit f1149974aa
15 files changed
+390 -2

No files matched your search

+14
View File
@@ -37,6 +37,7 @@ for stream in (sys.stdout, sys.stderr):
except Exception:
pass
import check_updates
import covers
import db
import reco
@@ -1014,6 +1015,8 @@ class Handler(BaseHTTPRequestHandler):
self._compare(qs)
elif path == "/api/activity":
self._activity(qs)
elif path == "/api/update":
self._update(qs)
elif path == "/api/steam/friends":
self._steam_friends()
elif path.startswith("/api/steam/friends/"):
@@ -1141,6 +1144,7 @@ class Handler(BaseHTTPRequestHandler):
"signals": signals, "hltb_checked": hltb_checked,
"hltb_matched": hltb_matched,
"owned": ownership["owned"], "shared": ownership["shared"],
"version": check_updates.read_version(),
"steam_api": bool(steam_api.has_key() and steam_api.steam_id(con)),
})
finally:
@@ -1508,6 +1512,16 @@ class Handler(BaseHTTPRequestHandler):
finally:
con.close()
def _update(self, qs):
if qs.get("refresh", ["0"])[0] in ("1", "true", "yes"):
check_updates.clear_cache()
try:
data = check_updates.check()
except RuntimeError as exc:
self._error(502, str(exc))
return
self._json(data)
def _activity(self, qs):
year = (qs.get("year", [""])[0] or "").strip()
if year and (len(year) != 4 or not year.isdigit()):