v0.6.9: stop serving match-template crops as hero portraits.
Export and OSS upload require wide Heroes-page cards only; bump cache stamp to wide2 so clients drop polluted squares. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -48,7 +48,6 @@ from shared.paths import (
|
||||
ROOT,
|
||||
STREAMER_AVATARS,
|
||||
STREAMER_VIDEOS,
|
||||
TEMPLATES_CDN,
|
||||
UI_ICONS,
|
||||
WEB_DIST,
|
||||
)
|
||||
@@ -56,7 +55,7 @@ from shared.paths import (
|
||||
from seo_prerender import DEFAULT_SITE_ORIGIN, write_seo_bundle
|
||||
from serve_relations import WEB_DIR, build_payload
|
||||
|
||||
SITE_VERSION = "0.6.8"
|
||||
SITE_VERSION = "0.6.9"
|
||||
DEFAULT_OSS_BASE = "https://climperor.oss-cn-shanghai.aliyuncs.com"
|
||||
|
||||
|
||||
@@ -106,28 +105,40 @@ def populate_static_assets(out: Path, payload: dict) -> dict[str, int]:
|
||||
n_vid += 1
|
||||
counts["streamer-video"] = n_vid
|
||||
|
||||
# Wide Heroes-page cards only — never fall back to pc/templates/cdn
|
||||
# (96×96 match crops). That fallback previously overwrote OSS portraits.
|
||||
portrait_dst = out / "portrait"
|
||||
portrait_dst.mkdir(exist_ok=True)
|
||||
n_portrait = 0
|
||||
missing: list[str] = []
|
||||
for hero in payload.get("heroes") or []:
|
||||
key = hero.get("key")
|
||||
if not key:
|
||||
continue
|
||||
src = HERO_PORTRAITS / f"{key}.png"
|
||||
if not src.is_file():
|
||||
src = TEMPLATES_CDN / f"{key}.png"
|
||||
if src.is_file():
|
||||
shutil.copy2(src, portrait_dst / f"{key}.png")
|
||||
n_portrait += 1
|
||||
else:
|
||||
missing.append(key)
|
||||
# Patch-only units (e.g. spirit_bear) are optional; copy when present.
|
||||
for cell in ((payload.get("patch_lookup") or {}).get("heroes") or {}).values():
|
||||
key = cell.get("key") if isinstance(cell, dict) else None
|
||||
if not key:
|
||||
if not key or (portrait_dst / f"{key}.png").is_file():
|
||||
continue
|
||||
src = HERO_PORTRAITS / f"{key}.png"
|
||||
if src.is_file() and not (portrait_dst / f"{key}.png").is_file():
|
||||
if src.is_file():
|
||||
shutil.copy2(src, portrait_dst / f"{key}.png")
|
||||
n_portrait += 1
|
||||
counts["portrait"] = n_portrait
|
||||
if missing:
|
||||
sample = ", ".join(missing[:8])
|
||||
more = f" (+{len(missing) - 8} more)" if len(missing) > 8 else ""
|
||||
raise SystemExit(
|
||||
f"missing {len(missing)} wide hero portrait(s) under "
|
||||
f"{HERO_PORTRAITS}: {sample}{more}. "
|
||||
"Run: python web/fetch_hero_portraits.py"
|
||||
)
|
||||
return counts
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user