12 个视觉参考图库与浏览器无限画布 AI 创作台(5,700+ 素材、中英提示词、多图对比、ComfyUI & MCP)· Visual reference library & infinite-canvas AI studio in the browser
JavaScript ai-artai-try-onchinesecloudflare-pagescomfyuidrawing-referencefashiongeminigpt-imageimage-generationinfinite-canvasmcpmoodboardoutfit-referencepose-referencepromptpwareference-boardseedreamvirtual-try-on
feat: 深度图改走图片自存域名(d/ 前缀)+ Web Analytics 令牌注入支持
atuizzb7616e86350b
diff --git a/build.py b/build.pyindex 20cb82f..cfb6a61 100644--- a/build.py+++ b/build.py@@ -114,6 +114,10 @@ if AHOST:with ProcessPoolExecutor() as ex: list(ex.map(cv,pd)); list(ex.map(cm,cd)); list(ex.map(ca,ad)); list(ex.map(cr,rd))# 深度姿势:只解析素材包里的文本,热链包不复制图片(见 depthpack.py)_dc=depthpack.catalog(); DJ=J(_dc['payload']); DEPTH_ORIGINS=_dc['origins']+if AHOST:+ # 图片自存模式:深度图已全量存入图片域名下的 d/ 前缀(上游 /thumbs/→/d/thumbs/、/img/→/d/img/),+ # 条目地址改走自存,不再热链原站(原站不可用时前端会整批找不到图);署名用的裸域名链接不在替换范围内。+ DJ=DJ.replace('https://ai-pose-depth-gallery.pages.dev/thumbs/',AHOST+'/d/thumbs/').replace('https://ai-pose-depth-gallery.pages.dev/img/',AHOST+'/d/img/')for src,rel in _dc['copies']:dest=f'{D}/{rel}'; os.makedirs(os.path.dirname(dest),exist_ok=True); shutil.copyfile(src,dest)exec(open('post.py').read())diff --git a/post.py b/post.pyindex 01a63a0..41d5d96 100644--- a/post.py+++ b/post.py@@ -1,6 +1,7 @@# v10 构建后处理:哈希资源、静态详情页、SEO 文件、_headers(由 build.py exec)SITE=os.environ.get('POSEWEAR_SITE','https://posewear.pages.dev').rstrip('/') # 部署到自己的域名时改这里AH=os.environ.get('POSEWEAR_ASSET_HOST','').rstrip('/') # 分离部署时缩略图/原图所在站(见 build.py 的 AHOST)+WAT=os.environ.get('POSEWEAR_WA_TOKEN','').strip() # Cloudflare Web Analytics 站点令牌(公开值,随页面下发);设了才注入统计脚本并放行其 CSP 域名def TU(p): return p if p.startswith('http') else (AH+'/'+p if AH else '/'+p) # 缩略图相对引用def TS(p): return p if p.startswith('http') else (AH+'/'+p if AH else SITE+'/'+p) # 缩略图绝对引用(JSON-LD)h8=lambda b:hashlib.sha256(b if isinstance(b,bytes) else b.encode()).hexdigest()[:10]@@ -21,6 +22,7 @@ idx=open('src/index.html').read()for f in ['style.css','app.js','zip.js','extras.js','studio.js']:idx=idx.replace(f'"{f}"',f'"/{A[f]}"')idx=idx.replace('href="poses.json"',f'href="/{A["poses.json"]}"')+if WAT: idx=idx.replace('</body>',f'<script defer src="https://static.cloudflareinsights.com/beacon.min.js" data-cf-beacon=\'{{"token": "{WAT}"}}\'></script></body>')open(f'{D}/index.html','w').write(idx)for f in ['style.css','app.js','zip.js','extras.js','studio.js']:if os.path.exists(f'{D}/{f}'): os.remove(f'{D}/{f}')@@ -81,8 +83,8 @@ open(f'{D}/404.html','w').write(f'''<!doctype html><html lang="zh-CN"><head><met.nf{{max-width:480px;margin:12vh auto;text-align:center;padding:0 20px}}.nf b{{font-size:64px;color:#d81b3a;display:block;line-height:1}}</style></head><body><header><a href="/">{LOGO}衣姿 PoseWear</a></header><div class="nf"><b>404</b><h1>这个页面不存在</h1><p class="mu">链接可能写错了,或者内容已经调整。</p><a class="go" href="/">回到首页</a><a class="go" style="background:#111" href="/#costume">看看服装库</a></div></body></html>''')_IMG=" ".join(["'self'","data:","blob:"]+list(DEPTH_ORIGINS)+([AH] if AH else []))-CSP=("default-src 'self'; script-src 'self' "+SH+"; style-src 'self' 'unsafe-inline'; img-src "+_IMG+"; font-src 'self' data:; "- "connect-src 'self' data: blob: https://api.openai.com https://generativelanguage.googleapis.com https://*.volces.com https://*.bytepluses.com https://oaidalleapiprodscus.blob.core.windows.net https://*.googleusercontent.com; "+CSP=("default-src 'self'; script-src 'self' "+SH+(" https://static.cloudflareinsights.com" if WAT else "")+"; style-src 'self' 'unsafe-inline'; img-src "+_IMG+"; font-src 'self' data:; "+ "connect-src 'self' data: blob: https://api.openai.com https://generativelanguage.googleapis.com https://*.volces.com https://*.bytepluses.com https://oaidalleapiprodscus.blob.core.windows.net https://*.googleusercontent.com"+(" https://cloudflareinsights.com" if WAT else "")+"; ""worker-src 'self'; manifest-src 'self'; media-src 'self' blob:; object-src 'none'; base-uri 'self'; form-action 'self'; frame-ancestors 'none'; upgrade-insecure-requests")IMM=' Cache-Control: public, max-age=31536000, immutable\n'# Pages Functions 必须位于部署目录内才会随 wrangler pages deploy 一起发布(曾因只传静态产物导致 /api/proxy 丢失,见 issue #7)