Skip to content

中文版 AI 姿势参考图库 · 1439 组 / 2878 张图片 / 完整汉化 · 零依赖静态画廊

chore(cloudflare): 添加 wrangler.jsonc 与 Worker 入口,支持 Cloudflare Workers 部署

Alone884bffc00d08f8
diff --git a/worker.ts b/worker.ts
new file mode 100644
index 0000000..8e1a513
--- /dev/null
+++ b/worker.ts
@@ -0,0 +1,27 @@
+import { onRequestPost } from './functions/api/proxy'
+
+export interface Env {
+ ASSETS: {
+ fetch: (request: Request) => Promise<Response>
+ }
+}
+
+export default {
+ async fetch(request: Request, env: Env): Promise<Response> {
+ const url = new URL(request.url)
+
+ // Handle /api/proxy CORS forwarding for DashScope (Qwen) & Volcengine Ark (Doubao)
+ if (url.pathname === '/api/proxy') {
+ if (request.method === 'POST') {
+ return onRequestPost({ request })
+ }
+ return new Response(JSON.stringify({ error: { message: 'Method Not Allowed' } }), {
+ status: 405,
+ headers: { 'Content-Type': 'application/json; charset=utf-8' },
+ })
+ }
+
+ // Fallback to static assets binding
+ return env.ASSETS.fetch(request)
+ },
+}
diff --git a/wrangler.jsonc b/wrangler.jsonc
new file mode 100644
index 0000000..119874a
--- /dev/null
+++ b/wrangler.jsonc
@@ -0,0 +1,15 @@
+{
+ "$schema": "node_modules/wrangler/config-schema.json",
+ "name": "ai-pose-gallery-zh",
+ "main": "worker.ts",
+ "compatibility_date": "2025-10-01",
+ "observability": {
+ "enabled": true
+ },
+ "assets": {
+ "directory": "./dist",
+ "binding": "ASSETS",
+ "not_found_handling": "single-page-application",
+ "run_worker_first": ["/api/*"]
+ }
+}