Skip to content

12 个视觉参考图库与浏览器无限画布 AI 创作台(5,700+ 素材、中英提示词、多图对比、ComfyUI & MCP)· Visual reference library & infinite-canvas AI studio in the browser

v1.3.1: 回退 v1.3.0 的代理登记门与图片缓存降级,精简生图静默兜底,三语 README 重写并加冒充声明

atuizzd3e0a77544e5
diff --git a/AGENTS.md b/AGENTS.md
index 0783f54..e71bc65 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -25,7 +25,7 @@
| `src/theme.js` | 首屏外观、系统主题与用户选择的同步 |
| `src/history.js` | 生成记录页(数据在浏览器 IndexedDB `lk-studio` 的 `h` 表,上限 200 条) |
| `src/extras.js` | `window.X` 工具(下载、ZIP 等);`src/zip.js` 打包 |
-| `functions/api/proxy.js` | Pages Function:CORS 转发代理(只许本站来源、官方域名限标准 https、自定义 HTTPS 中转按部署变量 POSEWEAR_PROXY_ORIGINS 精确匹配来源和端口) |
+| `functions/api/proxy.js` | Pages Function:CORS 转发代理(只许本站来源、官方域名限标准 https、自定义中转 http/https 任意端口但禁内网地址、只转发必需请求头) |
| `scripts/fetch-assets.py` | 从上游站抓素材到 `assets-raw/`(低并发,勿反复全量抓) |
| `scripts/prep-modules.py` | 新模块(表情/发型等)素材预处理 |
| `scripts/sync-r2.py` | 把图片目录同步到 R2(断点续传,见下) |
@@ -109,7 +109,8 @@ U=http://127.0.0.1:8902 npm test
## 关键机制速记
- **悬浮生图工作台**(app.js 托盘 + studio.js):点击 `#trayFab` 展开工作台,浏览、切换素材库时面板保持打开。收起后,创作条保留已选素材缩略图。面板内「添加素材」经 `WB.openPicker(type, sink)` 复用 studio 的选择器往组合里加;仅在转入完整工作台时由 `WB.setSel` 同步槽位(服装/动画/历代→服装≤2,姿势/深度→姿势≤6,人像→人物≤1。表情≤1,发型、场景、光影、道具和家具归入「其他素材」,均以参考图随生成请求发送);生成走 `WB.quick(opts)` = studio `run()` 的 quick 模式(跳过试穿台 UI、结果回托盘并存入生成记录)。试穿台本体是「完整工作台」,两者共用一套生成核心,不要另起炉灶。
-- 需要代理自定义 HTTPS 服务时,通过部署变量 `POSEWEAR_PROXY_ORIGINS` 登记其完整来源(含端口),多个来源以空格或逗号分隔。服务商配置存 localStorage `wbCfg`;配置只持久化在浏览器。直连时密钥与图片发往所选服务,启用代理时本站 Function 经手并转发请求,不保存请求内容。
+- 代理对自定义中转开放(2026-11-24 维护者定版,勿改回登记制):带 `x-proxy-custom: 1` 的请求可转发到任意公网 http/https 地址与端口,仅禁内网地址与非图片接口路径。服务商配置存 localStorage `wbCfg`;配置只持久化在浏览器。直连时密钥与图片发往所选服务,启用代理时本站 Function 经手并转发请求,不保存请求内容。
+- 图片缓存策略:图库图片路径(/p/ /c/ /a/ /r/ /e/ /y/ /s/ /l/ /t/ /f/ /o/)与 R2 对象一律 `max-age=31536000, immutable`(图片按 ID 寻址、内容不变);只有 HTML 与 sw.js 走 revalidate/no-cache。勿把图片改回 must-revalidate。
- 公告、应用更新和最近操作由 `#noticeMenu` 集中展示。素材来源与许可位于页脚 `#credits`。
- `copyRefs` 默认开启。卡片、灯箱、悬浮及完整工作台复用同一参考图格式。保留选定的 `angles` 视角和原站热链,本地上传图在复制文本中提示用户另附。
- localStorage 键:`wbCfg`、`wbSel`(试穿台选材)、`sel`(组合)、`fav`、`theme`、`lang` 等,改名即丢用户数据,慎改。
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 88bd565..0e292c9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,13 @@
## 简体中文
+### 2026-11-24 · v1.3.1
+
+- 官方声明:官网只有 posewear.pages.dev,没有 Windows / Android 客户端,也不提供 exe、apk 下载;posewear.cn 等站点均为冒充。声明已同步到三语 README 与站内通知区。
+- 修复 v1.3.0 的两处回退:本站代理恢复转发任意公网自定义中转(http/https、任意端口,内网地址除外),不再要求部署者逐个登记;图库图片恢复一年期 immutable 缓存,不再每次访问都重新验证。
+- 生图请求失败不再静默降级:移除了「自动换接口协议重试」「自动丢掉参考图重试」等多层兜底,只保留图片字段名的一种已知兼容重试,其余错误直接报出。
+- 清理失效的三语词条、已下线 UI 的残留样式与过时文案;三语 README 重写。
+
### 2026-11-24 · v1.3.0
- 在姿势卡片上点编号,可在同一机位的线稿和深度图之间翻面。复制单条或组合提示词会附上所选角度的参考图链接。
@@ -58,6 +65,12 @@
## English
+### 2026-11-24 · v1.3.1
+
+- Fixes two v1.3.0 regressions: the site proxy again forwards to any public custom relay (http/https, any port, private addresses excluded) instead of requiring per-endpoint registration, and gallery images are back to one-year immutable caching instead of revalidating on every visit.
+- Generation failures no longer degrade silently: the layered fallbacks that switched API protocols or dropped reference images are gone. One known compatibility retry (the alternate image field name) remains; everything else surfaces as an error.
+- Removed stale trilingual dictionary entries, dead styles from retired UI, and outdated copy; rewrote the three READMEs.
+
### 2026-11-24 · v1.3.0
- Click a pose card’s ID to flip between its line drawing and depth map at the same camera angle. Copying a single or mixed prompt includes image links for the selected views.
@@ -110,6 +123,12 @@
## 日本語
+### 2026-11-24 · v1.3.1
+
+- v1.3.0 の2つの後退を修正:サイトプロキシは、デプロイ担当者による個別登録を必要とせず、任意の公開カスタム中継(http/https・任意ポート、プライベートアドレス除く)へ再び転送します。ギャラリー画像も、毎回再検証する方式から1年間の immutable キャッシュに戻しました。
+- 生成失敗時のサイレントな縮退を廃止:「API 方式を自動で切り替えて再試行」「参照画像を落として再試行」といった多段フォールバックを削除しました。残るのは画像フィールド名の既知の互換リトライのみで、それ以外はエラーとして表示します。
+- 古くなった三言語辞書の項目、廃止した UI の残留スタイル、古い文案を整理し、3言語の README を書き直しました。
+
### 2026-11-24 · v1.3.0
- ポーズカードの番号を押すと、同じアングルの線画と深度画像を切り替えられます。単体または組み合わせたプロンプトをコピーすると、選んだアングルの参考画像リンクも付きます。
diff --git a/README.en.md b/README.en.md
index ae8faaa..27f318b 100644
--- a/README.en.md
+++ b/README.en.md
@@ -1,69 +1,81 @@
+<div align="center">
+
# PoseWear
-[简体中文](README.md) · [English](README.en.md) · [日本語](README.ja.md)
+A place to find reference images for drawing, photography, and AI generation.
-Find visual references for drawing, photography and AI try-on. Pick a pose, flip it to the matching depth view and pair it with a portrait or outfit. Copy the prompt and image links into an agent, or generate an image in the studio.
+Twelve libraries — poses, outfits, portraits, expressions, and more — each with Chinese and English prompts.
+Pick your references and generate right in the browser, or hand the set to your AI agent.
-[Open the gallery](https://posewear.pages.dev/) · [Run locally](#run-locally) · [Connect an agent](mcp/README.md) · [Release notes](CHANGELOG.md#en)
+[Live site](https://posewear.pages.dev/) · [简体中文](README.md) · [日本語](README.ja.md) · [Changelog](CHANGELOG.md)
-![Outfit filters and reference cards in PoseWear](docs/home-en.jpg)
+> **Beware of impostors**: the only official site is [posewear.pages.dev](https://posewear.pages.dev/). There is no Windows or Android app, and we never offer exe or apk downloads. Sites such as posewear.cn are impostors — never enter your API key there.
-## Run locally
+![Outfit library](docs/home-en.jpg)
-Use Node.js 22.12 or later. The preview fetches the 12 public catalogs on first visit and loads images as you browse. If you downloaded the source ZIP, open the extracted project directory and start at `npm ci`.
+</div>
-```sh
-git clone https://github.com/atuizz/posewear.git
-cd posewear
-npm ci
-npm start
-```
+## Finding references
-Open the [local gallery](http://127.0.0.1:8787/). Browsing, saving favorites and copying references all work without an account or API key.
+- **Poses come in pairs**: every pose has a line sketch and a depth map from the same camera angle. Flip between them on the card, or send both to generation together.
+- **A floating workspace collects as you browse**: tap + on any card to drop it into the tray at the bottom. Generate from the tray, or copy the whole set — prompts plus public image links.
+- **The full studio mixes freely**: a person, an outfit, poses, plus expressions, hair, scenes, lighting, props, and furniture. Use as many or as few as you like — a prompt alone works too. Upload your own photo to try outfits on.
+- Everything you generate is kept under History, ready to view, download, or export as ZIP.
-## From reference to image
+![Studio](docs/studio-en.jpg)
-| Where | What you can do |
-| --- | --- |
-| Gallery | Pick a camera angle at the foot of a pose card. Click the ID in the top left to flip to the corresponding depth map and back. Both sides of the same pose and angle can guide one generation. |
-| Floating studio | Use the plus on a card to collect references. Keep the studio open as you browse or switch collections. Copying a single or combined prompt includes public image links for your selected views by default. Attach any locally uploaded photos separately when sharing. |
-| Full studio | Pick any combination of person, outfit and pose. Open **Other references** for expressions, hairstyles, scenes, lighting, props or furniture. Use a single prop, start with text alone, or upload your photo for a before-and-after try-on. The studio remembers your edited prompt, image count and aspect ratio. |
-| Generation history | Revisit a result, download it or export the images, prompts and settings as a ZIP. Each browser keeps up to 200 records. |
+<table><tr>
+<td width="30%"><img src="docs/mobile-en.jpg" alt="Browsing on a phone"><br><sub>Works on your phone, too</sub></td>
+<td><img src="docs/dark-en.jpg" alt="Dark mode"><br><sub>Dark mode, follows your system by default</sub></td>
+</tr></table>
+
+The interface speaks English, Chinese, and Japanese; reference descriptions switch between Chinese and English.
+
+## Three ways to generate
-![Reference selection, board and generation controls in the studio](docs/studio-en.jpg)
+**Your own API key** — Use OpenAI, Gemini, or Seedream keys, or any endpoint compatible with the OpenAI, Gemini, or xAI image protocols. Requests go straight from your browser, or through the site proxy (relays may use http/https and any port).
-[See a try-on made from a portrait, outfit and pose](docs/banner.jpg)
+**A model on your machine** — If you run ComfyUI or stable-diffusion.cpp, connect the local engine and generate without images leaving your computer. [Setup guide](docs/local-engines.md)
-The collection menu groups all 12 libraries into **Movement**, **People**, **Wardrobe** and **Setting**. You can pick references on mobile, too. The globe menu controls the interface language (Chinese, English or Japanese), description language (Chinese or English) and whether to include reference links when copying. Appearance follows your system by default. Choose light or dark mode in the header, and open the bell for updates and recent actions.
+**Your AI agent** — The repo ships an MCP server so an agent can search references, fetch a specific angle, and assemble prompts with image links:
-<table><tr><td width="28%" valign="top"><img src="docs/mobile-en.jpg" alt="PoseWear on a phone" width="100%"></td><td valign="top"><img src="docs/dark-en.jpg" alt="PoseWear in dark mode" width="100%"></td></tr></table>
+```sh
+codex mcp add posewear -- node "$PWD/mcp/server.mjs"
+```
+
+Then just ask: “Find a side-view sitting pose with a spring outfit — give me the prompt and reference links.” [MCP guide](mcp/README.md)
-## Choose how to generate
+## Run it locally
-- **Cloud provider.** Enter your API key in the studio's provider settings. Use OpenAI, Gemini, Seedream or an HTTPS service compatible with the OpenAI, Gemini or xAI image protocol. Direct requests send the key, prompt and images to your provider. Enabling the proxy routes the same request through a Pages Function. Your provider sets pricing and quotas.
-- **Local model.** Start ComfyUI, select it in the local studio, test the connection and choose an installed checkpoint. The built-in workflow takes one reference image. Supply your own workflow for multiple images, or start the preview with `POSEWEAR_LOCAL_ENGINE=sd-cpp npm start` to connect a stable-diffusion.cpp `sd-server`. [Local engine setup (Chinese)](docs/local-engines.md)
-- **Agent.** From the repository root, run `codex mcp add posewear -- node "$PWD/mcp/server.mjs"` and start a new Codex session. Try “Find a side view of a seated pose, pair it with a spring outfit, and give me the prompt and both image links.” For another stdio client, use `node` as the command and the absolute path to `mcp/server.mjs` as its argument. [MCP configuration and tool examples (Chinese)](mcp/README.md) · [Reference selection skill](.agents/skills/posewear/SKILL.md)
+Requires Node.js 22.12+:
+
+```sh
+git clone https://github.com/atuizz/posewear.git
+cd posewear
+npm ci
+npm start
+```
-Favorites, studio drafts and API keys live in your browser's localStorage. Generated images and their settings live in IndexedDB. Clearing the site's browser data removes both.
+Open http://127.0.0.1:8787/ . Browsing, favorites, and copying need no account or key. Catalogs load from the public site on first open; images load on demand.
-## Development and tests
+Favorites, settings, and API keys live only in your browser; generation history lives in the browser database. Clearing site data removes them.
-The frontend uses plain JS, HTML and CSS. Python builds the static site. A Cloudflare Pages Function serves as an optional generation proxy. Use `npm start` to develop the interface. A full build from the original assets also requires Python 3.9+, Pillow, the source images and the extension archives.
+## Development
-Install the test browser with `npx playwright install chromium`, then run `npm run test:offline` for the fixture-based checks. For the full regression suite, start the staged Pages server as described in the handbook and run `U=http://127.0.0.1:8902 npm test` in the repository root. The browser tests mock image generation. [Asset preparation, builds and testing (Chinese)](AGENTS.md)
+Vanilla JS, a Python build, and Cloudflare Pages — no framework. Build, assets, tests, and deployment are documented in [AGENTS.md](AGENTS.md); `npm test` runs the regression suite.
-**v1.3.0 (2026-11-24)** Flip between matched line and depth views, keep selecting references in the open studio, and generate from a single material or just a prompt. This update also adds copyable reference links, three UI languages, local engines and MCP support. [Release notes](https://github.com/atuizz/posewear/releases/tag/v1.3.0) · [Changelog](CHANGELOG.md#en)
+Current release **v1.3.1** (2026-11-24): restores proxy forwarding for custom relays and long-term image caching. [All releases](CHANGELOG.md)
-## License and credits
+## Sources and licenses
-The code, UI copy and build scripts are available under the [MIT License](LICENSE). Each reference image, including images visible in the screenshots, retains its source terms. Keep source and author credits on self-hosted copies.
+Code, UI text, and build scripts are [MIT](LICENSE). Images belong to their sources — keep the credits if you self-host:
-| Material | Source and terms |
+| Material | Source |
| --- | --- |
-| Poses, depth maps, outfits and anime outfits | By ギア / @giaaibusi. Contact the author about commercial use, reposting or redistribution. The repository includes Japanese depth metadata and PoseWear's Chinese names. Images are served by the asset CDN. [Line art](https://ai-pose-gallery.pages.dev/) · [Depth](https://ai-pose-depth-gallery.pages.dev/) · [Outfits](https://ai-costume-gallery.pages.dev/) · [Anime outfits](https://ai-costume-anime-gallery.pages.dev/) |
-| Portraits | Fictional AI portraits by @agi_aibusi, released under CC0. The author asks users to avoid bulk reposting the originals. [AI Portrait Gallery](https://ai-portrait-gallery.pages.dev/) |
-| Hairstyles and selected anime outfits | たき AI / CharaDB. Tags are CC0. Images belong to the author and are loaded directly from the original host. [CharaDB](https://charadb-2fi.pages.dev/) |
-| Expressions | WaveSpeed AI Emotion Gallery, using ICT Face Model Light (© USC Institute for Creative Technologies, MIT). |
-| Historical dress, scenes, lighting, props and furniture | Shisei / wquguru, CC0 1.0. |
+| Poses, depth poses, outfits, anime outfits | ギア / @giaaibusi — ask the author before commercial use or redistribution. [Sketches](https://ai-pose-gallery.pages.dev/) · [Depth](https://ai-pose-depth-gallery.pages.dev/) · [Outfits](https://ai-costume-gallery.pages.dev/) · [Anime outfits](https://ai-costume-anime-gallery.pages.dev/) |
+| Portraits | Fictional AI portraits by @agi_aibusi, CC0; the author asks that they not be reposted in bulk unchanged. [AI Portrait Gallery](https://ai-portrait-gallery.pages.dev/) |
+| Hair and some anime outfits | たき AI / CharaDB, tags CC0, images load from the source site. [CharaDB](https://charadb-2fi.pages.dev/) |
+| Expressions | WaveSpeed AI Emotion Gallery; head model ICT FaceKit (© USC Institute for Creative Technologies, MIT) |
+| Historical dress, scenes, lighting, props, furniture | Shisei / wquguru, CC0 1.0 |
-Thanks to two open-source projects that inspired this work. [gen-ai-pose-image](https://github.com/wzc520pyfm/gen-ai-pose-image) · [nvzhuang](https://github.com/paipiange/nvzhuang)
+Inspired by [gen-ai-pose-image](https://github.com/wzc520pyfm/gen-ai-pose-image) and [nvzhuang](https://github.com/paipiange/nvzhuang) — thank you.
diff --git a/README.ja.md b/README.ja.md
index 85f8c96..8b80dc9 100644
--- a/README.ja.md
+++ b/README.ja.md
@@ -1,69 +1,81 @@
+<div align="center">
+
# 衣姿 PoseWear
-[简体中文](README.md) · [English](README.en.md) · [日本語](README.ja.md)
+絵を描くとき、写真を撮るとき、AI で画像を作るときの参考素材を探す場所。
-作画、撮影、AI 試着のための参考画像を探せるギャラリーです。ポーズを選んで同じアングルの深度画像に切り替え、人物や衣装と組み合わせます。プロンプトと画像リンクをエージェントに渡したり、そのままスタジオで画像を生成したりできます。
+ポーズ・衣装・人物・表情など 12 の素材集に、中英プロンプト付き。
+素材を選べばそのままブラウザで生成でき、組み合わせを AI エージェントに渡すこともできます。
-[ギャラリーを開く](https://posewear.pages.dev/) · [ローカルで起動](#ローカルで起動) · [エージェントと接続](mcp/README.md) · [更新履歴](CHANGELOG.md#ja)
+[オンライン版](https://posewear.pages.dev/) · [简体中文](README.md) · [English](README.en.md) · [更新履歴](CHANGELOG.md)
-![衣装ライブラリの絞り込みとコーディネートの参考画像](docs/home-ja.jpg)
+> **偽サイトにご注意**:公式サイトは [posewear.pages.dev](https://posewear.pages.dev/) のみです。Windows / Android アプリはなく、exe や apk のダウンロードも提供していません。posewear.cn などは偽サイトです。API キーを入力しないでください。
-## ローカルで起動
+![衣装ライブラリ](docs/home-ja.jpg)
-Node.js 22.12 以降を使用します。プレビューの初回アクセス時に公開カタログ 12 件を取得し、画像は閲覧に合わせて読み込みます。ソースの ZIP を入手した場合は、展開したプロジェクトのディレクトリで `npm ci` から実行してください。
+</div>
-```sh
-git clone https://github.com/atuizz/posewear.git
-cd posewear
-npm ci
-npm start
-```
+## 素材の探し方
-[ローカルのギャラリー](http://127.0.0.1:8787/)を開きます。閲覧、お気に入り登録、参考画像リンクのコピーにはアカウントも API キーも不要です。
+- **ポーズは線画と深度画像のペア**:同じポーズ・同じアングルの両面がそろっています。カードの番号を押すと裏返り、両方を生成に使うこともできます。
+- **フローティング作業台で集める**:閲覧しながらカードの + を押すだけで下部の作業台に入ります。そこから生成したり、プロンプトと画像リンクをまとめてコピーしたりできます。
+- **本格スタジオでは自由に組み合わせ**:人物・衣装・ポーズに、表情・髪型・背景・照明・小道具・家具を加えて。使う素材は1つでも、プロンプトだけでも大丈夫です。自分の写真をアップロードすれば試着の比較もできます。
+- 生成した画像は「生成履歴」に保存され、表示・ダウンロード・ZIP 書き出しができます。
-## 素材を選んで画像を作る
+![スタジオ](docs/studio-ja.jpg)
-| 場所 | できること |
-| --- | --- |
-| 素材ライブラリ | ポーズカードの下部でアングルを選択。左上の番号を押すと、同じアングルの線画と深度画像を切り替えられます。同じポーズ・アングルの両方を生成時に使えます。 |
-| フローティングスタジオ | カードの「+」で素材を追加します。スタジオを開いたまま別の素材やライブラリを選べます。単体・組み合わせのどちらも、プロンプトをコピーすると選択したアングルの画像 URL が付きます。アップロードした手元の写真は別途添付してください。 |
-| スタジオ | 人物・衣装・ポーズを自由に組み合わせられます。表情、髪型、背景、照明、小物、家具は「その他の素材」から選択。小物一つ、あるいは文章だけでも生成できます。編集したプロンプト、枚数、縦横比は次回も引き継がれます。試着では、自分の写真と生成結果を見比べられます。 |
-| 生成履歴 | 結果を見直して保存したり、画像・プロンプト・設定をまとめて ZIP で書き出したりできます。保存件数はブラウザーごとに最大 200 件です。 |
+<table><tr>
+<td width="30%"><img src="docs/mobile-ja.jpg" alt="スマートフォンでの閲覧"><br><sub>スマホでも素材探し</sub></td>
+<td><img src="docs/dark-ja.jpg" alt="ダークモード"><br><sub>ダークモード(初期設定はシステム連動)</sub></td>
+</tr></table>
+
+画面は日本語・中国語・英語の3言語対応。素材の説明は中国語と英語を切り替えられます。
+
+## 生成方法は3つから
-![スタジオの素材選択、ボードと生成設定](docs/studio-ja.jpg)
+**自分の API キーで** — OpenAI、Gemini、豆包 Seedream のキー、または OpenAI / Gemini / xAI 互換の中継サービスを設定します。ブラウザから直接送るか、このサイトのプロキシ経由(http/https・任意ポート対応)で送れます。
-[人物・衣装・ポーズを組み合わせた試着例](docs/banner.jpg)
+**この端末のモデルで** — ComfyUI や stable-diffusion.cpp を動かしているなら、ローカルエンジンに接続して生成できます。画像が端末の外に出ることはありません。[設定ガイド](docs/local-engines.md)
-素材メニューでは 12 のライブラリを「動作」「人物・髪型」「衣類」「空間・小物」の四つに分類しています。スマートフォンからも素材を選べます。地球のアイコンから表示言語(中・英・日)、素材の説明言語(中・英)、コピー時の画像リンクの有無を設定できます。外観は初期設定でシステムに合わせます。ヘッダーではライト・ダークを指定でき、ベルから更新や直近の操作を確認できます。
+**AI エージェントに任せる** — リポジトリには MCP サーバーが入っていて、エージェントが素材検索、角度指定の取得、プロンプトと参照リンクの組み立てを自分で行えます:
-<table><tr><td width="28%" valign="top"><img src="docs/mobile-ja.jpg" alt="スマートフォンでの表示" width="100%"></td><td valign="top"><img src="docs/dark-ja.jpg" alt="ダークモードの PoseWear" width="100%"></td></tr></table>
+```sh
+codex mcp add posewear -- node "$PWD/mcp/server.mjs"
+```
+
+あとは「横向きの座りポーズに春服を合わせて、プロンプトと参考リンクをちょうだい」と頼むだけです。[MCP ガイド](mcp/README.md)
-## 生成方法を選ぶ
+## ローカルで動かす
-- **クラウドサービス。** スタジオのプロバイダー設定に自身の API キーを入力します。OpenAI、Gemini、Seedream のほか、OpenAI・Gemini・xAI の画像 API と互換性のある HTTPS サービスを利用できます。直接接続ではキー、プロンプト、画像が選択したサービスに送られます。プロキシを有効にすると Pages Function が同じ内容を転送します。料金と利用上限は各サービスの規定に従います。
-- **ローカルモデル。** ComfyUI を起動してローカルのスタジオで選択し、接続テスト後にインストール済みのチェックポイントを指定します。付属ワークフローは参考画像 1 枚に対応します。複数枚には独自のワークフローを使用できます。stable-diffusion.cpp の `sd-server` を使う場合は `POSEWEAR_LOCAL_ENGINE=sd-cpp npm start` でプレビューを起動します。[ローカルエンジンの設定(中国語)](docs/local-engines.md)
-- **エージェント。** リポジトリのルートで `codex mcp add posewear -- node "$PWD/mcp/server.mjs"` を実行して、新しい Codex セッションを開きます。例えば「横から見た座りポーズと春服を探して、プロンプトと参考画像 2 枚のリンクをください」と依頼できます。ほかの stdio クライアントでは、コマンドに `node`、引数に `mcp/server.mjs` の絶対パスを指定します。[MCP の設定とツール例(中国語)](mcp/README.md) · [素材選択の Skill](.agents/skills/posewear/SKILL.md)
+Node.js 22.12 以上が必要です:
+
+```sh
+git clone https://github.com/atuizz/posewear.git
+cd posewear
+npm ci
+npm start
+```
-お気に入り、スタジオの下書き、API キーはブラウザーの localStorage、生成履歴は IndexedDB に保存されます。サイトのブラウザーデータを消去すると、これらの内容も削除されます。
+http://127.0.0.1:8787/ を開いてください。閲覧・お気に入り・コピーにアカウントやキーは不要です。素材目録は初回にオンラインから読み込み、画像は必要なときに読み込みます。
-## 開発とテスト
+お気に入り・設定・API キーはお使いのブラウザ内にだけ保存され、生成履歴もブラウザのデータベースに保存されます。サイトデータを消せば一緒に消えます。
-フロントエンドは素の JS、HTML、CSS で、Python が静的サイトをビルドします。生成用のプロキシには Cloudflare Pages Function を使えます。画面の開発には `npm start` を使用します。原画からの完全なビルドには Python 3.9 以降、Pillow、元画像、拡張素材アーカイブが必要です。
+## 開発
-`npx playwright install chromium` でテスト用ブラウザーをインストールし、`npm run test:offline` でフィクスチャを使うテストを実行できます。全回帰テストを実行する場合は、開発手順に従ってステージングの Pages サーバーを起動し、リポジトリのルートで `U=http://127.0.0.1:8902 npm test` を実行します。ブラウザーテストは画像生成サービスの応答を模擬します。[素材準備、ビルドとテスト手順(中国語)](AGENTS.md)
+素の JS と Python ビルド、Cloudflare Pages のみで、フレームワークは使っていません。ビルド・素材準備・テスト・デプロイの手順は [AGENTS.md](AGENTS.md) にまとめています。回帰テストは `npm test` です。
-**v1.3.0(2026-11-24)** 対応する線画と深度画像の切り替え、スタジオを開いたままの素材選択、素材単体またはプロンプトだけでの生成に対応しました。参考画像リンク付きコピー、3 言語の UI、ローカルエンジン、MCP も利用できます。[リリースノート](https://github.com/atuizz/posewear/releases/tag/v1.3.0) · [更新履歴](CHANGELOG.md#ja)
+現在のバージョンは **v1.3.1**(2026-11-24):カスタム中継へのプロキシ転送と、画像の長期キャッシュを復旧しました。[全バージョン履歴](CHANGELOG.md)
-## ライセンスと謝辞
+## 素材の出典とライセンス
-コード、画面の文言、ビルドスクリプトには [MIT ライセンス](LICENSE) が適用されます。スクリーンショット内の画像を含め、素材にはそれぞれの提供元の利用条件が適用されます。セルフホストの際は出典と作者名を残してください。
+コード・画面文案・ビルドスクリプトは [MIT](LICENSE) です。画像の権利は各出典に帰属します。自前で公開する場合は出典表示を残してください:
-| 素材 | 出典と利用条件 |
+| 素材 | 出典 |
| --- | --- |
-| ポーズ、深度画像、衣装、アニメ衣装 | ギア / @giaaibusi。商用利用、転載、再配布については作者にご確認ください。リポジトリには深度画像の日本語メタデータと本サイトの中国語訳を収録し、画像は素材 CDN から配信しています。[線画](https://ai-pose-gallery.pages.dev/) · [深度画像](https://ai-pose-depth-gallery.pages.dev/) · [衣装](https://ai-costume-gallery.pages.dev/) · [アニメ衣装](https://ai-costume-anime-gallery.pages.dev/) |
-| 人物 | @agi_aibusi による架空の AI ポートレート、CC0。作者は原画の一括転載を控えるよう希望しています。[AI Portrait Gallery](https://ai-portrait-gallery.pages.dev/) |
-| 髪型・一部のアニメ衣装 | たき AI / CharaDB。タグは CC0。画像の権利は作者に帰属し、提供元から直接読み込みます。[CharaDB](https://charadb-2fi.pages.dev/) |
-| 表情 | WaveSpeed AI Emotion Gallery。ICT Face Model Light を使用(© USC Institute for Creative Technologies、MIT)。 |
-| 歴代衣装、背景、照明、小物、家具 | Shisei / wquguru、CC0 1.0。 |
+| ポーズ、深度ポーズ、衣装、アニメ衣装 | ギア / @giaaibusi。商用・転載は作者に確認してください。[線画](https://ai-pose-gallery.pages.dev/) · [深度](https://ai-pose-depth-gallery.pages.dev/) · [衣装](https://ai-costume-gallery.pages.dev/) · [アニメ衣装](https://ai-costume-anime-gallery.pages.dev/) |
+| 人物 | @agi_aibusi の架空 AI 人物、CC0。作者はそのままの一括転載を控えるよう求めています。[AI Portrait Gallery](https://ai-portrait-gallery.pages.dev/) |
+| 髪型と一部のアニメ衣装 | たき AI / CharaDB。タグは CC0、画像は元サイトから読み込みます。[CharaDB](https://charadb-2fi.pages.dev/) |
+| 表情 | WaveSpeed AI Emotion Gallery。頭部モデルは ICT FaceKit(© USC Institute for Creative Technologies、MIT) |
+| 時代衣装、背景、照明、小道具、家具 | Shisei / wquguru、CC0 1.0 |
-着想をいただいた二つのオープンソースプロジェクトに感謝します。[gen-ai-pose-image](https://github.com/wzc520pyfm/gen-ai-pose-image) · [nvzhuang](https://github.com/paipiange/nvzhuang)
+インスピレーションをくれた [gen-ai-pose-image](https://github.com/wzc520pyfm/gen-ai-pose-image) と [nvzhuang](https://github.com/paipiange/nvzhuang) に感謝します。
diff --git a/README.md b/README.md
index 889f167..480b73e 100644
--- a/README.md
+++ b/README.md
@@ -1,69 +1,81 @@
+<div align="center">
+
# 衣姿 PoseWear
-[简体中文](README.md) · [English](README.en.md) · [日本語](README.ja.md)
+给绘画、摄影和 AI 生图挑参考图的地方。
-给绘画、摄影和 AI 试穿挑参考图。从一个动作开始,翻到同机位的深度图,搭配人物与服装,再把提示词和参考图链接一起交给智能体,或直接在工作台生成图片。
+姿势、服装、人像、表情等 12 个图库,配中英文提示词;
+选好素材就能在站内拼图生图,也可以把组合交给你的 AI 智能体。
-[打开在线图库](https://posewear.pages.dev/) · [本地启动](#本地启动) · [接入智能体](mcp/README.md) · [版本记录](CHANGELOG.md#zh)
+[在线图库](https://posewear.pages.dev/) · [English](README.en.md) · [日本語](README.ja.md) · [更新日志](CHANGELOG.md)
-![服装库的分类筛选与穿搭参考图](docs/home.jpg)
+> **谨防冒充**:官网只有 [posewear.pages.dev](https://posewear.pages.dev/),没有 Windows / Android 客户端,也不提供 exe、apk 下载。posewear.cn 等站点均为冒充,请勿在其中填写 API Key。
-## 本地启动
+![服装库](docs/home.jpg)
-需要 Node.js 22.12 或以上版本。首次访问会联网载入 12 份公开素材目录,图片按需加载。已下载源码 ZIP 时,进入解压后的项目目录,从 `npm ci` 开始。
+</div>
-```sh
-git clone https://github.com/atuizz/posewear.git
-cd posewear
-npm ci
-npm start
-```
+## 挑图
-打开[本地图库](http://127.0.0.1:8787/)。浏览、收藏和复制参考图均无需账号或 API 密钥。
+- **姿势和深度图是成对的**:同一动作、同一机位,一面线稿一面深度图,在卡片上点编号就能翻面,两面可以一起拿去生图。
+- **悬浮工作台随手攒素材**:浏览时点卡片上的 + 就收进底部工作台,不用离开图库;攒够了直接生图,或者把整组提示词和图片直链复制走。
+- **完整工作台自由拼**:人物、服装、姿势,加上表情、发型、场景、光影、道具、家具,想用几样用几样,只写提示词也行。上传自己的照片可以试穿对比。
+- 生成过的图都存在「生成记录」里,能回看、下载、打包。
-## 从选图到出图
+![工作台](docs/studio.jpg)
-| 在哪里 | 可以做什么 |
-| --- | --- |
-| 素材库 | 在姿势卡片底部选择机位,点左上角编号可翻到对应深度图,再点一次回到线稿。同一动作、同一角度的两面可一起用于生成。 |
-| 悬浮工作台 | 点卡片上的加号收集素材。展开底部创作条后也能继续浏览和换库。复制单条或组合提示词时,默认附上所选视角的公开图片直链;转发时请另附本地上传的照片。 |
-| 完整工作台 | 人物、服装、姿势可以自由组合;表情、发型、场景、光影、道具和家具集中在「其他素材」。可以只用一个道具,也可以只写提示词。工作台会记住手改的提示词、张数和比例。试穿时可上传自己的照片对比成品。 |
-| 我的 → 生成记录 | 查看成品、下载图片,或将图片、提示词与参数打成 ZIP。当前浏览器最多保存 200 条记录。 |
+<table><tr>
+<td width="30%"><img src="docs/mobile.jpg" alt="手机上浏览"><br><sub>手机上也能选图</sub></td>
+<td><img src="docs/dark.jpg" alt="深色模式"><br><sub>深色模式,默认跟随系统</sub></td>
+</tr></table>
+
+界面有中文、英文、日文三语,素材描述可在中英文之间切换。
+
+## 生图走哪条路,随你
-![工作台里的素材、画板与生成设置](docs/studio.jpg)
+**用自己的 API Key** — 在工作台里填 OpenAI、Gemini、豆包 Seedream 的密钥,或任何兼容 OpenAI / Gemini / xAI 协议的中转。浏览器直连,或经本站代理转发(中转支持 http/https 和任意端口)。
-[查看人物、服装和姿势组合后的试穿示例](docs/banner.jpg)
+**用本机模型** — 装了 ComfyUI 或 stable-diffusion.cpp 的话,连本机引擎生图,图片不出这台电脑。[配置说明](docs/local-engines.md)
-图库将 12 个库按姿态、人物造型、服饰、环境与物件归为四组。手机也可直接选图。地球图标可分别设置界面语言(中、英、日)与素材描述语言(中、英),以及复制时是否附图链。外观默认跟随系统,可在页头切换浅色或深色;铃铛集中显示更新和操作提示。
+**交给智能体** — 仓库带一个 MCP 服务,智能体能自己搜素材、按角度取图、拼好提示词和参考图链接:
-<table><tr><td width="28%" valign="top"><img src="docs/mobile.jpg" alt="手机上的 PoseWear" width="100%"></td><td valign="top"><img src="docs/dark.jpg" alt="深色模式下的 PoseWear" width="100%"></td></tr></table>
+```sh
+codex mcp add posewear -- node "$PWD/mcp/server.mjs"
+```
+
+然后直接跟它说:「找一个侧面的坐姿,配一套春装,给我提示词和参考图。」[MCP 说明](mcp/README.md)
-## 选择生成方式
+## 本地跑起来
-- **云端服务。** 在工作台的服务商设置中填写自己的密钥。支持 OpenAI、Gemini、豆包 Seedream 及兼容 OpenAI、Gemini、xAI 图片协议的 HTTPS 服务。直连会将密钥、提示词和图片送往所选服务;启用代理时由本站 Pages Function 转发。费用和配额由服务商决定。
-- **本机模型。** 启动 ComfyUI,在本地工作台选择「ComfyUI」,测试连接并选取已安装的 checkpoint。内置工作流接受一张参考图;多图可以接入自定义工作流。使用 stable-diffusion.cpp 的 `sd-server` 时,以 `POSEWEAR_LOCAL_ENGINE=sd-cpp npm start` 启动预览。[本机引擎配置](docs/local-engines.md)
-- **交给智能体。** 在仓库根目录运行 `codex mcp add posewear -- node "$PWD/mcp/server.mjs"`,新开会话即可让智能体搜索素材、按角度取图和组合提示词。例如「找一个侧面的坐姿,配一套春装,给我提示词和两张参考图的链接」。其他 stdio 客户端可用 `node` 启动仓库中的 `mcp/server.mjs`(填写绝对路径)。[MCP 设置与示例](mcp/README.md) · [选图 Skill](.agents/skills/posewear/SKILL.md)
+需要 Node.js 22.12+:
+
+```sh
+git clone https://github.com/atuizz/posewear.git
+cd posewear
+npm ci
+npm start
+```
-收藏、工作台草稿与 API 密钥保存在当前浏览器的 localStorage,生成记录保存在 IndexedDB。清除站点数据会一并删除这些内容。
+打开 http://127.0.0.1:8787/ 。浏览、收藏、复制都不需要账号和密钥;素材目录首次打开时联网载入,图片按需加载。
-## 开发与测试
+收藏、设置和 API Key 只存在你自己的浏览器里,生成记录存在浏览器数据库里,清站点数据即删。
-界面使用原生 JS、HTML 和 CSS,Python 负责构建静态站,Cloudflare Pages Function 提供可选的生成代理。开发界面直接使用 `npm start`。从原图构建完整站点还需要 Python 3.9+、Pillow、原始素材及扩展库档案。
+## 开发
-运行 `npx playwright install chromium` 安装测试浏览器。运行 `npm run test:offline` 可用本地测试素材执行回归。完整测试需按开发手册启动 staging 服务,再在仓库根目录执行 `U=http://127.0.0.1:8902 npm test`。浏览器回归使用模拟的生图服务响应。[构建、素材准备与测试步骤](AGENTS.md)
+原生 JS + Python 构建 + Cloudflare Pages,没有框架。构建、素材准备、测试和部署流程都在 [AGENTS.md](AGENTS.md) 里,`npm test` 跑回归。
-**v1.3.0(2026-11-24)** 姿势与深度图可在原位翻面,悬浮工作台支持连续选材,完整工作台支持单素材与纯提示词生图。新增携图复制、三语界面、本机引擎与 MCP。[发布说明](https://github.com/atuizz/posewear/releases/tag/v1.3.0) · [历史版本](CHANGELOG.md#zh)
+当前版本 **v1.3.1**(2026-11-24):修复本站代理对自定义中转的转发,并恢复图片长期缓存。[全部版本记录](CHANGELOG.md)
-## 许可与致谢
+## 素材来源与许可
-代码、界面文案和构建脚本采用 [MIT](LICENSE)。素材及截图中的图片各有其来源与使用条件。自建站请保留来源与作者说明。
+代码、界面文案和构建脚本是 [MIT](LICENSE)。图片各有出处,自建站请保留来源说明:
-| 素材 | 来源与使用条件 |
+| 素材 | 来源 |
| --- | --- |
-| 姿势、深度姿势、服装、动画服装 | ギア / @giaaibusi。商用、转载、二次分发请向作者确认。仓库收录深度姿势日文文本及本站中文译名,图片由素材 CDN 分发。[线稿](https://ai-pose-gallery.pages.dev/) · [深度图](https://ai-pose-depth-gallery.pages.dev/) · [服装](https://ai-costume-gallery.pages.dev/) · [动画服装](https://ai-costume-anime-gallery.pages.dev/) |
-| 人像 | @agi_aibusi 的虚构 AI 人像,CC0。作者希望避免原样批量转载。[AI Portrait Gallery](https://ai-portrait-gallery.pages.dev/) |
-| 发型与部分动画服装 | たき AI / CharaDB,标签为 CC0。图片归作者所有,直接从原站加载。[CharaDB](https://charadb-2fi.pages.dev/) |
-| 表情 | WaveSpeed AI Emotion Gallery;使用 ICT Face Model Light 头模(© USC Institute for Creative Technologies,MIT)。 |
-| 历代服饰、场景、光影、道具、家具 | Shisei / wquguru,CC0 1.0。 |
+| 姿势、深度姿势、服装、动画服装 | ギア / @giaaibusi,商用与转载请向作者确认。[线稿](https://ai-pose-gallery.pages.dev/) · [深度图](https://ai-pose-depth-gallery.pages.dev/) · [服装](https://ai-costume-gallery.pages.dev/) · [动画服装](https://ai-costume-anime-gallery.pages.dev/) |
+| 人像 | @agi_aibusi 的虚构 AI 人像,CC0;作者希望不要原样批量转载。[AI Portrait Gallery](https://ai-portrait-gallery.pages.dev/) |
+| 发型与部分动画服装 | たき AI / CharaDB,标签 CC0,图片在原站加载。[CharaDB](https://charadb-2fi.pages.dev/) |
+| 表情 | WaveSpeed AI Emotion Gallery;头模为 ICT FaceKit(© USC Institute for Creative Technologies,MIT) |
+| 历代服饰、场景、光影、道具、家具 | Shisei / wquguru,CC0 1.0 |
-感谢两个开源项目带来的灵感。[gen-ai-pose-image](https://github.com/wzc520pyfm/gen-ai-pose-image) · [nvzhuang](https://github.com/paipiange/nvzhuang)
+灵感来自 [gen-ai-pose-image](https://github.com/wzc520pyfm/gen-ai-pose-image) 与 [nvzhuang](https://github.com/paipiange/nvzhuang),谢谢。
diff --git a/build.py b/build.py
index 1fd8407..efd7015 100644
--- a/build.py
+++ b/build.py
@@ -1,7 +1,7 @@
import argparse,json,os,shutil,subprocess,depthpack
from costume_text import gen2
import hashlib,re,html as H
-from concurrent.futures import ThreadPoolExecutor
+from concurrent.futures import ProcessPoolExecutor
from PIL import Image
# 素材目录:默认 ./assets-raw,可用环境变量 POSEWEAR_RAW 指定(见 scripts/fetch-assets.py)
R=os.environ.get('POSEWEAR_RAW','assets-raw'); D='dist'
@@ -40,8 +40,7 @@ cos=[{'id':d['id'],'cat':CC[d['カテゴリ']][0],'catEn':CC[d['カテゴリ']][
acs=[{'id':d['id'],'cat':CC[d['カテゴリ']][0],'catEn':CC[d['カテゴリ']][1],'kw':d['キーワード'],**dict(zip(('zh','en','ti'),gen2(d['キーワード'],CC[d['カテゴリ']][1],d['id']))),'t':'a/t/'+os.path.basename(d['サムネ']),'m':'a/m/'+d['id']+'.webp','i':'a/i/'+os.path.basename(d['画像']),'o':'o/a/'+d['id']+'.png','_src':d} for d in ad]
# 双人 分类人工复核(看图)
FIX={'pair60_P031':'坐位','pair60_P053':'立位贴身','pair60_P055':'侧位','pair60_P058':'贴脸'}
-for k,v in FIX.items():
- if k in poses: poses[k]['cat']=v
+for k,v in FIX.items(): poses[k]['cat']=v
ADULT_LINES={'双人互动','全身·性感'};ADULT_CATS={'挤胸·乳沟','性感·大胆'};ADULT_COS={'内衣','性感'}
for p in poses.values():
if p['line'] in ADULT_LINES or p['cat'] in ADULT_CATS: p['a']=1
@@ -178,8 +177,8 @@ if os.path.exists(f'{AROOT}/p/t'):
for f in os.listdir(f'{AROOT}/p/t'):
if f.endswith('.jpg'): os.remove(f'{AROOT}/p/t/{f}')
if AHOST:
- open(f'{AD}/_headers','w').write('/*\n Cache-Control: public, max-age=0, must-revalidate\n Access-Control-Allow-Origin: *\n/o/*\n Content-Disposition: attachment\n')
-with ThreadPoolExecutor(max_workers=min(os.cpu_count() or 1, 8)) as ex:
+ open(f'{AD}/_headers','w').write('/*\n Cache-Control: public, max-age=31536000, immutable\n Access-Control-Allow-Origin: *\n/o/*\n Content-Disposition: attachment\n')
+with ProcessPoolExecutor() as ex:
for convert, records in ((cv,pd),(cm,cd),(ca,ad),(cr,rd)):
list(ex.map(convert,records))
for _sub,_items in NEWMODS: _cnew(_sub,_items)
diff --git a/functions/api/proxy.js b/functions/api/proxy.js
index 2cb91f0..d1c39c6 100644
--- a/functions/api/proxy.js
+++ b/functions/api/proxy.js
@@ -1,3 +1,7 @@
+// 衣姿 PoseWear 转发代理(v11):只转发、不记录、不存储任何请求内容或密钥。
+// 限制:① 只接受本站页面发起的请求(Origin / Referer 同源);② 官方接口只走标准 https;
+// 自定义中转必须带 x-proxy-custom: 1 且路径符合图片接口格式,可用 http/https 任意端口(内网地址除外);
+// ③ 结果图片只从官方结果 CDN 下载;④ 每 IP 频率限制;⑤ 只转发服务商必需的请求头。
const API_PATH=/^\/(api\/v3|v\d+(beta|alpha)?)\/(images\/(edits|generations)|models(\/[^/]+(:generateContent)?)?)$/;
const OFFICIAL=[/^api\.x\.ai$/,/^api\.openai\.com$/,/^generativelanguage\.googleapis\.com$/,/^ark\.[a-z0-9-]+\.volces\.com$/,/^ark\.[a-z0-9-]+\.bytepluses\.com$/];
const IMG_HOSTS=[/^oaidalleapiprodscus\.blob\.core\.windows\.net$/,/(^|\.)volces\.com$/,/(^|\.)bytepluses\.com$/,/(^|\.)googleusercontent\.com$/];
@@ -18,7 +22,7 @@ export async function onRequest(ctx){const {request}=ctx;
let t;try{t=new URL(request.headers.get('x-target-url')||'')}catch(e){return j(400,'缺少或无效的 x-target-url')}
if(t.username||t.password)return j(400,'目标地址不能带账号密码');
const official0=OFFICIAL.some(r=>r.test(t.hostname));
- if(t.protocol!=='https:' || (official0 && t.port))return j(400,'目标必须使用 HTTPS;官方接口只支持标准端口');
+ if(official0?(t.protocol!=='https:'||(t.port&&t.port!=='443')):!/^https?:$/.test(t.protocol))return j(400,official0?'官方接口地址必须是标准 https 地址':'目标地址必须是 http/https 地址');
const ip=request.headers.get('cf-connecting-ip')||'0';
const img=request.headers.get('x-proxy-kind')==='image';
if(img){if(request.method!=='GET')return j(405,'图片下载只支持 GET');
@@ -30,10 +34,7 @@ export async function onRequest(ctx){const {request}=ctx;
if(!official&&!custom)return j(403,'该地址不是官方接口;自定义中转需在设置中选择「自定义」');
const path=t.pathname.replace(/\/+$/,'');
if(official?!API_PATH.test(path):!/\/(images\/(edits|generations)|models(\/[^/]+(:generateContent)?)?)$/.test(path))return j(403,'该路径不允许通过代理转发');
- // Administrators opt in each relay by exact HTTPS origin, including any nonstandard port.
- // Browser direct mode is available for arbitrary HTTPS relays that support CORS.
- const relays = (ctx.env?.POSEWEAR_PROXY_ORIGINS || '').split(/[\s,]+/).filter(Boolean);
- if(!official && !relays.includes(t.origin))return j(403,'本站代理未登记此中转。请关闭代理直连,或联系部署者登记 HTTPS 来源。');
+ if(custom&&/^(localhost|127\.|10\.|192\.168\.|169\.254\.|\[)/.test(t.hostname))return j(403,'不能转发到内网地址');
if(await over(ip,'api',ctx))return j(429,'请求过于频繁,请稍后再试');
const h=new Headers();for(const name of FORWARD)if(request.headers.has(name))h.set(name,request.headers.get(name));
try{const r=await fetch(t.toString(),{method:request.method,headers:h,...(request.method==='POST'?{body:request.body,duplex:'half'}:{}),redirect:'manual'});
diff --git a/post.py b/post.py
index 6e00787..ecb0b4f 100644
--- a/post.py
+++ b/post.py
@@ -95,7 +95,6 @@ _IMG=" ".join(["'self'","data:","blob:"]+list(DEPTH_ORIGINS)+list(HOTLINK_ORIGIN
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:; "
"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")
-REVALIDATE=' Cache-Control: public, max-age=0, must-revalidate\n'
IMM=' Cache-Control: public, max-age=31536000, immutable\n'
# Pages Functions 必须位于部署目录内才会随 wrangler pages deploy 一起发布(曾因只传静态产物导致 /api/proxy 丢失,见 issue #7)
if os.path.isdir('functions'):
@@ -110,17 +109,17 @@ open(f'{D}/_headers','w').write(f'''/*
Cross-Origin-Opener-Policy: same-origin
/assets/*
{IMM}/p/*
-{REVALIDATE}/c/*
-{REVALIDATE}/a/*
-{REVALIDATE}/r/*
-{REVALIDATE}/e/*
-{REVALIDATE}/y/*
-{REVALIDATE}/s/*
-{REVALIDATE}/l/*
-{REVALIDATE}/t/*
-{REVALIDATE}/f/*
-{REVALIDATE}/o/*
-{REVALIDATE}/icon-*
+{IMM}/c/*
+{IMM}/a/*
+{IMM}/r/*
+{IMM}/e/*
+{IMM}/y/*
+{IMM}/s/*
+{IMM}/l/*
+{IMM}/t/*
+{IMM}/f/*
+{IMM}/o/*
+{IMM}/icon-*
Cache-Control: public, max-age=86400
/og.png
Cache-Control: public, max-age=86400
diff --git a/scripts/sync-r2.py b/scripts/sync-r2.py
index 7209f2d..f0c22d0 100644
--- a/scripts/sync-r2.py
+++ b/scripts/sync-r2.py
@@ -27,7 +27,7 @@ TOML = os.path.expanduser("~/.config/.wrangler/config/default.toml")
CT = {".webp": "image/webp", ".png": "image/png", ".jpg": "image/jpeg",
".jpeg": "image/jpeg", ".gif": "image/gif", ".svg": "image/svg+xml",
".json": "application/json", ".txt": "text/plain"}
-CC = "public, max-age=0, must-revalidate"
+CC = "public, max-age=31536000, immutable"
def get_token():
@@ -49,13 +49,17 @@ def main():
journal_path = os.path.abspath(args.journal or os.path.join(root, ".r2-journal"))
fail_path = journal_path + ".fail"
done = {}
+ legacy = set()
if os.path.isfile(journal_path):
with open(journal_path) as rows:
for row in rows:
+ row = row.strip()
+ if not row: continue
try:
account, bucket, key, digest = json.loads(row)
except (ValueError, TypeError):
- continue # Legacy journals do not identify the bucket or content.
+ legacy.add(row) # 旧格式 journal 只有对象键,表示已上传成功
+ continue
if account == ACCT and bucket == BUCKET: done[key] = digest
keys = []
for dp, _, fns in os.walk(root):
@@ -87,7 +91,7 @@ def main():
def put_one(rel):
with open(os.path.join(root, rel), "rb") as source: data = source.read()
digest = hashlib.sha256(data).hexdigest()
- if done.get(rel) == digest:
+ if done.get(rel) == digest or rel in legacy:
with jlock: stats["skipped"] += 1
return
url = f"https://api.cloudflare.com/client/v4/accounts/{ACCT}/r2/buckets/{BUCKET}/objects/{quote(rel)}"
diff --git a/src/app.js b/src/app.js
index a31ceb0..78b4b60 100644
--- a/src/app.js
+++ b/src/app.js
@@ -1,5 +1,5 @@
'use strict';
-let Q0='',QT='';try{const u=new URLSearchParams(location.search);Q0=(u.get('q')||'').slice(0,60);QT=u.get('t')||''}catch(e){}
+const _u=new URLSearchParams(location.search);let Q0=(_u.get('q')||'').slice(0,60),QT=_u.get('t')||'';
const $=s=>document.querySelector(s),$$=s=>document.querySelectorAll(s),LS=k=>{try{return JSON.parse(localStorage[k]||'null')}catch(e){return null}},SV=(k,v)=>{try{localStorage[k]=JSON.stringify(v)}catch(e){}};
const esc=s=>String(s??'').replace(/[&<>"]/g,c=>({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;'}[c]));
const motionPreference=matchMedia('(prefers-reduced-motion: reduce)'),HOVER=matchMedia('(hover:hover) and (pointer:fine)').matches;
@@ -482,7 +482,7 @@ $('#sugg').onclick=e=>{const s=e.target.closest('[data-s]');if(s){st.f={};$('#q'
$('#sort').onchange=e=>{st.sort=e.target.value;viewT(apply)};
$('#qDone').onclick=()=>$('#libraryMenu summary').focus({preventScroll:true});
let qt;$('#q').oninput=e=>{$('#qx').hidden=!e.target.value;clearTimeout(qt);qt=setTimeout(()=>{st.q=e.target.value;apply()},160)};$('#qx').onclick=()=>{$('#q').value='';st.q='';$('#qx').hidden=true;apply();$('#q').focus()};
-function randPick(){if(!st.list.length)return toast('当前没有可选的内容');const i=Math.random()*st.list.length|0;lbOpen(i);0}
+function randPick(){if(!st.list.length)return toast('当前没有可选的内容');const i=Math.random()*st.list.length|0;lbOpen(i)}
$('#rand').onclick=randPick;
// 语言
function setLang(l,quiet){st.lang=l;SV('lang',l);document.documentElement.dataset.lang=l;$$('button[data-lang]').forEach(b=>b.classList.toggle('on',b.dataset.lang==l));grid.querySelectorAll('.card').forEach(c=>{const origin=ITEMS[c.dataset.k];if(origin)c.querySelector('.sub').textContent=subtitle(cardFace(origin),origin.type)});if(!quiet)toast(l=='zh'?'描述语言:中文':'描述语言:英文提示词')}
@@ -662,7 +662,7 @@ let closing=false;function lbClose(navigate=false,immediate=false){if($('#lb').h
if(lbPushed){lbPushed=false;if(!leaving)history.back()}
const it=st.list[li],c=it&&grid.querySelector(`.card[data-k="${CSS.escape(it.k)}"]`),r=c&&c.querySelector('.ph').getBoundingClientRect();
const vis=r&&r.bottom>0&&r.top<innerHeight;const done=()=>{closing=false;lbVariant=null;$('#lb').hidden=true;document.body.style.overflow='';$('.lb-box').getAnimations().forEach(a=>a.cancel());if(!leaving&&location.hash.includes('/'))history.replaceState(null,'','#'+st.tab);
- if(!leaving&&lbVisitedPair&&(st.tab==='recent'||st.tab==='fav'&&pend.size))apply();
+ if(!leaving&&lbVisitedPair&&(st.tab==='recent'||(st.tab==='fav'&&pend.size)))apply();
else if(st.tab==='fav')pend.forEach(k=>!st.fav.has(k)&&dropCard(k));
lbVisitedPair=false;pend.clear();
if(fromHistory)window.HIS?.closed?.(!leaving);
diff --git a/src/history.js b/src/history.js
index 4df3b11..a9291ab 100644
--- a/src/history.js
+++ b/src/history.js
@@ -7,7 +7,7 @@
const p2 = n => String(n).padStart(2, '0');
const stamp = d => `${d.getFullYear()}${p2(d.getMonth() + 1)}${p2(d.getDate())}-${p2(d.getHours())}${p2(d.getMinutes())}`;
const PROV_NAME = { openai: 'OpenAI', gemini: 'Gemini', seedream: '豆包', custom: '自定义' };
- const providerName = r => (r.prov === 'local' && r.model) || PROV_NAME[r.prov] || r.prov || 'AI';
+ const providerName = r => r.prov === 'local' ? (r.model || '本机引擎') : (PROV_NAME[r.prov] || r.prov);
let L = [];
const sel = new Set();
diff --git a/src/i18n.js b/src/i18n.js
index 6b905fb..52872f7 100644
--- a/src/i18n.js
+++ b/src/i18n.js
@@ -20,6 +20,8 @@
'无法连接本机 ComfyUI。请先启动服务,再测试连接。':['Could not reach ComfyUI on this computer. Start the service, then test again.','ローカルの ComfyUI に接続できません。起動してから接続を再テストしてください。'],
'ComfyUI 中还没有可用的 checkpoint':['No checkpoints are available in ComfyUI yet.','ComfyUI に利用可能なモデルがありません。'],
'通知': ['Notifications','お知らせ'], '姿态': ['Movement','動作'], '人物造型': ['People','人物・髪型'],
+ '官方声明':['Official notice','公式のお知らせ'],
+ '衣姿 PoseWear 官网只有 posewear.pages.dev,没有 Windows / Android 客户端,也从不提供 exe、apk 下载。posewear.cn 等站点均为冒充,请勿在其中填写 API Key。':['The only official PoseWear site is posewear.pages.dev. There is no Windows or Android app, and we never offer exe or apk downloads. Sites such as posewear.cn are impostors — never enter your API key there.','PoseWear の公式サイトは posewear.pages.dev のみです。Windows / Android アプリはなく、exe や apk のダウンロードも提供していません。posewear.cn などは偽サイトです。API キーを入力しないでください。'],
'服饰': ['Wardrobe','衣類'], '环境与物件': ['Setting','空間・小物'], '素材库': ['Libraries','素材集'], '我的': ['Saved','マイページ'],
'工作台': ['Studio','スタジオ'],
'深度图': ['Depth map','深度画像'],
@@ -114,10 +116,8 @@
'从库中选': ['Browse library','素材集から選ぶ'], '从动画服装选': ['Anime outfits','アニメ衣装から選ぶ'],
'全部角度': ['All angles','全アングル'], '多姿势出图方式': ['Multiple-pose output','複数ポーズの生成方法'],
'分开出': ['Separate images','個別に生成'], '拼一张': ['One sheet','1枚にまとめる'], '从表情库选': ['Browse expressions','表情集から選ぶ'],
- '需要一个图像模型的 API Key': ['Add an image model API key','画像モデルの API キーを設定'],
'选择服务商并配置自己的 API Key。': ['Choose your provider and enter your own API key.','プロバイダーを選び、ご自身の API キーを設定してください。'],
'去设置': ['Set up','設定する'], '结果': ['Result','結果'], '结果会显示在这里': ['Your result will appear here','生成した画像がここに表示されます'],
- '选好人物和服装后点「生成」': ['Select a person and an outfit, then choose Generate.','人物と衣装を選び、「生成」を押してください。'],
'生成结果': ['Generated image','生成結果'], '原始照片': ['Original photo','元の写真'], '前后对比': ['Before and after','生成前後の比較'], '原图': ['Original','元画像'],
'正在上传素材…': ['Uploading references…','素材をアップロード中…'], '正在准备素材…': ['Preparing references…','素材を準備中…'],
'取消': ['Cancel','キャンセル'], '下载': ['Download','ダウンロード'], '全部打包': ['Download all as ZIP','すべて ZIP に保存'],
@@ -156,11 +156,9 @@
'图片字段名': ['Image field name','画像フィールド名'], 'image[](官方,多图)': ['image[] (official, multiple images)','image[](公式、複数画像)'],
'image(部分中转)': ['image (some endpoints)','image(一部の接続先)'],
'通过本站代理转发': ['Route through the site proxy','サイトのプロキシを経由'],
- '开启后,本站代理会转发请求内容和凭据。': ['When enabled, the site proxy forwards your request and credentials.','有効にすると、このサイトのプロキシがリクエストと認証情報を転送します。'],
'API Key 保存在此浏览器。使用公共设备后,请清除密钥。': ['Your key is stored in this browser. Clear it after using a shared device.','キーはこのブラウザに保存されます。共有端末の利用後はキーを削除してください。'],
'清除密钥': ['Clear key','キーを削除'], '导出': ['Export','書き出し'], '测试连接': ['Test connection','接続テスト'], '保存': ['Save','保存'],
'生图工作台': ['Image workspace','画像作成'], '添加素材': ['Add references','素材を追加'],
- '工作台还是空的。用上面的按钮直接选素材,或者在图库里点卡片上的 + 加入——拼好素材就能在这里生图。': ['Choose a reference above or add one from the library with +.','上のボタンから素材を選ぶか、素材集の + で追加できます。'],
'复制中文描述': ['Copy Chinese description','中国語の説明をコピー'], '复制英文提示词': ['Copy English prompt','英語プロンプトをコピー'],
'完整工作台': ['Full studio','試着室を開く'], '生图提示词': ['Image prompt','画像プロンプト'],
'选好素材后这里会自动填好提示词,也可以自己改': ['A prompt appears when you add references. You can edit it here.','素材を追加するとプロンプトが表示されます。ここで編集できます。'],
@@ -187,11 +185,6 @@
':站点部署者可以开启 Cloudflare Web Analytics。': [': The site operator can enable Cloudflare Web Analytics.',':サイトの運営者は Cloudflare Web Analytics を有効にできます。'],
':姿势、服装、人像和深度姿势由本站托管分发,来自 AI Pose Gallery、AI Costume Gallery、AI Costume Anime Gallery、AI Pose Depth Gallery(@giaaibusi)与 AI Portrait Gallery(@agi_aibusi)。发型与部分动画服装的图片由 CharaDB 原站托管、页面直接加载,对方能看到请求的 IP。': [': PoseWear serves poses, outfits, portraits and depth references from the credited galleries. Hair and some anime outfits load directly from CharaDB, which receives your IP address.',':ポーズ、衣装、人物、深度素材は各提供元からの素材を当サイトが配信しています。髪型と一部のアニメ衣装は CharaDB から直接読み込むため、接続元 IP が提供元に伝わります。'],
'参考图':['Reference images','参考画像'], '来源':['Source','出典'], '非官方汉化':['Unofficial translation','非公式翻訳'],
- '人像使用提示与规则':['Portrait usage notes','人物素材の利用について'],
- '在 AI 工具的「角色参考 / 脸部参考」里载入这张图即可。':['Load the image in your AI tool’s character or face reference field.','AI ツールのキャラクター・顔の参照欄に画像を読み込みます。'],
- '想统一长相用「正脸」;参考服装、发质和整体氛围用「生活照」。':['Choose a front-facing portrait for facial consistency, or a lifestyle photo for clothing and hair reference.','顔を揃えるには正面の写真を、衣装・髪・雰囲気には日常写真を使います。'],
- '一直用同一张图,生成的脸会更稳定。下载原图 PNG 能保留更多细节。':['Reuse the same reference for a consistent face. The original PNG has more detail.','同じ画像を使うと顔が安定します。元の PNG には細部が残っています。'],
- 'CC0 1.0:可商用、可修改,无需署名。均为 AI 生成的虚构人物,不得用来冒充真人或用于违背公序良俗的用途。原作者希望不要把图片原样批量转载。':['CC0 1.0 permits commercial use and edits without attribution. The people are fictional and AI-generated. Do not use them to impersonate real people or for inappropriate purposes. The creator asks that the images not be reposted unchanged in bulk.','CC0 1.0。商用利用・改変可能で、表示義務はありません。AI 生成の架空の人物です。なりすましや公序良俗に反する利用はお控えください。作者はそのままの一括転載を希望していません。'],
'添加到组合':['Add to set','組合せに追加'], '加入组合':['Add to set','組合せに追加'], '移出组合':['Remove from set','組合せから削除'],
'取消收藏':['Remove favorite','お気に入りを解除'], '已收藏':['Favorited','お気に入り済み'], '撤销':['Undo','元に戻す'], '移除':['Remove','削除'],
'从记录中移除':['Remove from history','履歴から削除'], '查看大图':['Open preview','拡大表示'], '复制中文':['Copy Chinese','中国語をコピー'],
@@ -246,8 +239,8 @@
'已加入表情参考(只取神态)':['Expression added as a reference','表情の参考に追加しました'], '已选为试穿服装':['Outfit selected for try-on','試着する衣装に設定しました'],
'已加入补充要求':['Added to additional instructions','追加の指定に反映しました'], '已读入设置,点击保存后生效':['Settings imported. Save to apply.','設定を読み込みました。保存すると反映されます。'],
'Base URL 需填写有效的 HTTPS 地址,请勿在地址中包含账号或密码。':['Enter a valid HTTPS base URL without a username or password.','ユーザー名・パスワードを含まない HTTPS の URL を入力してください。'],
- '直连时,浏览器将密钥和图片发给填写的 HTTPS 地址。启用本站代理后会经本站转发,仅支持管理员登记的中转地址(含端口)。':['Direct requests send your key and images to the HTTPS endpoint you enter. The site proxy forwards them only to endpoints and ports registered by the administrator.','直接接続では入力した HTTPS の接続先にキーと画像を送信します。サイトのプロキシは、管理者が登録した接続先とポートにのみ転送します。'],
- ':本站仅向官方服务或管理员登记的 HTTPS 地址转发。接收方会收到凭据和图片,请选择可信服务。':[': The proxy forwards only to official services or registered HTTPS endpoints. The recipient receives your credentials and images. Choose a service you trust.',':公式サービスまたは管理者が登録した HTTPS 接続先にのみ転送します。認証情報と画像は相手に届くため、信頼できるサービスを選んでください。'],
+ '直连时,浏览器将密钥和图片发给填写的地址;启用本站代理后经本站转发。http/https 与任意端口均可。':['With direct requests, your browser sends your key and images to the endpoint you enter. The site proxy can forward them instead. http/https and any port are allowed.','直接接続では、入力した接続先にキーと画像を送信します。サイトのプロキシ経由も選べます。http/https と任意のポートに対応します。'],
+ ':本站代理只转发图片生成接口请求,不转发到内网地址。接收方会收到凭据和图片,请选择可信服务。':[': The site proxy forwards only image-generation API requests and never to private network addresses. The recipient receives your credentials and images. Choose a service you trust.',':サイトのプロキシは画像生成 API のリクエストのみを転送し、プライベートネットワークには転送しません。認証情報と画像は相手に届くため、信頼できるサービスを選んでください。'],
'记录保存失败,请先下载':['Could not save to history. Download your image.','履歴に保存できません。先に画像をダウンロードしてください。'],
'已有生成任务正在进行':['A generation is already running','すでに生成中です'], '生成完成,部分图片未能存入生成记录,请先下载。':['Generation finished. Some images could not be saved to history. Download them now.','生成が完了しました。一部を履歴に保存できなかったため、ダウンロードしてください。'],
'已载入历史提示词和可用参考图':['Restored the prompt and available references','履歴のプロンプトと利用可能な参考画像を読み込みました'],
diff --git a/src/image-providers.js b/src/image-providers.js
index 567ba86..29a2203 100644
--- a/src/image-providers.js
+++ b/src/image-providers.js
@@ -79,7 +79,7 @@ window.PoseWearImageProviders = (() => {
}
const statusMessages = {
- 400: '请求参数有误:常见原因是模型不支持参考图、画幅尺寸不对或图片格式不支持,可换个模型或画幅再试',
+ 400: '请求参数有误:模型、画幅或图片格式可能不受支持',
401: '密钥无效或已过期,请检查 API Key',
403: '没有权限:密钥无此模型权限、账户未验证,或所在地区不受支持',
404: '地址或模型不存在:请检查 Base URL 和模型名',
@@ -90,7 +90,7 @@ window.PoseWearImageProviders = (() => {
};
function apiError(reply, data, settings) {
- const detail = data?.error?.message || data?.error?.status || data?.error || data?.message || reply.statusText;
+ const detail = data?.error?.message || data?.message || reply.statusText;
const message = redact(typeof detail === 'string' ? detail : JSON.stringify(detail), settings.key);
const requestId = data?.error?.request_id || reply.headers.get('x-request-id');
const blocked = safetyError(message, data, requestId, settings.key);
@@ -103,7 +103,7 @@ window.PoseWearImageProviders = (() => {
if (/API_KEY_INVALID|API key not valid|invalid api key|Incorrect API key|AuthenticationError|InvalidApiKey/i.test(message + ' ' + JSON.stringify(data))) {
reason = statusMessages[401];
} else if (unsupported) {
- reason = '该服务商不支持 ' + unsupported[1] + ' 参数:当前接口协议与它的规格对不上,请检查「接口协议」设置(xAI 请改选 xAI 协议)';
+ reason = '该服务商不支持 ' + unsupported[1] + ' 参数,请检查「接口协议」设置';
}
const error = Error(message);
error.status = reply.status;
@@ -125,7 +125,7 @@ window.PoseWearImageProviders = (() => {
if (!reply.ok) {
if (settings.prov === 'seedream' && reply.status === 404) {
if (reply.headers.get('content-type')?.includes('text/html')) {
- throw Error('本站代理未生效:/api/proxy 返回的是网站静态页面而不是接口响应,Seedream 暂时连不上,请稍后再试或联系站长');
+ throw Error('本站代理未生效(/api/proxy 返回了网页内容),请稍后再试或联系站长');
}
return '地址可达,方舟未提供模型列表。请通过生成验证密钥与模型。';
}
@@ -173,18 +173,15 @@ window.PoseWearImageProviders = (() => {
if (!image?.url) throw Error('服务商没有返回图片数据' + (data?.error?.message ? ':' + redact(data.error.message, job.settings.key) : ''));
const { url } = image;
let reply = await fetch(url, { signal: job.signal }).catch(() => null);
- if (!reply?.ok) {
- job.signal.throwIfAborted();
- reply = await fetch('/api/proxy', {
- signal: job.signal, headers: { 'x-target-url': url, 'x-proxy-kind': 'image' }
- }).catch(() => null);
- }
- job.signal.throwIfAborted();
- if (!reply?.ok) throw Error('结果图片无法在浏览器中下载,请直接打开:' + redact(url, job.settings.key));
+ if (!reply?.ok) reply = await fetch('/api/proxy', {
+ signal: job.signal, headers: { 'x-target-url': url, 'x-proxy-kind': 'image' }
+ }).catch(() => null);
+ if (!reply?.ok) throw Error('结果图片下载失败,请直接打开:' + redact(url, job.settings.key));
return reply.blob();
}
- async function generateLocal({ images, prompt, ratio, checkpoint, signal }) {
+ async function generateLocal(job) {
+ const { images, prompt, ratio, checkpoint, signal } = job;
const form = new FormData();
form.set('prompt', prompt);
if (checkpoint) form.set('checkpoint', checkpoint);
@@ -276,22 +273,10 @@ window.PoseWearImageProviders = (() => {
try {
return { blob: await edits(job, size, field) };
} catch (error) {
- if (error.name === 'AbortError' || error.safe || /Argument not supported/i.test(error.message)) throw error;
- if (error.status === 400 && /image/i.test(error.message) && !/safety|moderation|reject/i.test(error.message)) {
- const alternate = field === 'image[]' ? 'image' : 'image[]';
- try {
- return { blob: await edits(job, size, alternate), warn: '已自动改用另一种图片字段名重试成功。' };
- } catch (retryError) {
- if (retryError.name === 'AbortError' || retryError.safe || retryError.status !== 400) throw retryError;
- }
- }
- if (![404, 405, 415, 501].includes(error.status) && !/edits|not supported|unsupported|no such|invalid url/i.test(error.message)) throw error;
- }
- try {
- return { blob: await generations(job, { size }), warn: '该接口不支持 images/edits,已自动改用 images/generations(JSON 多图)。' };
- } catch (error) {
- if (error.safe || error.status !== 400) throw error;
- return { blob: await generations(job, { size }, []), warn: textOnlyWarning };
+ // 只对「图片字段名不对」这一种已知情况换字段重试一次;其余错误直接报出,不静默换协议或丢参考图
+ if (error.name === 'AbortError' || error.safe || error.status !== 400 || !/image/i.test(error.message) || /safety|moderation|reject/i.test(error.message)) throw error;
+ const alternate = field === 'image[]' ? 'image' : 'image[]';
+ return { blob: await edits(job, size, alternate), warn: '已自动改用另一种图片字段名重试成功。' };
}
}
diff --git a/src/index.html b/src/index.html
index 7992e4f..040315e 100644
--- a/src/index.html
+++ b/src/index.html
@@ -1,6 +1,6 @@
<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
<title>姿势库 · 衣姿 PoseWear</title>
-<meta name="description" content="288 个人体姿势(1439 张多角度图)、1407 套服装、1760 套动画服装和 1499 张人像参考图,另有表情、发型、历代、场景、光影、道具、家具扩展库,附中英文提示词,可上传照片试穿,也可在图库里直接生图。">
+<meta name="description" content="衣姿 PoseWear:姿势、服装、人像参考图库,附中英文提示词,可上传照片试穿,也可在图库里直接生图。">
<meta name="keywords" content="绘画参考,姿势参考,服装参考,提示词,Stable Diffusion,Midjourney,姿势库,服装库">
<meta name="theme-color" content="#ffffff"><meta property="og:title" content="衣姿 PoseWear:姿势和服装参考图"><meta property="og:description" content="288 个姿势、1407 套服装、1760 套动画服装、1499 张人像,附中英文提示词,可上传照片试穿。"><meta property="og:type" content="website"><meta property="og:image" content="https://posewear.pages.dev/og.png"><meta property="og:url" content="https://posewear.pages.dev/"><link rel="canonical" href="https://posewear.pages.dev/"><meta name="twitter:card" content="summary_large_image">
<link rel="icon" href="favicon.svg" type="image/svg+xml"><link rel="apple-touch-icon" href="apple-touch-icon.png"><link rel="manifest" href="manifest.webmanifest">
@@ -27,7 +27,7 @@
<button type="button" data-theme-choice="dark" aria-pressed="false"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/></svg><span>深色</span></button>
</div></details><details id="noticeMenu" class="shell-menu" name="header-popover"><summary class="icon" aria-label="通知" title="通知"><svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.65" stroke-linecap="round" stroke-linejoin="round"><path d="M5 16c1.4-1.4 1.8-3.4 1.8-6a5.2 5.2 0 0 1 10.4 0c0 2.6.4 4.6 1.8 6l.6 1H4.4zM10 20a2.5 2.5 0 0 0 4 0"/></svg></summary>
<section class="shell-pop notice-pop" aria-label="通知"><h2>通知</h2><button id="noticeReload" class="sm" hidden>更新已就绪,刷新页面</button>
-<p id="noticeAction" hidden></p><article id="releaseNotice"><strong>图库更新</strong><p>复制提示词可附参考图链接。</p></article>
+<p id="noticeAction" hidden></p><article id="officialNotice"><strong>官方声明</strong><p>衣姿 PoseWear 官网只有 posewear.pages.dev,没有 Windows / Android 客户端,也从不提供 exe、apk 下载。posewear.cn 等站点均为冒充,请勿在其中填写 API Key。</p></article><article id="releaseNotice"><strong>图库更新</strong><p>复制提示词可附参考图链接。</p></article>
<button id="help" class="notice-help" type="button">快捷键</button></section></details></div>
</header>
<h1 class="vh" id="collectionTitle">姿势库</h1>
@@ -88,7 +88,7 @@
<label class="fld">API Key<span class="kw"><input id="cfKey" type="password" placeholder="sk-…" autocomplete="off" spellcheck="false"><button class="sm ghost" id="cfEye" type="button">显示</button></span></label>
<label class="fld">模型<input id="cfModel" list="cfModels" spellcheck="false"><datalist id="cfModels"></datalist></label>
<div class="grp">高级</div><label class="fld" id="cfProtoW">接口协议<select id="cfProto"><option value="edits">images/edits · multipart(OpenAI 官方格式)</option><option value="json">images/generations · JSON 多图(多数中转 / gpt-image-2)</option><option value="xai">xAI · images/edits JSON(Grok Imagine)</option><option value="gemini">Gemini · models/:generateContent(Nano Banana 等)</option></select></label><label class="fld" id="cfFieldW">图片字段名<select id="cfField"><option value="image[]">image[](官方,多图)</option><option value="image">image(部分中转)</option></select></label>
-<label class="tg"><input type="checkbox" id="cfProxy"><span><b>通过本站代理转发</b><small>直连时,浏览器将密钥和图片发给填写的 HTTPS 地址。启用本站代理后会经本站转发,仅支持管理员登记的中转地址(含端口)。</small></span></label>
+<label class="tg"><input type="checkbox" id="cfProxy"><span><b>通过本站代理转发</b><small>直连时,浏览器将密钥和图片发给填写的地址;启用本站代理后经本站转发。http/https 与任意端口均可。</small></span></label>
<div class="note">API Key 保存在此浏览器。使用公共设备后,请清除密钥。</div>
<p class="fine" id="cfMsg" aria-live="polite"></p>
</div>
@@ -134,5 +134,5 @@
<p><a href="https://charadb-2fi.pages.dev/" target="_blank" rel="noopener">CharaDB</a> · たき AI<span>。发型与部分动画服装使用原站图片,标签为 CC0,图片版权归原作者。</span></p>
<p>WaveSpeed AI Emotion Gallery · ICT Face Model Light<span>。表情参考使用 ICT-FaceKit 头模,© USC Institute for Creative Technologies,MIT。</span></p>
<p>Shisei · wquguru<span>。历代服饰、场景、光影、道具与家具采用 CC0 1.0。</span></p>
-</div></details><!-- category-index --></footer><div id="ageBox" class="mdl" hidden role="dialog" aria-modal="true" aria-labelledby="ageT"><div class="hb"><h3 id="ageT">显示成人向内容?</h3><p id="ageP">包括双人互动、性感类姿势、深度姿势里的双人图,以及内衣、性感类服装。仅适合已满 18 岁的用户。只需确认一次,之后用顶部的「18+」开关随时打开或关闭。</p><div class="row"><button class="sm ghost" id="ageN">暂不</button><button class="sm pri" id="ageY">我已满 18 岁,打开</button></div></div></div><div id="privBox" class="mdl" hidden role="dialog" aria-modal="true" aria-labelledby="privT"><div class="hb"><h3 id="privT">隐私说明</h3><ul class="pl"><li><b>本机存储</b>:收藏、浏览记录、筛选偏好、成人内容开关和试穿记录只保存在你的浏览器(localStorage / IndexedDB),不上传。清除浏览器数据即可删除。</li><li><b>API 密钥</b>:密钥保存在此浏览器。直连时,请求发往所选服务商;使用本站代理时,代理会经手凭据和图片。</li><li><b>代理限制</b>:本站仅向官方服务或管理员登记的 HTTPS 地址转发。接收方会收到凭据和图片,请选择可信服务。</li><li><b>统计</b>:站点部署者可以开启 Cloudflare Web Analytics。</li><li><b>图片</b>:姿势、服装、人像和深度姿势由本站托管分发,来自 AI Pose Gallery、AI Costume Gallery、AI Costume Anime Gallery、AI Pose Depth Gallery(@giaaibusi)与 AI Portrait Gallery(@agi_aibusi)。发型与部分动画服装的图片由 CharaDB 原站托管、页面直接加载,对方能看到请求的 IP。</li></ul><div class="row"><button class="sm pri" data-close>知道了</button></div></div></div>
+</div></details><!-- category-index --></footer><div id="ageBox" class="mdl" hidden role="dialog" aria-modal="true" aria-labelledby="ageT"><div class="hb"><h3 id="ageT">显示成人向内容?</h3><p id="ageP">包括双人互动、性感类姿势、深度姿势里的双人图,以及内衣、性感类服装。仅适合已满 18 岁的用户。只需确认一次,之后用顶部的「18+」开关随时打开或关闭。</p><div class="row"><button class="sm ghost" id="ageN">暂不</button><button class="sm pri" id="ageY">我已满 18 岁,打开</button></div></div></div><div id="privBox" class="mdl" hidden role="dialog" aria-modal="true" aria-labelledby="privT"><div class="hb"><h3 id="privT">隐私说明</h3><ul class="pl"><li><b>本机存储</b>:收藏、浏览记录、筛选偏好、成人内容开关和试穿记录只保存在你的浏览器(localStorage / IndexedDB),不上传。清除浏览器数据即可删除。</li><li><b>API 密钥</b>:密钥保存在此浏览器。直连时,请求发往所选服务商;使用本站代理时,代理会经手凭据和图片。</li><li><b>代理限制</b>:本站代理只转发图片生成接口请求,不转发到内网地址。接收方会收到凭据和图片,请选择可信服务。</li><li><b>统计</b>:站点部署者可以开启 Cloudflare Web Analytics。</li><li><b>图片</b>:姿势、服装、人像和深度姿势由本站托管分发,来自 AI Pose Gallery、AI Costume Gallery、AI Costume Anime Gallery、AI Pose Depth Gallery(@giaaibusi)与 AI Portrait Gallery(@agi_aibusi)。发型与部分动画服装的图片由 CharaDB 原站托管、页面直接加载,对方能看到请求的 IP。</li></ul><div class="row"><button class="sm pri" data-close>知道了</button></div></div></div>
<script src="i18n.js" defer></script><script src="references.js" defer></script><script src="app.js" defer></script><script src="zip.js" defer></script><script src="extras.js" defer></script><script src="image-providers.js" defer></script><script src="studio.js" defer></script><script src="history.js" defer></script></body></html>
diff --git a/src/studio.js b/src/studio.js
index 2ebbf03..2897e68 100644
--- a/src/studio.js
+++ b/src/studio.js
@@ -66,7 +66,7 @@ async function assetBlob(a,signal){
const r=await fetch(src,{signal,referrerPolicy:A.ITEMS[a.k].ref||''});if(!r.ok)throw Error('素材下载失败('+r.status+')');const u=URL.createObjectURL(await r.blob());try{return(await toJpeg(u,a.kind=='portrait'?1536:1280)).blob}finally{URL.revokeObjectURL(u)}}
const isGen=()=>W.mode=='gen';const hasPerson=()=>W.persons.length>0;
// ---------- 提示词 ----------
-// Only the matching view of a pose sketch and its paired depth map describe one action.
+// 线稿与深度图只有同视角才算同一个动作
function poseGroups(poses){
const groups=[];
for(const ref of poses){
@@ -522,7 +522,7 @@ function cfgFill(cfg){
}
$('#cfg').classList.toggle('local-engine',cfg.prov==='local');
$$('[name=prov]').forEach(r=>r.checked=r.value==cfg.prov);const P=PROV[cfg.prov];$('#cfBase').value=cfg.base;$('#cfBase').placeholder=P.base||'https://你的中转地址/v1';$('#cfKey').value=cfg.key;$('#cfKey').placeholder=cfg.prov=='gemini'?'AIza…':'sk-… / 方舟 API Key';
- $('#cfModel').value=cfg.model;$('#cfModel').placeholder=P.model;$('#cfModels').innerHTML=P.models.map(m=>`<option value="${m}">`).join('');$('#cfField').value=cfg.field;$('#cfProto').value=cfg.proto;$('#cfProtoW').hidden=cfg.prov!='custom';$('#cfFieldW').hidden=!(cfg.prov=='custom'&&cfg.proto=='edits');$('#cfProxy').checked=cfg.proxy;$('#cfHelp').innerHTML=({local:preset?'使用一张参考图。测试连接后选择模型。':'使用本机已启动的引擎。',openai:'在 <a href="https://platform.openai.com/api-keys" target="_blank" rel="noopener">platform.openai.com/api-keys</a> 创建密钥;gpt-image-1 需要已验证的组织。',gemini:'在 <a href="https://aistudio.google.com/apikey" target="_blank" rel="noopener">Google AI Studio</a> 免费获取 API Key(AIza 开头)。',seedream:'在 <a href="https://console.volcengine.com/ark" target="_blank" rel="noopener">火山方舟控制台</a> 开通 Seedream 模型并创建 API Key;会自动走本站代理。',custom:'直连时,浏览器将密钥和图片发给填写的 HTTPS 地址。启用本站代理后会经本站转发,仅支持管理员登记的中转地址(含端口)。'})[cfg.prov]||'';$('#cfMsg').textContent='';$('#cfMsg').className='fine'}
+ $('#cfModel').value=cfg.model;$('#cfModel').placeholder=P.model;$('#cfModels').innerHTML=P.models.map(m=>`<option value="${m}">`).join('');$('#cfField').value=cfg.field;$('#cfProto').value=cfg.proto;$('#cfProtoW').hidden=cfg.prov!='custom';$('#cfFieldW').hidden=!(cfg.prov=='custom'&&cfg.proto=='edits');$('#cfProxy').checked=cfg.proxy;$('#cfHelp').innerHTML=({local:preset?'使用一张参考图。测试连接后选择模型。':'使用本机已启动的引擎。',openai:'在 <a href="https://platform.openai.com/api-keys" target="_blank" rel="noopener">platform.openai.com/api-keys</a> 创建密钥;gpt-image-1 需要已验证的组织。',gemini:'在 <a href="https://aistudio.google.com/apikey" target="_blank" rel="noopener">Google AI Studio</a> 免费获取 API Key(AIza 开头)。',seedream:'在 <a href="https://console.volcengine.com/ark" target="_blank" rel="noopener">火山方舟控制台</a> 开通 Seedream 模型并创建 API Key;会自动走本站代理。',custom:'直连时,浏览器将密钥和图片发给填写的地址;启用本站代理后经本站转发。http/https 与任意端口均可。'})[cfg.prov]||'';$('#cfMsg').textContent='';$('#cfMsg').className='fine'}
function cfgRead(){
const prov=$('[name=prov]:checked').value;
const settings={prov,base:$('#cfBase').value.trim(),key:$('#cfKey').value.trim(),model:$('#cfModel').value.trim(),field:$('#cfField').value,proto:$('#cfProto').value,proxy:$('#cfProxy').checked};
@@ -731,16 +731,16 @@ function errBox(e,head,hasGarment){const el=$('#wbErr');el.hidden=false;el.class
const detail=e.raw+(safety.rid&&!e.raw.includes(safety.rid)?'\nrequest id: '+safety.rid:'')+(e.sent?'\n\n'+window.PWLocale.t('实际发送的提示词')+'\n'+e.sent:'');
el.innerHTML=`<b>${head?esc(head)+' · ':''}<span>被服务商的安全审核拦下了</span></b><p>${esc(PROV[cfg.prov].name)} · <span>${where}</span>${reason?' · '+reason:''}</p><div class="row"><button class="sm" data-ef="prov">换服务商重试</button>${edit}<button class="sm ghost" id="wbRetry">重试</button></div>${hasGarment&&!neutralOn()?'<button class="sm" data-ef="neutral">打开减少误拦截后重试</button>':''}<details class="raw"><summary>查看原始信息</summary><pre>${esc(detail)}</pre><button class="sm ghost" data-ef="copy">复制</button></details>`;return}
el.innerHTML=`<b>${head||'生成失败'}</b><p>${esc(nice(e)).replace(/\n/g,'<br>')}</p><div class="row"><button class="sm" id="wbRetry">重试</button><button class="sm ghost" data-open-cfg>检查 API 设置</button></div>`}
-$('#wbStage').addEventListener('click',e=>{const f=e.target.closest('[data-ef]');if(f){const k=f.dataset.ef;if(k=='prov'){cfgOpen();const p=$('#cfg .prov');p.scrollIntoView({block:'start'});p.classList.remove('hl');void p.offsetWidth;p.classList.add('hl');const o=$('[name=prov]:not(:checked)');o&&o.focus()}if(k=='cos')picker('costume');if(k=='prompt')$('#wbPrompt').focus();if(k=='neutral'){SV('wbNeutral',true);$('#wbNeutral').checked=true;run()}if(k=='copy')A.copy?A.copy(f.previousElementSibling.textContent):navigator.clipboard.writeText(f.previousElementSibling.textContent).then(()=>toast('已复制'));return}if(e.target.id=='wbRetry'&&retryBatch)run({retry:retryBatch});if(e.target.closest('[data-open-cfg]'))cfgOpen()});
+$('#wbStage').addEventListener('click',e=>{const f=e.target.closest('[data-ef]');if(f){const k=f.dataset.ef;if(k=='prov'){cfgOpen();const p=$('#cfg .prov');p.scrollIntoView({block:'start'});p.classList.remove('hl');void p.offsetWidth;p.classList.add('hl');const o=$('[name=prov]:not(:checked)');o&&o.focus()}if(k=='cos')picker('costume');if(k=='prompt')$('#wbPrompt').focus();if(k=='neutral'){SV('wbNeutral',true);$('#wbNeutral').checked=true;run()}if(k=='copy')A.copy(f.previousElementSibling.textContent);return}if(e.target.id=='wbRetry'&&retryBatch)run({retry:retryBatch});if(e.target.closest('[data-open-cfg]'))cfgOpen()});
$('#wbGo').onclick=()=>run();$('#wbAgain').onclick=()=>run();$('#wbStop').onclick=()=>W.busy&&W.busy.abort();
// ---------- 结果 ----------
-let urls=[];const ru=new Map();const U=b=>{if(!ru.has(b))ru.set(b,URL.createObjectURL(b));return ru.get(b)};
+const ru=new Map();const U=b=>{if(!ru.has(b))ru.set(b,URL.createObjectURL(b));return ru.get(b)};
function show(i,meta){const r=W.results[i];if(!r)return;{let d=$('#wbSentD');if(!d){d=document.createElement('details');d.id='wbSentD';d.className='raw sent';$('#wbOutAct').after(d)}d.hidden=!r.prompt;d.innerHTML=r.prompt?`<summary>查看原始信息${r.neutral?' · 已减少误拦截':''}</summary><pre>${esc((r.orig?'原提示词:\n'+r.orig+'\n\n实际发送:\n':'实际发送:\n')+r.prompt)}</pre>`:''}W.ri=i;const a=U(r.after),hasB=!!r.before;$('#wbAfter').src=a;if(hasB)$('#wbBefore').src=U(r.before);$('#wbCmp').hidden=false;$('#wbCmp').classList.toggle('solo',!hasB||!W.cmp);$('#wbCmpT').hidden=!hasB;$('#wbCmpT').textContent=W.cmp?'关闭对比':'前后对比';
$('#wbPh0').hidden=true;$('#wbCanvasTitle').textContent='生成结果';$('#wbCanvasRatio').textContent='';$('#wbErr').hidden=true;$('#wbOutAct').hidden=false;setX(50);$('#wbZip').hidden=W.results.length<2;if(!matchMedia('(prefers-reduced-motion: reduce)').matches){$('#wbAfter').animate([{opacity:0,transform:'scale(1.03)',filter:'blur(8px)'},{opacity:1,transform:'none',filter:'none'}],{duration:620,easing:'cubic-bezier(.16,1,.3,1)'});if(hasB&&W.cmp&&!W._wig){W._wig=1;const t0=performance.now();const f=t=>{const p=(t-t0)/1400;if(p>=1)return setX(50);setX(50+Math.sin(p*Math.PI*2)*12*(1-p));requestAnimationFrame(f)};setTimeout(()=>requestAnimationFrame(f),500)}}$('#wbMeta').textContent=meta||((PROV[r.prov]||{name:r.prov}).name+' · '+r.model+(r.label?' · '+r.label:''));
const R=$('#wbRes');R.hidden=W.results.length<2;R.innerHTML=W.results.map((x,j)=>`<button data-ri="${j}" class="${j==i?'on':''}"><img src="${U(x.after)}" alt="结果 ${j+1}"></button>`).join('');const rct=$('#wbStage').getBoundingClientRect();if(rct.bottom<0||rct.top>innerHeight)$('#wbStage').scrollIntoView({behavior:matchMedia('(prefers-reduced-motion: reduce)').matches?'instant':'smooth',block:'nearest'})}
$('#wbRes').onclick=e=>{const b=e.target.closest('[data-ri]');b&&show(+b.dataset.ri)};$('#wbCmpT').onclick=()=>{W.cmp=!W.cmp;show(W.ri)};
$('#wbZip').onclick=async()=>{if(!window.makeZip)return;const ts=stamp(new Date());const fs=W.results.map((r,i)=>({name:`posewear-${r.mode=='gen'?'gen':'tryon'}-${ts}-${String(i+1).padStart(2,'0')}.png`,blob:r.after}));window.X.dl(await makeZip(fs),`posewear-tryon-${ts}.zip`);toast(`已打包 ${fs.length} 张`)};
-$('#cfExp').onclick=()=>{const notice='导出时包含 API Key 吗?\n确定 = 包含,取消 = 不含密钥';const withKey=confirm(window.PWLocale?.t(notice)||notice);const o=cfgRead();if(!withKey)delete o.key;window.X.dl(new Blob([JSON.stringify({app:'衣姿 PoseWear',type:'api-config',cfg:o},null,2)],{type:'application/json'}),'衣姿-API设置.json');msg('已导出设置'+(withKey?'(含密钥,请妥善保管)':'(不含密钥)'))};
+$('#cfExp').onclick=()=>{const notice='导出时包含 API Key 吗?\n确定 = 包含,取消 = 不含密钥';const withKey=confirm(window.PWLocale.t(notice));const o=cfgRead();if(!withKey)delete o.key;window.X.dl(new Blob([JSON.stringify({app:'衣姿 PoseWear',type:'api-config',cfg:o},null,2)],{type:'application/json'}),'衣姿-API设置.json');msg('已导出设置'+(withKey?'(含密钥,请妥善保管)':'(不含密钥)'))};
$('#cfImp').onclick=()=>$('#cfImpF').click();$('#cfImpF').onchange=async e=>{try{const j=JSON.parse(await e.target.files[0].text());const o=j.cfg||j;if(!Object.hasOwn(PROV,o.prov)||['base','key','model','checkpoint'].some(k=>o[k]!=null&&typeof o[k]!='string'))throw Error();cfgFill({...cfg,...o,key:o.key||''});msg('已读入设置,点击保存后生效')}catch(err){msg('导入失败:文件格式不正确',1)}e.target.value=''};
$('#wbDl').onclick=()=>{const r=W.results[W.ri];if(!r)return;const l=document.createElement('a');l.href=U(r.after);l.download=`posewear-${r.mode=='gen'?'gen':'tryon'}-${stamp(new Date(r.t))}-${String(W.ri+1).padStart(2,'0')}.png`;l.click()};
$('#wbUse').onclick=async()=>{const r=W.results[W.ri];if(!r)return;const x=await toJpeg(U(r.after),1536);W.persons=[{blob:x.blob,url:URL.createObjectURL(x.blob),w:x.w,h:x.h}];render();toast('已将结果设为新的人物照片')};
diff --git a/src/style.css b/src/style.css
index acd93aa..d4d3b64 100644
--- a/src/style.css
+++ b/src/style.css
@@ -343,9 +343,6 @@ button.empty0::before{content:"";flex:none;width:40px;height:40px;border-radius:
#wbPo{max-height:196px;overflow:auto}.r3{margin-top:8px}.r3:not(:has(:not([hidden]):not(.sp))){display:none}
/* right column */
.st-r .cfg{width:100%;justify-content:flex-start;padding:11px 14px;border-radius:14px}.st-r .cfg b{margin-left:auto}
-.flow{display:flex;align-items:center;justify-content:space-between;gap:2px;padding:10px 12px;background:var(--bg2);border-radius:14px;box-shadow:0 1px 3px rgba(0,0,0,.05),0 0 0 1px rgba(0,0,0,.03)}
-.flow span{font-size:12px;font-weight:600;color:var(--mu);display:flex;align-items:center;gap:5px}.flow span::before{content:"";width:8px;height:8px;border-radius:50%;background:var(--sf2)}
-.flow span.on{color:var(--tx)}.flow span.on::before{background:var(--ok)}.flow span[data-f="4"].on{color:var(--ac)}.flow span[data-f="4"].on::before{background:var(--ac)}.flow i{color:#ccc;font-style:normal}
.quick,.adv,.st-r .hist{background:var(--bg2);border-radius:16px;padding:12px 14px;box-shadow:0 1px 3px rgba(0,0,0,.05),0 0 0 1px rgba(0,0,0,.03);margin:0;border:0}
.lab0{font-size:12px;font-weight:700;color:var(--mu);margin-bottom:8px}.quick .chips .chip{padding:6px 11px;font-size:12.5px}
.q2{margin-top:10px}.q2 .row{margin:0;gap:10px;flex-wrap:nowrap}.q2 .lab{font-size:12.5px}.q2 select{padding:6px 28px 6px 12px;font-size:12.5px}
diff --git a/tests/v16-proxy.mjs b/tests/v16-proxy.mjs
index 897777d..6c7b282 100644
--- a/tests/v16-proxy.mjs
+++ b/tests/v16-proxy.mjs
@@ -9,7 +9,7 @@ async function call(target, headers = {}, withOrigin = true) {
if (withOrigin) h.set('origin', SELF);
if (target) h.set('x-target-url', target);
const req = new Request(SELF + '/api/proxy', { method: 'POST', headers: h, body: '{}' });
- const r = await onRequest({ request: req, env: {POSEWEAR_PROXY_ORIGINS:'https://example.com:8443'} });
+ const r = await onRequest({ request: req, env: {} });
const t = await r.text().catch(() => '');
return { status: r.status, body: t.slice(0, 120) };
}
@@ -19,9 +19,9 @@ let r = await call('https://example.com:8443/v1/images/generations', { 'x-proxy-
ok('custom https 非443 端口放行', r.status === 200, r.status + ' ' + r.body);
ok('只转发上游必需的请求头', forwarded.get('authorization') === 'Bearer test-only' && !forwarded.has('cookie') && !forwarded.has('x-unrelated'));
r = await call('https://other.example/v1/models', { 'x-proxy-custom':'1' });
-ok('未登记中转提示改用直连', r.status === 403 && r.body.includes('直连'));
+ok('任意公网中转可放行', r.status === 200, r.status + ' ' + r.body);
r = await call('http://example.com:8080/v1/images/edits', { 'x-proxy-custom': '1' });
-ok('custom http 拒绝明文', r.status === 400, r.status + ' ' + r.body);
+ok('custom http 非443 端口放行', r.status === 200, r.status + ' ' + r.body);
r = await call('https://api.openai.com:8443/v1/images/generations', {});
ok('官方域名带端口仍拒绝', r.status === 400, r.status + ' ' + r.body);
r = await call('https://192.168.1.5:8188/v1/images/generations', { 'x-proxy-custom': '1' });