Skip to content

💃 Free CC0 mannequin pose reference library for AI image tools (Nano Banana, ChatGPT, ComfyUI, Midjourney) — 250+ poses × 5 angles in line art, names in ja/zh/en/ko

feat(tools): content-hash asset URLs and Cloudflare cache headers

wqugurue94a64bc86bf
diff --git a/AGENTS.md b/AGENTS.md
index 2b300108..6f72b14c 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -57,7 +57,8 @@ images/photo/… same two tiers for photo renders
web/ gallery source: index.html template, app.js, app.css, i18n.js, common.js (share sheet, copy,
language links), favicon.svg, changelog.yaml (reader-facing changelog, four languages)
site/ build output of tools/build_site.py (git-ignored; deploy this): home, pose pages and changelog
- per language (zh at the root, ja/ en/ ko/), og/ share cards, sitemap, robots, 404, manifest
+ per language (zh at the root, ja/ en/ ko/), og/ share cards, sitemap, robots, 404, manifest,
+ _headers (Cloudflare cache rules)
build/og-cache/ share-card render cache (git-ignored)
tools/ build_images.py, build_site.py (+ site_pages.py, og_cards.py), verify.py, pack_release.py,
import_series.py, review_sheets.py, line_dups.py, qc_merge.py, rating_check.py, export_csv.py
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 20d87d77..66669ad0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,8 @@ the catalog schema.
「线稿与实拍对照」 section. The grid keeps two modes.
### Changed
+- Repeat visits load faster: scripts and styles are cached for a year under a content-hash `?v=`, images for a
+ week with background revalidation (`site/_headers` for Cloudflare Pages). The hero marquee loads at low priority.
- Images and the project's own data are now CC0 1.0 (`LICENSE-images`); code and docs stay Apache-2.0. Every zip ships
LICENSE, LICENSE-images and NOTICE. README and NOTICE credit the pose list to ai-pose-gallery by ギア (@giaaibusi).
- The README logo and screenshot link to the gallery at shisei.indaloop.app, in the README's language.
diff --git a/tools/build_site.py b/tools/build_site.py
index 32e919a3..c35d0c4c 100755
--- a/tools/build_site.py
+++ b/tools/build_site.py
@@ -13,7 +13,7 @@ Usage: python3 tools/build_site.py [--site URL] [--repo URL] [--link-images] [--
--public the public deploy: the series in PUBLIC_SERIES, line art and photo renders that passed QC; only the files
the catalog lists are copied (DECISIONS D-03, D-06)
"""
-import argparse, datetime, json, os, pathlib, re, shutil, subprocess, sys
+import argparse, datetime, hashlib, json, os, pathlib, re, shutil, subprocess, sys
from html.parser import HTMLParser
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent)) # -I drops the script dir from sys.path
@@ -173,6 +173,32 @@ def check_site(out, site):
return bad
+# Cloudflare Pages response headers. Scripts and styles are referenced as ?v=<content hash>, so a cached copy is
+# never stale and can be kept for a year. Image names stay the same when a view is redrawn, so images get a week
+# plus background revalidation rather than immutable. Pages without a rule keep the Pages default (revalidate).
+HEADERS = """/*.js
+ Cache-Control: public, max-age=31536000, immutable
+/*.css
+ Cache-Control: public, max-age=31536000, immutable
+/images/*
+ Cache-Control: public, max-age=604800, stale-while-revalidate=86400
+/og/*
+ Cache-Control: public, max-age=86400, stale-while-revalidate=86400
+"""
+STAMPED = ("app.css", "app.js", "common.js", "i18n.js")
+
+
+def stamp_assets(out, ver):
+ """Swap the release version in ?v= for each asset's content hash, so an edit between releases busts caches."""
+ for name in STAMPED:
+ digest = hashlib.sha256((out / name).read_bytes()).hexdigest()[:10]
+ pat = re.compile(re.escape(name) + r"\?v=" + re.escape(ver) + r"(?=\")")
+ for f in out.rglob("*.html"):
+ doc = f.read_text()
+ if name in doc:
+ f.write_text(pat.sub(f"{name}?v={digest}", doc))
+
+
def main() -> None:
ap = argparse.ArgumentParser()
ap.add_argument("--site", default=os.environ.get("SHISEI_SITE_URL", DEFAULT_SITE))
@@ -300,6 +326,8 @@ def main() -> None:
"name": "Shisei 姿勢", "short_name": "Shisei", "start_url": "./", "scope": "./", "display": "standalone",
"background_color": "#F5F2ED", "theme_color": "#F5F2ED", "icons": icons}, ensure_ascii=False, indent=1))
(out / ".nojekyll").write_text("") # GitHub Pages: serve files as they are
+ stamp_assets(out, ver)
+ (out / "_headers").write_text(HEADERS)
# sitemap.xml with hreflang alternates and the line art as image entries; robots.txt
cat_day, cl_day = git_day("data/catalog.json"), entries[0]["date"]