v0.5.84: matches origin filter, mobile gate, refresh reliability.

Ship Web refresh cache/lock, mobile demand gate, matches 职业/国服 filter, and related site updates through 0.5.84.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
voson
2026-07-29 18:31:55 +08:00
co-authored by Cursor
parent 7681fdb069
commit b01552ee6e
50 changed files with 3406 additions and 487 deletions
+9 -7
View File
@@ -20,11 +20,10 @@ from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
import argparse
import json
from datetime import datetime, timezone
from shared.grid import hero_table
from shared.http_utils import http_json
from shared.http_utils import http_json, write_json_atomic
from shared.paths import DATA
OPENDOTA_HERO_STATS = "https://api.opendota.com/api/heroStats"
@@ -173,6 +172,8 @@ def main() -> None:
raw = http_json(OPENDOTA_HERO_STATS)
if not isinstance(raw, list):
raise SystemExit(f"unexpected heroStats payload type: {type(raw).__name__}")
if not raw:
raise SystemExit("heroStats returned an empty list; keeping previous cache")
window_days = detect_window_days(raw)
by_hero: dict[str, dict] = {}
@@ -191,11 +192,12 @@ def main() -> None:
by_hero[key] = row_to_hero_stats(row)
payload = build_payload(by_hero, window_days=window_days)
args.out.parent.mkdir(parents=True, exist_ok=True)
args.out.write_text(
json.dumps(payload, ensure_ascii=False, indent=2) + "\n",
encoding="utf-8",
)
if len(by_hero) < max(100, len(heroes) * 4 // 5):
raise SystemExit(
f"heroStats only contained {len(by_hero)}/{len(heroes)} known heroes; "
"keeping previous cache"
)
write_json_atomic(args.out, payload)
missing = [h["key"] for h in heroes if h["key"] not in by_hero]
print(
f"done: {len(by_hero)} heroes -> {args.out}"