Fix player sync empty overwrites and force CSS cache refresh.
Keep D1 recent/heroes/peers/rank when OpenDota is partial; bump site to 0.6.55 and shorten style.css cache so「我」layout is not stuck on stale CSS. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
"""Upload web/assets/ui_icons/* to OSS ui-icon/ (no secret echo)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import mimetypes
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import oss2
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
SRC = ROOT / "web" / "assets" / "ui_icons"
|
||||
|
||||
|
||||
def main() -> int:
|
||||
ak = os.environ.get("KEYZOO_ASSET_META_ACCESSKEY_ID") or os.environ.get(
|
||||
"OSS_ACCESS_KEY_ID"
|
||||
)
|
||||
sk = os.environ.get("KEYZOO_ASSET_SECRET_ACCESSKEY_SECRET") or os.environ.get(
|
||||
"OSS_ACCESS_KEY_SECRET"
|
||||
)
|
||||
if not ak or not sk:
|
||||
print("missing OSS credentials", file=sys.stderr)
|
||||
return 2
|
||||
bucket = oss2.Bucket(oss2.Auth(ak, sk), "https://oss-cn-shanghai.aliyuncs.com", "climperor")
|
||||
n = 0
|
||||
for f in sorted(SRC.iterdir()):
|
||||
if not f.is_file() or f.name.startswith("."):
|
||||
continue
|
||||
key = f"ui-icon/{f.name}"
|
||||
ctype = mimetypes.guess_type(f.name)[0] or "application/octet-stream"
|
||||
bucket.put_object_from_file(
|
||||
key,
|
||||
str(f),
|
||||
headers={"Content-Type": ctype, "Cache-Control": "public, max-age=86400"},
|
||||
)
|
||||
n += 1
|
||||
print(f"uploaded {n} ui-icon files", flush=True)
|
||||
for name in ("dota2_logo_wordmark.png", "dota2_logo.png"):
|
||||
print(f" {name} exists={bucket.object_exists('ui-icon/' + name)}", flush=True)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user