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

+10
View File
@@ -190,6 +190,7 @@ class ApiTests(unittest.TestCase):
self.assertEqual(data["hltb_matched"], 1)
self.assertEqual(data["owned"], 1)
self.assertEqual(data["shared"], 1)
self.assertRegex(data["version"], r"^\d+\.\d+\.\d+")
self.assertFalse(data["steam_api"])
genres = {g["name"]: g["count"] for g in data["genres"]}
self.assertEqual(genres["RPG"], 2)
@@ -572,6 +573,15 @@ class ApiTests(unittest.TestCase):
mock.patch.object(server.steam_api, "achievements", return_value=None):
self.get("/api/steam/achievements/1", expect=404)
def test_update_check(self):
payload = {"current": "1.0.0", "latest": "v1.1.0", "update_available": True,
"url": "https://example/tag", "checked_at": "2026-01-01", "tags": []}
with mock.patch.object(server.check_updates, "check", return_value=payload):
self.assertEqual(self.get("/api/update"), payload)
with mock.patch.object(server.check_updates, "check",
side_effect=RuntimeError("offline")):
self.assertEqual(self.get("/api/update", expect=502)["error"], "offline")
def test_activity_heatmap(self):
data = self.get("/api/activity?year=2026")
self.assertEqual(data["year"], "2026")