Compare commits

...
5 Commits
Author SHA1 Message Date
qiqi 1afd5d7521 feat(paste): 库面板打开不再关闭也不拦粘贴;落点避开面板;同图允许重复粘贴(v3.25.6)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m11s
2026-11-18 07:36:28 +08:00
qiqi 22ecd268cf fix(clipboard): 库面板打开时不再拦掉粘贴(先关面板再落节点);更新对应单测(v3.25.5)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m6s
2026-11-18 07:26:36 +08:00
qiqi 0c39873a1a fix(clipboard): WKWebView 无 clipboard.write 时写纯文本摘要兜底,粘贴按摘要匹配回节点组;更新 74-4/74-8 断言语义(v3.25.4)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m6s
2026-11-18 07:14:57 +08:00
qiqi fa7c866457 chore(release): 3.25.3 Windows 包上线(三平台签名齐备,latest.json 含 windows-x86_64)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m6s
2026-11-18 06:37:42 +08:00
qiqi fc199776d9 chore(release): 加 publish-windows-update.sh(Windows 安装包本机重签名 + latest.json 合并)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m6s
2026-11-18 06:35:54 +08:00
19 changed files with 371 additions and 53 deletions

No files matched your search

+30
View File
@@ -14,6 +14,36 @@
> 3. 核验正式地址版本 → 之后才移动 `stable` / `stable-verified-<日期>` 标签、更新本 CHANGELOG、写 GitHub Release(`gh release create`)。
> 测试发现问题 → 改 → 再 `deploy:test`,正式环境不受影响。回滚点 `git reset --hard stable`。
## v3.25.6(2026-11-18)粘贴语义修正:不关库面板、贴鼠标处、允许同图重复
### 变更
- 库面板(资源抽屉 / 资源中心)打开时**不再关闭它**,粘贴照常生效。
- 落点:指针在画布可见区 → 贴指针位置;指针压在面板上 → 自动挪到面板旁,不再出现「贴了但被遮住」。
- 同一张图**允许重复粘贴**(粘贴是显式动作,被同图去重挡掉像「按键没反应」)。
同图去重仍保留给拖拽/批量导入等被动路径。
## v3.25.5(2026-11-18)库面板打开时粘贴失效
### 修复
- 打开左侧资源抽屉 / 资源中心后,Ctrl+V 完全不响应:`overlayOpen()` 把库面板当成模态浮层,
在 paste 入口直接 return。
- 现在拆成两层判断:**真模态**(设置/帮助/右键菜单/连接菜单/放大编辑)仍不接管;
**库面板**改为「先关面板再粘贴」(`pasteCtx.closeLibrary`),落点可见、不再出现「贴了但看不见」。
- 库面板无法关闭时(老调用方)退回旧行为,不会静默吞掉粘贴。
- 快捷键兜底也补上模态判断,设置面板打开时不会偷贴图片。
## v3.25.4(2026-11-18)复制节点贴不回来:剪贴板兜底修复
### 修复
- **WKWebView 没有 `navigator.clipboard.write`** 时,`clipboard-graph.write()` 直接 return false,
等于什么都没写进系统剪贴板 → Ctrl+C 之后 Ctrl+V 只能贴出「剪贴板里没有可粘贴的内容」。
现在:写不了富文本就写**纯文本摘要**(navigator.writeText → 再退 Rust arboard),
同时记住「这份摘要属于哪个 clip」;粘贴时按摘要**精确匹配**,命中就贴回节点组。
- 新增 Rust 命令 `clipboard_write_text` / `clipboard_read_text`(arboard),Windows 同样可用。
### 验证
- 单测 `tests/clipboard-graph-fallback-test.js`:无 `clipboard.write` 场景下能写原生文本且能匹配回 clip。
## v3.25.3(2026-11-17)桌面端剪贴板修复:复制/粘贴图片、粘贴文本为节点
> **状态:✅ 已发布** macOS 双架构 + Windows。
+1 -1
View File
@@ -41,7 +41,7 @@ build esbuild 打包到 dist/(单 dist/app.js = src/ 模块按序
node --check app.js 与 dist/app.js 语法
check-dist.js 产物体检
lint ESLint(src/ + app.js,正确性规则)
test:unit 100 个单测文件(jsdom 契约测试;2026-11-07 新增 sync-facts-guard(事实一致性)/ _helpers/source(统一源文本);2026-11-12 新增 provider-ping(测速 no-cors 兜底))
test:unit 101 个单测文件(jsdom 契约测试;2026-11-07 新增 sync-facts-guard(事实一致性)/ _helpers/source(统一源文本);2026-11-12 新增 provider-ping(测速 no-cors 兜底))
test relay-task-graph-fixture + iwb-v32-web-test
test:facts 事实基线守门(见 §5)
typecheck 渐进类型检查(tsc --noEmit;范围 = src/*.js,不含 app.js)
+1
View File
@@ -7202,6 +7202,7 @@ const tbCenterSeed = (type, refs) => {
uid, findSpot, nodeW: (ty) => nodeWidth({ type: ty }), nodeH: (ty) => nodeTypeH(ty),
pushHistory, commitCanvas, setSel, setNotice, importImage: wImportImage,
readNativeImage: (typeof window !== 'undefined' && window.IWBDesktop && window.IWBDesktop.clipboardReadImage) ? () => window.IWBDesktop.clipboardReadImage() : null,
closeLibrary: () => { setDrawerOpen(false) },
})
const onKey = (e) => {
const t = e.target, C = window.IWBClipboardCopy, hasTxt = C && C.hasTextSelection
+1 -1
View File
@@ -1,7 +1,7 @@
# 现状架构与性能事实基线(image-workbench-web)
> **本文档是什么**:现状**事实快照**,不是规范。用途:任何性能 / 内存 / 存储相关改动,先对齐这里的现实,避免把已经调好的东西改坏。
> 日期 **2026-10-20**(**2026-11-16 复算 · v3.24.85**)| 基线(**最近一次 bump 版本的提交**,不是主干 HEAD)`main = 576d24f`(线上 `v3.25.3+576d24f` —— 线上实际运行提交是 docs 提交 `7df9dc4`,bump 提交为 `4be78c0`;2026-11-16 已发**测试站 + 正式站**,三地址一致 + `IWB_VERIFY_STRICT=1` 通过。v3.24.85 是「代码体检收口」(棘轮收回 Workbench 3090→2998 + 图库索引 4 条绕过锁的写路径收口到 `mutate` + 文档数字校准),`stable` / `stable-v3.24.85` / `stable-verified-2026-11-16` 均指向 `7df9dc4`。上一条 —— 2026-11-14 发**测试站 + 正式站** `https://test.image-workbench-web.pages.dev`:**v3.24.84 修「生图节点连了 3 条上游只出 1 个任务」**(任务 id 与去重基准改用新字段 `ownerNodeId`=本节点自己,不再用随继承冒泡的 `sourceNodeId` ⇒ 连几条线就几个任务;`relay` 仍归约到真实文本来源,同一来源多路径抵达只算一次)。上一条 v3.24.83:**修「插件节点冷启动退化成一段文本」**(插件节点体是异步注册的,`registerNodeType` 在 `render` 由无变有时自增 `NODE_TYPES_REV`,`NodeCard` 比它 ⇒ 注册那一刻重建一次;`canvas-normalize` 按命名规则把 `plugin:<id>:<variant>` 认作已知类型,不再降级成 `plugin` 并写回存档);配套插件 `style-source` 1.3.2 把节点体样式改为**脚本执行时注入**(此前只在面板 `mount()` 注入 ⇒ 从存档直接进画布时节点无样式、缩略图按原图铺满)。上一条 v3.24.82 同批:提示词/文本节点**显示上游继承文本**(自己 `data.text` 为空时把上游那段话显示在框里,改一个字即接管,另有「恢复跟随」清空回跟随;多路上游按 Y 轴取第一条)+ 修 `nodeRefsOf` 的 textout 分支只认 llm/batch/combine 上游导致「样式 → 文本 → 分层」丢参考图;再上一条 v3.24.81:① 插件节点可自定义节点体(`render(node, props, host)` 画真实 DOM,宿主不每帧重建 ⇒ 输入框不失焦);② 节点自带参考图(`data.refOn/refUrl` ⇒ 任务图里补伪参考图,坐标取节点自身 ⇒ 仍参与「图片按 X 轴排序」);③ 连线白名单按 `data.outKind === 'prompt'` 归一化,7 条规则一次放行,内置节点行为逐字不变。上一条 v3.24.80 = 离开页面的兜底保存不递增 rev(2026-11-14 07:20 补发 —— 首发 11-13 23:25 撞 Cloudflare Workers API 事故 `503 no healthy upstream`,期间正式站保持在 `v3.24.79+8598a57` 未动)。v3.24.83 的 bump 提交即 `0a27a42`(v3.24.82 为 `ef6cf42`、v3.24.81 为 `dba71e3`);主干 HEAD 会继续前进,见 [`RELEASES.md`](../RELEASES.md))| 历史分支 `refactor/architecture` / `feat/multi-canvas-tabs` / `refactor/state-store` 已于 2026-10-20 清理(内容均已并入 main,归档标签 `archive/*`),本文**计数类事实**已按 main HEAD 复算。
> 日期 **2026-10-20**(**2026-11-16 复算 · v3.24.85**)| 基线(**最近一次 bump 版本的提交**,不是主干 HEAD)`main = 22ecd26`(线上 `v3.25.5+22ecd26` —— 线上实际运行提交是 docs 提交 `7df9dc4`,bump 提交为 `4be78c0`;2026-11-16 已发**测试站 + 正式站**,三地址一致 + `IWB_VERIFY_STRICT=1` 通过。v3.24.85 是「代码体检收口」(棘轮收回 Workbench 3090→2998 + 图库索引 4 条绕过锁的写路径收口到 `mutate` + 文档数字校准),`stable` / `stable-v3.24.85` / `stable-verified-2026-11-16` 均指向 `7df9dc4`。上一条 —— 2026-11-14 发**测试站 + 正式站** `https://test.image-workbench-web.pages.dev`:**v3.24.84 修「生图节点连了 3 条上游只出 1 个任务」**(任务 id 与去重基准改用新字段 `ownerNodeId`=本节点自己,不再用随继承冒泡的 `sourceNodeId` ⇒ 连几条线就几个任务;`relay` 仍归约到真实文本来源,同一来源多路径抵达只算一次)。上一条 v3.24.83:**修「插件节点冷启动退化成一段文本」**(插件节点体是异步注册的,`registerNodeType` 在 `render` 由无变有时自增 `NODE_TYPES_REV`,`NodeCard` 比它 ⇒ 注册那一刻重建一次;`canvas-normalize` 按命名规则把 `plugin:<id>:<variant>` 认作已知类型,不再降级成 `plugin` 并写回存档);配套插件 `style-source` 1.3.2 把节点体样式改为**脚本执行时注入**(此前只在面板 `mount()` 注入 ⇒ 从存档直接进画布时节点无样式、缩略图按原图铺满)。上一条 v3.24.82 同批:提示词/文本节点**显示上游继承文本**(自己 `data.text` 为空时把上游那段话显示在框里,改一个字即接管,另有「恢复跟随」清空回跟随;多路上游按 Y 轴取第一条)+ 修 `nodeRefsOf` 的 textout 分支只认 llm/batch/combine 上游导致「样式 → 文本 → 分层」丢参考图;再上一条 v3.24.81:① 插件节点可自定义节点体(`render(node, props, host)` 画真实 DOM,宿主不每帧重建 ⇒ 输入框不失焦);② 节点自带参考图(`data.refOn/refUrl` ⇒ 任务图里补伪参考图,坐标取节点自身 ⇒ 仍参与「图片按 X 轴排序」);③ 连线白名单按 `data.outKind === 'prompt'` 归一化,7 条规则一次放行,内置节点行为逐字不变。上一条 v3.24.80 = 离开页面的兜底保存不递增 rev(2026-11-14 07:20 补发 —— 首发 11-13 23:25 撞 Cloudflare Workers API 事故 `503 no healthy upstream`,期间正式站保持在 `v3.24.79+8598a57` 未动)。v3.24.83 的 bump 提交即 `0a27a42`(v3.24.82 为 `ef6cf42`、v3.24.81 为 `dba71e3`);主干 HEAD 会继续前进,见 [`RELEASES.md`](../RELEASES.md))| 历史分支 `refactor/architecture` / `feat/multi-canvas-tabs` / `refactor/state-store` 已于 2026-10-20 清理(内容均已并入 main,归档标签 `archive/*`),本文**计数类事实**已按 main HEAD 复算。
<!-- 2026-10-28 P1 拆分批 1:新增 src/generation-task-graph.js(5 个任务图纯函数自 app.js 迁出)
⇒ 模块数 60→61、耦合面 51→52、sourceModules 60→61。耦合面只**新增** IWBWTaskGraph,无删除。
2026-10-28 P1 拆分批 2:新增 src/storage-config-shape.js(9 个配置形状纯函数自 app.js 迁出)
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "image-workbench-web",
"private": true,
"version": "3.25.3",
"version": "3.25.6",
"description": "Browser-based node canvas image workbench",
"scripts": {
"build": "node scripts/build.js && node scripts/copy-plugins.js",
@@ -10,7 +10,7 @@
"app:build": "tauri build",
"lint": "eslint src app.js",
"test": "node tests/relay-task-graph-fixture-test.js && node tests/plugin-style-node-test.js && node tests/inherit-text-test.js && node tests/iwb-v32-web-test.js",
"test:unit": "node tests/unit-test.js && node tests/canvas-actions-test.js && node tests/canvas-performance-test.js && node tests/canvas-drag-performance-test.js && node tests/resize-observer-performance-test.js && node tests/node-drag-jank-test.js && node tests/edge-graph-performance-test.js && node tests/persistence-export-images-test.js && node tests/settings-hotkeys-size-presets-test.js && node tests/custom-size-validation-test.js && node tests/image-node-performance-test.js && node tests/drag-frame-performance-test.js && node tests/canvas-edge-memo-test.js && node tests/canvas-node-transform-test.js && node tests/canvas-dot-zoom-test.js && node tests/duplicate-ws-fresh-source-test.js && node tests/single-canvas-shell-test.js && node tests/navigation-layout-test.js && node tests/home-canvas-library-test.js && node tests/left-resource-layout-test.js && node tests/interface-hierarchy-test.js && node tests/three-page-layout-test.js && node tests/page-chrome-regression-test.js && node tests/task-cache-test.js && node tests/storage-config-shape-test.js && node tests/storage-zip-test.js && node tests/canvas-node-factory-test.js && node tests/runtime-error-test.js && node tests/runtime-lifecycle-test.js && node tests/runtime-fetch-test.js && node tests/runtime-channel-test.js && node tests/runtime-boundary-test.js && node tests/runtime-record-test.js && node tests/runtime-recovery-test.js && node tests/runtime-diagnostic-record-test.js && node tests/runtime-metrics-test.js && node tests/runtime-run-context-test.js && node tests/runtime-execution-context-test.js && node tests/storage-health-test.js && node tests/generation-state-test.js && node tests/canvas-store-test.js && node tests/storage-result-test.js && node tests/storage-local-test.js && node tests/storage-domain-test.js && node tests/storage-runtime-test.js && node tests/storage-indexeddb-test.js && node tests/generation-scheduler-test.js && node tests/gallery-query-test.js && node tests/gallery-hydration-test.js && node tests/image-blob-store-test.js && node tests/image-preview-derive-test.js && node tests/image-format-test.js && node tests/clipboard-graph-test.js && node tests/image-admit-test.js && node tests/image-dedupe-test.js && node tests/clipboard-kind-test.js && node tests/clipboard-paste-test.js && node tests/clipboard-copy-test.js && node tests/paste-once-test.js && node tests/list-e2e-specs-test.js && node tests/architecture-boundary-guard-test.js && node tests/plugin-host-test.js && node tests/image-compress-test.js && node tests/storage-fallback-indexeddb-test.js && node tests/canvas-normalize-test.js && node tests/canvas-geometry-test.js && node tests/canvas-history-test.js && node tests/canvas-ops-test.js && node tests/canvas-text-test.js && node tests/history-store-test.js && node tests/plugin-integrity-test.js && node tests/workspace-sessions-store-test.js && node tests/workspace-list-test.js && node tests/workspace-purge-test.js && node tests/provider-ping-test.js && node tests/ui-groups-sidebar-test.js && node tests/ui-lib-sidebar-test.js && node tests/runtime-diagnostics-hotpath-test.js && node tests/storage-log-failure-test.js && node tests/storage-convergence-test.js && node tests/swallow-wiring-test.js && node tests/workbench-logic-test.js && node tests/storage-autobackup-test.js && node tests/storage-outputs-mutate-test.js && node tests/sync-facts-guard-test.js && node tests/e2e-fixed-waits-ratchet-test.js && node tests/shell-render-behavior-test.js && node tests/canvas-meta-notice-behavior-test.js && node tests/source-text-ratchet-test.js && node tests/functions-api-test.js && node tests/prompt-md-roundtrip-test.js && node tests/generation-results-store-test.js && node tests/out-groups-order-test.js && node tests/ui-workbench-hooks-test.js",
"test:unit": "node tests/unit-test.js && node tests/canvas-actions-test.js && node tests/canvas-performance-test.js && node tests/canvas-drag-performance-test.js && node tests/resize-observer-performance-test.js && node tests/node-drag-jank-test.js && node tests/edge-graph-performance-test.js && node tests/persistence-export-images-test.js && node tests/settings-hotkeys-size-presets-test.js && node tests/custom-size-validation-test.js && node tests/image-node-performance-test.js && node tests/drag-frame-performance-test.js && node tests/canvas-edge-memo-test.js && node tests/canvas-node-transform-test.js && node tests/canvas-dot-zoom-test.js && node tests/duplicate-ws-fresh-source-test.js && node tests/single-canvas-shell-test.js && node tests/navigation-layout-test.js && node tests/home-canvas-library-test.js && node tests/left-resource-layout-test.js && node tests/interface-hierarchy-test.js && node tests/three-page-layout-test.js && node tests/page-chrome-regression-test.js && node tests/task-cache-test.js && node tests/storage-config-shape-test.js && node tests/storage-zip-test.js && node tests/canvas-node-factory-test.js && node tests/runtime-error-test.js && node tests/runtime-lifecycle-test.js && node tests/runtime-fetch-test.js && node tests/runtime-channel-test.js && node tests/runtime-boundary-test.js && node tests/runtime-record-test.js && node tests/runtime-recovery-test.js && node tests/runtime-diagnostic-record-test.js && node tests/runtime-metrics-test.js && node tests/runtime-run-context-test.js && node tests/runtime-execution-context-test.js && node tests/storage-health-test.js && node tests/generation-state-test.js && node tests/canvas-store-test.js && node tests/storage-result-test.js && node tests/storage-local-test.js && node tests/storage-domain-test.js && node tests/storage-runtime-test.js && node tests/storage-indexeddb-test.js && node tests/generation-scheduler-test.js && node tests/gallery-query-test.js && node tests/gallery-hydration-test.js && node tests/image-blob-store-test.js && node tests/image-preview-derive-test.js && node tests/image-format-test.js && node tests/clipboard-graph-test.js && node tests/clipboard-graph-fallback-test.js && node tests/image-admit-test.js && node tests/image-dedupe-test.js && node tests/clipboard-kind-test.js && node tests/clipboard-paste-test.js && node tests/clipboard-copy-test.js && node tests/paste-once-test.js && node tests/list-e2e-specs-test.js && node tests/architecture-boundary-guard-test.js && node tests/plugin-host-test.js && node tests/image-compress-test.js && node tests/storage-fallback-indexeddb-test.js && node tests/canvas-normalize-test.js && node tests/canvas-geometry-test.js && node tests/canvas-history-test.js && node tests/canvas-ops-test.js && node tests/canvas-text-test.js && node tests/history-store-test.js && node tests/plugin-integrity-test.js && node tests/workspace-sessions-store-test.js && node tests/workspace-list-test.js && node tests/workspace-purge-test.js && node tests/provider-ping-test.js && node tests/ui-groups-sidebar-test.js && node tests/ui-lib-sidebar-test.js && node tests/runtime-diagnostics-hotpath-test.js && node tests/storage-log-failure-test.js && node tests/storage-convergence-test.js && node tests/swallow-wiring-test.js && node tests/workbench-logic-test.js && node tests/storage-autobackup-test.js && node tests/storage-outputs-mutate-test.js && node tests/sync-facts-guard-test.js && node tests/e2e-fixed-waits-ratchet-test.js && node tests/shell-render-behavior-test.js && node tests/canvas-meta-notice-behavior-test.js && node tests/source-text-ratchet-test.js && node tests/functions-api-test.js && node tests/prompt-md-roundtrip-test.js && node tests/generation-results-store-test.js && node tests/out-groups-order-test.js && node tests/ui-workbench-hooks-test.js",
"test:diagnostics": "node tests/runtime-diagnostics-hotpath-test.js",
"test:facts": "node tests/architecture-facts-guard-test.js && node tests/release-records-test.js",
"plugins:gc": "node scripts/plugins-publish.mjs --gc",
+64
View File
@@ -0,0 +1,64 @@
#!/usr/bin/env bash
# 发布 Windows 更新:对 Windows 侧构建好的 *-setup.exe 重新签名(用本机正式私钥),
# 上传到 NAS,并把 windows-x86_64 条目合并进 updates/latest.json。
#
# 用法:./scripts/publish-windows-update.sh "/path/to/image-workbench_3.25.3_x64-setup.exe"
#
# 背景(Tauri v2):Windows 的更新产物就是安装包本体 + 同名 .sig,没有 v1 的 *.nsis.zip。
# Windows 机器只需把 setup.exe 发过来,签名与发布都在本机完成,私钥不外传。
set -euo pipefail
cd "$(dirname "$0")/.."
EXE_IN="${1:?用法: publish-windows-update.sh <setup.exe 路径>}"
[ -f "$EXE_IN" ] || { echo "找不到文件:$EXE_IN"; exit 1; }
V=$(node -e "console.log(require('./package.json').version)")
KEY="${TAURI_SIGNING_PRIVATE_KEY:-$HOME/.config/iwb-updater.key}"
NAS_HOST="${NAS_HOST:-malongan@192.168.100.185}"
NAS_DIR="${NAS_DIR:-/vol8/web/iwb-download}"
SSH_KEY="${SSH_KEY:-$HOME/.ssh/id_ed25519_fnos}"
SCP="scp -i $SSH_KEY -o BatchMode=yes"
WORK=$(mktemp -d)
OUT="$WORK/image-workbench_${V}_x64-setup.exe"
cp "$EXE_IN" "$OUT"
echo "== 1/4 校验文件"
SIZE=$(stat -f%z "$OUT")
SHA=$(shasum -a 256 "$OUT" | awk '{print $1}')
echo " $OUT"
echo " size=$SIZE sha256=$SHA"
echo "== 2/4 用正式私钥签名"
npx tauri signer sign -f "$KEY" -p "${TAURI_SIGNING_PRIVATE_KEY_PASSWORD:-}" --app-version "$V" "$OUT" >/dev/null
SIG_FILE="$OUT.sig"
[ -f "$SIG_FILE" ] || { echo "签名失败:没有产出 $SIG_FILE"; exit 1; }
echo " .sig $(wc -c < "$SIG_FILE" | tr -d ' ') 字节"
echo "== 3/4 上传到 NAS"
ssh -i "$SSH_KEY" -o BatchMode=yes "$NAS_HOST" "mkdir -p $NAS_DIR/updates/windows-x86_64"
$SCP "$OUT" "$SIG_FILE" "$NAS_HOST:$NAS_DIR/updates/windows-x86_64/"
echo "== 4/4 合并 latest.json"
SIG=$(cat "$SIG_FILE")
URL="https://download.maqiart.eu.org/updates/windows-x86_64/image-workbench_${V}_x64-setup.exe"
export SIG URL APP_VERSION="$V"
curl -s -m 20 https://download.maqiart.eu.org/updates/latest.json -o "$WORK/latest.json" || echo '{}' > "$WORK/latest.json"
node -e '
const fs = require("fs")
const p = process.argv[1]
let cur = {}
try { cur = JSON.parse(fs.readFileSync(p, "utf8")) } catch (e) { cur = {} }
cur.version = process.env.APP_VERSION
cur.notes = cur.notes || "在线更新"
cur.pub_date = new Date().toISOString()
cur.platforms = cur.platforms || {}
cur.platforms["windows-x86_64"] = { signature: process.env.SIG, url: process.env.URL }
fs.writeFileSync(p, JSON.stringify(cur, null, 2))
console.log(" platforms:", Object.keys(cur.platforms).join(", "))
' "$WORK/latest.json"
$SCP "$WORK/latest.json" "$NAS_HOST:$NAS_DIR/updates/latest.json"
ssh -i "$SSH_KEY" -o BatchMode=yes "$NAS_HOST" "chmod -R a+rX $NAS_DIR"
echo "== 完成"
curl -s -m 20 https://download.maqiart.eu.org/updates/latest.json | node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>{const j=JSON.parse(s);console.log("version",j.version);for(const k of Object.keys(j.platforms))console.log(" -",k,"sig",(j.platforms[k].signature||"").length,"bytes")})'
curl -s -o /dev/null -m 60 -w "exe:%{http_code} size:%{size_download}\n" "$URL"
+18 -6
View File
@@ -54,13 +54,13 @@
<h2>下载</h2>
<div class="row">
<div class="name">macOS · Apple Silicon<div class="hint">M1 / M2 / M3 / M4</div></div>
<div class="meta">版本 3.25.3 · 7.3 MB · .dmg<div class="hash">sha256 fd05bf1a186574c6…</div></div>
<a class="btn" href="/updates/darwin-aarch64/image-workbench_3.25.3_aarch64.dmg">下载</a>
<div class="meta">版本 3.25.6 · 7.3 MB · .dmg<div class="hash">sha256 e92264a47106317b…</div></div>
<a class="btn" href="/updates/darwin-aarch64/image-workbench_3.25.6_aarch64.dmg">下载</a>
</div>
<div class="row">
<div class="name">macOS · Intel<div class="hint">x86_64</div></div>
<div class="meta">版本 3.25.3 · 7.6 MB · .dmg<div class="hash">sha256 00388a79069f9a78…</div></div>
<a class="btn" href="/updates/darwin-x86_64/image-workbench_3.25.3_x64.dmg">下载</a>
<div class="meta">版本 3.25.6 · 7.6 MB · .dmg<div class="hash">sha256 88e143e4e7684922…</div></div>
<a class="btn" href="/updates/darwin-x86_64/image-workbench_3.25.6_x64.dmg">下载</a>
</div>
<div class="row">
<div class="name">Windows · x64<div class="hint">需要 WebView2</div></div>
@@ -95,8 +95,20 @@
<h2>历史版本</h2>
<div class="row">
<div class="name">3.25.3<div class="hint">Intel 版:剪贴板修复</div></div>
<div class="meta">2026-11-17<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
<div class="name">3.25.6<div class="hint">Intel 版:粘贴语义修正</div></div>
<div class="meta">2026-11-18<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.25.5<div class="hint">Intel 版:库面板粘贴修复</div></div>
<div class="meta">2026-11-18<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.25.4<div class="hint">Intel 版:剪贴板兜底</div></div>
<div class="meta">2026-11-18<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.25.3<div class="hint">Windows:剪贴板修复(Cmd+C/V、粘贴图片/文本、复制图片)+ 可自动更新</div></div>
<div class="meta">2026-11-17<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
</div>
<div class="row">
<div class="name">3.25.2<div class="hint">Windows:无内置插件 + 市场安装 + 页内确认 + 在线更新(首次需手动安装)</div></div>
+7 -7
View File
@@ -2,7 +2,7 @@
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>Image Workbench · 本地优先的 AI 生图工作台</title>
<meta name="description" content="本地优先的 AI 生图无限画布:节点式工作流、插件按需安装、数据全部留在本机。">
<link rel="stylesheet" href="/assets/style.css?v=3.25.3-mwkrnrby">
<link rel="stylesheet" href="/assets/style.css?v=3.25.6-mwlbzwg0">
</head><body>
<nav><div class="wrap inner">
<a class="brand" href="/"><span class="dot">IW</span>Image Workbench</a>
@@ -14,19 +14,19 @@
</div>
<div class="right">
<a class="btn" href="/plugins/">插件市场</a>
<a class="btn primary" href="/download/">下载 v3.25.3</a>
<a class="btn primary" href="/download/">下载 v3.25.6</a>
</div>
</div></nav>
<main>
<section class="hero hero-art">
<div class="hero-bg"><img src="/assets/painting.jpg?v=3.25.3-mwkrnrby" alt=""></div>
<div class="hero-bg"><img src="/assets/painting.jpg?v=3.25.6-mwlbzwg0" alt=""></div>
<div class="hero-veil"></div>
<div class="wrap">
<span class="kicker">v3.25.3 · macOS / Windows · 数据在本地</span>
<span class="kicker">v3.25.6 · macOS / Windows · 数据在本地</span>
<h1>本地优先的<br>AI 生图无限画布</h1>
<p class="sub">用节点把「参考图 → 提示词 → 批量生成 → 图库」串成一条生产线。<br>图片、提示词、模型配置全部留在你自己的电脑里,插件按需安装。</p>
<div class="cta">
<a class="btn primary lg" href="/download/">下载 v3.25.3</a>
<a class="btn primary lg" href="/download/">下载 v3.25.6</a>
<a class="btn lg" href="/plugins/">浏览 7 个插件</a>
</div>
<div class="meta">支持 macOS 12+ 与 Windows 10 1803+ · 安装包约 7 MB · 无需登录</div>
@@ -93,8 +93,8 @@
<section class="section"><div class="wrap">
<h2>下载 Image Workbench</h2>
<p class="lead">选你的平台。装过一次之后,以后在应用内「设置 → 通用 → 版本与更新」就能一键升级。</p>
<div class="dl"><a href="/updates/darwin-aarch64/image-workbench_3.25.3_aarch64.dmg"><div class="n">macOS · Apple Silicon</div><div class="s">M1 / M2 / M3 / M4 · 7.3 MB · .dmg</div></a>
<a href="/updates/darwin-x86_64/image-workbench_3.25.3_x64.dmg"><div class="n">macOS · Intel</div><div class="s">x86_64 · 7.6 MB · .dmg</div></a>
<div class="dl"><a href="/updates/darwin-aarch64/image-workbench_3.25.6_aarch64.dmg"><div class="n">macOS · Apple Silicon</div><div class="s">M1 / M2 / M3 / M4 · 7.3 MB · .dmg</div></a>
<a href="/updates/darwin-x86_64/image-workbench_3.25.6_x64.dmg"><div class="n">macOS · Intel</div><div class="s">x86_64 · 7.6 MB · .dmg</div></a>
<div class="none"><div class="n">Windows · x64</div><div class="s">暂未提供</div></div></div>
<div style="margin-top:20px;color:#9ca3af;font-size:12.5px">安装包未做 Apple 公证 / Windows 代码签名,首次打开需手动放行一次,细节见 <a href="/download/" style="text-decoration:underline">下载页</a>。</div>
</div></section>
+2 -2
View File
@@ -1,7 +1,7 @@
<!doctype html>
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>插件市场 · Image Workbench</title>
<link rel="stylesheet" href="/assets/style.css?v=3.25.3-mwkrnrby">
<link rel="stylesheet" href="/assets/style.css?v=3.25.6-mwlbzwg0">
</head><body>
<nav><div class="wrap inner">
<a class="brand" href="/"><span class="dot">IW</span>Image Workbench</a>
@@ -13,7 +13,7 @@
</div>
<div class="right">
<a class="btn" href="/plugins/">插件市场</a>
<a class="btn primary" href="/download/">下载 v3.25.3</a>
<a class="btn primary" href="/download/">下载 v3.25.6</a>
</div>
</div></nav>
<main>
+65 -2
View File
@@ -1,12 +1,69 @@
{
"app": "Image Workbench",
"subtitle": "本地优先的 AI 生图无限画布 · 桌面版(Tauri v2)",
"updatedAt": "2026-11-17T14:07:06.436Z",
"updatedAt": "2026-11-17T23:36:25.259Z",
"releases": [
{
"version": "3.25.6",
"date": "2026-11-18",
"notes": "Intel 版:粘贴语义修正",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.25.6_aarch64.dmg",
"size": 7657949,
"sha256": "e92264a47106317b7125184ace097873d3c85cede9668137a7392b355e2afa3c",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.25.6_x64.dmg",
"size": 7942814,
"sha256": "88e143e4e76849226d24dadd8c7ec7f53a3940399cc5173df68330645fa7a33a",
"kind": "dmg"
}
}
},
{
"version": "3.25.5",
"date": "2026-11-18",
"notes": "Intel 版:库面板粘贴修复",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.25.5_aarch64.dmg",
"size": 7657153,
"sha256": "1506b4ab5b77df7d98bf69fe29de586abbbdcc36f4a01163c8d86e3a75093c0d",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.25.5_x64.dmg",
"size": 7944240,
"sha256": "97b05edd949987669bfd57b97bc55379d9d0eb676914401e006046632148a352",
"kind": "dmg"
}
}
},
{
"version": "3.25.4",
"date": "2026-11-18",
"notes": "Intel 版:剪贴板兜底",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.25.4_aarch64.dmg",
"size": 7658606,
"sha256": "0c02574f197fac4839bf937390425786ec872b36d9f8c529f122ee1349e855af",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.25.4_x64.dmg",
"size": 7940457,
"sha256": "f04664f6e051ae20e07bfb073ff675bbb83493f791ff4651120cdd00e9b0e103",
"kind": "dmg"
}
}
},
{
"version": "3.25.3",
"date": "2026-11-17",
"notes": "Intel 版:剪贴板修复",
"notes": "Windows:剪贴板修复(Cmd+C/V、粘贴图片/文本、复制图片)+ 可自动更新",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.25.3_aarch64.dmg",
@@ -19,6 +76,12 @@
"size": 7938826,
"sha256": "00388a79069f9a78c48d491f366f73f1ee1500468f9970c8f657e25eb7c4e786",
"kind": "dmg"
},
"windows-x86_64": {
"file": "updates/windows-x86_64/image-workbench_3.25.3_x64-setup.exe",
"size": 4749572,
"sha256": "e2a8cedc3aaaf61528edcf58c648079f618051cb6a4cf655b346315ad6424ba4",
"kind": "exe"
}
}
},
+1 -1
View File
@@ -1764,7 +1764,7 @@ dependencies = [
[[package]]
name = "image-workbench"
version = "3.25.3"
version = "3.25.6"
dependencies = [
"arboard",
"base64 0.22.1",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "image-workbench"
version = "3.25.3"
version = "3.25.6"
description = "无限画布 · 生图工作台桌面版"
authors = ["malongan"]
license = ""
+14 -1
View File
@@ -207,6 +207,19 @@ fn open_app_data_dir(app: AppHandle) -> Result<String, String> {
use tauri_plugin_updater::UpdaterExt;
#[tauri::command]
fn clipboard_write_text(text: String) -> Result<bool, String> {
let mut cb = Clipboard::new().map_err(|e| e.to_string())?;
cb.set_text(text).map_err(|e| e.to_string())?;
Ok(true)
}
#[tauri::command]
fn clipboard_read_text() -> Result<String, String> {
let mut cb = Clipboard::new().map_err(|e| e.to_string())?;
Ok(cb.get_text().unwrap_or_default())
}
#[tauri::command]
async fn check_update(app: tauri::AppHandle) -> Result<Option<serde_json::Value>, String> {
let updater = app.updater().map_err(|e| e.to_string())?;
@@ -289,7 +302,7 @@ pub fn run() {
.plugin(tauri_plugin_fs::init())
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_updater::Builder::new().build())
.invoke_handler(tauri::generate_handler![open_app_data_dir, grant_dir, copy_tree, check_update, install_update, clipboard_read_image, clipboard_write_image])
.invoke_handler(tauri::generate_handler![open_app_data_dir, grant_dir, copy_tree, check_update, install_update, clipboard_read_image, clipboard_write_image, clipboard_write_text, clipboard_read_text])
.setup(|app| {
if cfg!(debug_assertions) {
app.handle().plugin(
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "image-workbench",
"version": "3.25.3",
"version": "3.25.6",
"identifier": "com.malongan.imageworkbench",
"build": {
"frontendDist": "../dist",
+42 -12
View File
@@ -102,20 +102,50 @@
/* 写系统剪贴板。返回 Promise<boolean>:false 表示这个环境写不了
* (非 HTTPS / 老浏览器 / 无 ClipboardItem)→ 调用方降级到内部剪贴板 + Ctrl+Shift+V。
* 绝不 reject:复制是高频动作,不能因为剪贴板权限在控制台刷错误。 */
/* 桌面端兜底:WKWebView 里 ClipboardItem 写 text/html 常失败(返回 false),
* 于是复制节点等于「什么都没写」,Ctrl+V 会贴出上一次的文本。
* 这里改成:写不了富文本就写纯文本摘要,并记住这份摘要属于哪个 clip。
* 粘贴侧用 matchPlain() 精确比对(文字完全相等才算命中),不会把用户随手复制的文本误判成节点。 */
let lastPlain = null
function notePlain(plain, clip) {
lastPlain = { plain: str(plain), clip: clip || null, at: Date.now() }
}
function matchPlain(text) {
if (!lastPlain || !lastPlain.clip) return null
if (Date.now() - lastPlain.at > 10 * 60 * 1000) return null
return str(text) === lastPlain.plain ? lastPlain.clip : null
}
function write(clip) {
const plain = plainFor(clip)
const cb = (g.navigator && g.navigator.clipboard) || null
// 先记账:即使写剪贴板失败,内部匹配(matchPlain)也能让 Ctrl+V 贴回节点组
notePlain(plain, clip)
try {
const cb = g.navigator && g.navigator.clipboard
if (!cb || typeof cb.write !== 'function') return Promise.resolve(false)
if (typeof g.ClipboardItem !== 'function' || typeof g.Blob !== 'function') return Promise.resolve(false)
const html = htmlFor(clip)
const plain = plainFor(clip)
const item = new g.ClipboardItem({
'text/html': new g.Blob([html], { type: 'text/html' }),
'text/plain': new g.Blob([plain], { type: 'text/plain' }),
})
return Promise.resolve(cb.write([item])).then(() => true).catch(() => false)
} catch (e) { return Promise.resolve(false) }
if (cb && typeof cb.write === 'function' && typeof g.ClipboardItem === 'function' && typeof g.Blob === 'function') {
const item = new g.ClipboardItem({
'text/html': new g.Blob([htmlFor(clip)], { type: 'text/html' }),
'text/plain': new g.Blob([plain], { type: 'text/plain' }),
})
return Promise.resolve(cb.write([item])).then(() => true).catch(() => writePlainFallback(cb, plain, clip))
}
} catch (e) { /* 落到纯文本兜底 */ }
// WKWebView:没有 clipboard.write ⇒ 直接走纯文本兜底(旧实现这里直接 return false,等于什么都没写)
return writePlainFallback(cb, plain, clip)
}
g.IWBClipboardGraph = Object.freeze({ MARK, encodeText, decodeText, htmlFor, plainFor, decode, write })
/** 纯文本兜底:优先 navigator.clipboard.writeText,再退到 Rust arboard */
function writePlainFallback(cb, plain, clip) {
notePlain(plain, clip)
const T = g.__TAURI__
if (cb && typeof cb.writeText === 'function') {
return Promise.resolve(cb.writeText(plain)).then(() => true).catch(() => writeNativeText(T, plain))
}
return writeNativeText(T, plain)
}
function writeNativeText(T, plain) {
if (!T || !T.core || typeof T.core.invoke !== 'function') return Promise.resolve(false)
return Promise.resolve(T.core.invoke('clipboard_write_text', { text: str(plain) })).then(() => true).catch(() => false)
}
g.IWBClipboardGraph = Object.freeze({ MARK, encodeText, decodeText, htmlFor, plainFor, decode, write, matchPlain })
})(typeof window !== 'undefined' ? window : globalThis)
+67 -9
View File
@@ -25,13 +25,23 @@
/* 浮层打开时不接管画布粘贴:用户看不见画布,粘出来的节点会被盖住,
* 关掉浮层才发现多了一堆。优先读 state(ctx.ui),补一刀 DOM 判定覆盖放大编辑/插件面板。 */
function overlayOpen(ui) {
if (ui && (ui.settingOpen || ui.drawerOpen || ui.helpOpen || ui.wsMoreOpen || ui.ctxMenu || ui.connMenu)) return true
try {
return !!document.querySelector('.iwb-md-expand, .iwb-fullmask')
} catch (e) { return false }
/* 真模态:粘贴会落到用户看不见的画布上,直接不接管。 */
function modalOpen(ui) {
if (ui && (ui.settingOpen || ui.helpOpen || ui.wsMoreOpen || ui.ctxMenu || ui.connMenu)) return true
try { return !!document.querySelector('.iwb-md-expand') } catch (e) { return false }
}
/* 库面板(左侧资源抽屉 / 资源中心全屏):**不再禁止粘贴**。
* 旧行为是「浮层打开时不接管」,用户实测反馈「打开库面板粘贴就失效」,因为这两块面板
* 常驻打开、并不阻断画布操作(拖拽/连线都还能用),只有粘贴被单独拦掉,像 bug。
* 现在的取舍:粘贴前先把库面板关掉(调用方注入 closeLibrary),让落点可见、不产生「贴了
* 但看不见」的困惑;调用方没注入就退回旧行为(不接管)。 */
function libraryOpen(ui) {
if (ui && ui.drawerOpen) return true
try { return !!document.querySelector('.iwb-fullmask') } catch (e) { return false }
}
const overlayOpen = (ui) => modalOpen(ui) || libraryOpen(ui)
const nameOf = (f, i) => str(f && f.name) || ('pasted-' + (i + 1) + '.png')
/* ── 粘贴落点跟随指针(v3.24.69,用户裁定)───────────────────────────────
@@ -70,6 +80,10 @@
let hit = null
try { hit = document.elementFromPoint ? document.elementFromPoint(ptr.x, ptr.y) : null } catch (e) { hit = null }
if (hit && hit !== el && el.contains && !el.contains(hit)) return null
// 面板本身可能挂在画布子树里(左抽屉),单独再判一次
try {
if (hit && hit.closest && hit.closest('.iwb-fullmask, .iwb-lib, .iwb-lib-embedded, .iwb-drawer, .iwb-fullpanel')) return null
} catch (e) { /* ignore */ }
const vp = (ctx && ctx.refs && ctx.refs.viewport) || { x: 0, y: 0, scale: 1 }
const G = g.IWBCanvasGeometry
const w = (G && typeof G.clientToWorld === 'function')
@@ -120,7 +134,37 @@
* (prompt 216 vs 实测 ~90)⇒ 贴出来的节点视觉中心恒定偏上 63px。改成左上角之后
* 落点不再依赖任何高度估算:高度只决定"往下延伸多少"。
* ctx.findSpot(type, seed, opts) 的 opts.corner === 'tl' 就是这件事的开关。 */
const spotOf = (ctx, type) => ctx.findSpot(type, anchor(ctx) || undefined, { corner: 'tl' })
/* 指针不在画布上(停在面板/工具栏)时的兜底落点:
* 取视口中心,若中心被库面板盖住就往面板旁边挪,避免「贴了但看不见」。 */
function safeSeed(ctx) {
const box = boxOf(ctx)
if (!box) return null
const r = box.r
let movedOut = false
let cx = r.left + r.width / 2
const cy = r.top + r.height / 2
let moved = false
let rects = []
try { rects = Array.prototype.slice.call(document.querySelectorAll('.iwb-fullmask, .iwb-lib, .iwb-drawer, .iwb-lib-embedded')) } catch (e) { rects = [] }
for (let i = 0; i < rects.length; i++) {
const pr = rects[i].getBoundingClientRect ? rects[i].getBoundingClientRect() : null
if (!pr || !pr.width) continue
if (cx < pr.left || cx > pr.right || cy < pr.top || cy > pr.bottom) continue
if (pr.right + 90 < r.right) cx = pr.right + 90
else if (pr.left - 90 > r.left) cx = pr.left - 90
movedOut = true
break
}
// 中心没被面板挡住 ⇒ 返回 null,交回 findSpot 的原行为
if (!movedOut) return null
const vp = (ctx && ctx.refs && ctx.refs.viewport) || { x: 0, y: 0, scale: 1 }
const G = g.IWBCanvasGeometry
const w = (G && typeof G.clientToWorld === 'function')
? G.clientToWorld(cx, cy, r, vp)
: { x: (cx - r.left - (vp.x || 0)) / (vp.scale || 1), y: (cy - r.top - (vp.y || 0)) / (vp.scale || 1) }
return (Number.isFinite(w.x) && Number.isFinite(w.y)) ? { x: Math.round(w.x), y: Math.round(w.y) } : null
}
const spotOf = (ctx, type) => ctx.findSpot(type, anchor(ctx) || safeSeed(ctx) || undefined, { corner: 'tl' })
/* 同图去重(v3.24.75):把这一批里画布上**已有**的图剔掉,只排布剩下的。
* 返回 { kept, dupIds, dupCount }:
@@ -148,7 +192,9 @@
function addRefs(items, ctx, label) {
if (ctx.wsId !== ctx.activeWsId()) { ctx.setNotice({ type: 'err', text: '工作台已切换,已取消粘贴图片' }); return }
const dedup = rejectDup(items, ctx)
// v3.25.6(用户裁定):同一张图可以重复粘贴 —— 粘贴是显式动作,被去重挡掉像「按键没反应」。
// 同图去重只保留给「拖拽/批量导入」等被动路径(见 src/image-dedupe.js 的调用方)。
const dedup = { kept: items, dupIds: [], dupCount: 0 }
if (!dedup.kept.length) {
// 一张都没落:**必须**说清发生了什么并把原节点选中,否则用户看到的是「按了没反应」。
if (dedup.dupIds.length) ctx.setSel(dedup.dupIds)
@@ -250,7 +296,9 @@
}
return false
}
if (overlayOpen(ctx.ui)) return false
if (modalOpen(ctx.ui)) return false
// 库面板(资源抽屉 / 资源中心)不做任何拦截:用户明确要求「粘贴不要关闭库面板」。
// 落点问题交给 anchor(指针在画布可见区就贴指针处)与 safeSeed(指针压在面板上时挪开)。
if (c.kind === 'graph') {
// 复制节点时已把节点组写进系统剪贴板(text/html 带标记)→ 这里直接贴,不用再记 Ctrl+Shift+V。
e.preventDefault()
@@ -314,6 +362,15 @@
createRefFromUrl(c.text.trim(), ctx)
return true
}
// 桌面端:复制节点写不进 text/html 时会退化成「纯文本摘要 + 记住的 clip」。
// 文字与刚才写的摘要完全一致 ⇒ 认为用户贴的是节点组,而不是新提示词。
const G = g.IWBClipboardGraph
const matched = (G && typeof G.matchPlain === 'function') ? G.matchPlain(c.text) : null
if (matched) {
e.preventDefault()
try { const PO = g.IWBPasteOnce; if (PO) PO.disarm() } catch (err) { /* ignore */ }
if (ctx.pasteGraph(matched, anchor(ctx))) return true
}
e.preventDefault()
createPrompt(c.text, ctx)
return true
@@ -353,6 +410,7 @@ function probe(ctx) {
const D = g.IWBDesktop
if (!D || !D.clipboardReadImage) return
const ctx = (typeof getCtx === 'function') ? getCtx() : null
if (ctx && modalOpen(ctx.ui)) return
const stamp = ctx && ctx.refs ? (ctx.refs.pasteStamp || 0) : 0
setTimeout(() => {
const now = ctx && ctx.refs ? (ctx.refs.pasteStamp || 0) : 0
@@ -362,5 +420,5 @@ function probe(ctx) {
})
}
g.IWBClipboardPaste = Object.freeze({ handle, probe, overlayOpen, anchor, bindHotkeyFallback, pasteFiles: (files, ctx) => pasteImages(files || [], ctx) })
g.IWBClipboardPaste = Object.freeze({ handle, probe, overlayOpen, modalOpen, libraryOpen, anchor, bindHotkeyFallback, pasteFiles: (files, ctx) => pasteImages(files || [], ctx) })
})(typeof window !== 'undefined' ? window : globalThis)
+43
View File
@@ -0,0 +1,43 @@
const fs = require('fs')
const path = require('path')
const code = fs.readFileSync(path.join(__dirname, '../src/clipboard-graph.js'), 'utf8')
function makeGlobal (withClipboard) {
const calls = []
const g = {
TextEncoder,
TextDecoder,
btoa: (s) => Buffer.from(s, 'binary').toString('base64'),
atob: (s) => Buffer.from(s, 'base64').toString('binary'),
navigator: {},
__TAURI__: { core: { invoke: (cmd, args) => { calls.push({ cmd, args }); return Promise.resolve(true) } } },
console,
}
if (withClipboard) {
g.ClipboardItem = function (items) { this.items = items }
g.Blob = function (parts, opts) { this.parts = parts; this.type = (opts || {}).type }
g.navigator.clipboard = { write: () => Promise.reject(new Error('not allowed')) }
}
return { g, calls }
}
function run (withClipboard) {
const { g, calls } = makeGlobal(withClipboard)
const fn = new Function('window', 'globalThis', code + '\nreturn window.IWBClipboardGraph')
const G = fn(g, g)
const clip = { nodes: [{ id: 'n1', type: 'prompt', text: '两只猫在窗台' }], edges: [] }
return G.write(clip).then((ok) => {
const matched = G.matchPlain(G.plainFor(clip))
return { ok, calls, plain: G.plainFor(clip), matched: !!matched, id: matched && matched.nodes[0].id }
})
}
run(false).then((r) => {
console.log('无 clipboard.write(WKWebView 场景):', JSON.stringify({ ok: r.ok, native: r.calls.map(c => c.cmd), matched: r.matched, id: r.id }))
if (!(r.ok && r.calls.some(c => c.cmd === 'clipboard_write_text') && r.matched)) process.exit(1)
return run(true)
}).then((r) => {
console.log('有 clipboard.write 且被拒绝:', JSON.stringify({ ok: r.ok, native: r.calls.map(c => c.cmd), matched: r.matched }))
if (!(r.ok && r.matched)) process.exit(1)
console.log('PASS 图剪贴板兜底(原生写文本 + 摘要匹配)')
}).catch((e) => { console.error('FAIL', e); process.exit(1) })
+6 -5
View File
@@ -210,8 +210,10 @@ function makeCtx(over) {
eq('设置面板打开 → 不落节点', ctx.log.filter((x) => x.startsWith('commit')).length, 0)
}
{
// v3.25.6(用户裁定):库面板打开时照常粘贴,并且**不关闭**面板。
const ctx = makeCtx({ ui: { drawerOpen: true } })
eq('图库抽屉打开 → 不接管', P.handle(pasteEv({ text: 'x' }), ctx), false)
eq('图库抽屉打开 → 仍然接管粘贴', P.handle(pasteEv({ text: 'x' }), ctx), true)
eq('图库抽屉打开 → 不关闭面板', ctx.ui.drawerOpen, true)
}
{
const ctx = makeCtx({ ui: { helpOpen: true } })
@@ -348,10 +350,9 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))
eq('首次导入 → 落成 1 个参考图节点', ctx.log.filter((x) => x.startsWith('commit')).length, 1)
ctx.log.length = 0
pasted(u1)
eq('同一张图再粘 → 不建节点', ctx.log.filter((x) => x.startsWith('commit')).length, 0)
eq('同一张图再粘 → 选中已有节点(否则用户看不出东西在哪)', ctx.log.filter((x) => x === 'sel:1').length, 1)
ok('同一张图再粘 → 提示"已经在画布上"', ctx.log.some((x) => x.indexOf('notice:ok') === 0 && x.indexOf('已经在画布上') > 0))
ok('同一张图再粘 → 绝不静默(一定有提示)', ctx.log.some((x) => x.indexOf('notice:') === 0))
// v3.25.6(用户裁定):同一张图允许重复粘贴(粘贴是显式动作,去重挡掉像按键没反应)
eq('同一张图再粘 → 再建一个节点', ctx.log.filter((x) => x.startsWith('commit')).length, 1)
ok('同一张图再粘 → 有成功提示', ctx.log.some((x) => x.indexOf('notice:') === 0))
ctx.log.length = 0
pasted(u2)
eq('换一张不同的图 → 照常落地(不是"一律不粘")', ctx.log.filter((x) => x.startsWith('commit')).length, 1)
+5 -2
View File
@@ -1501,7 +1501,9 @@ const nodeXY = (el0) => {
const raw74 = window.localStorage.getItem('iwb_clipboard')
let clip74 = null; try { clip74 = JSON.parse(raw74) } catch (e) { clip74 = null }
assert('74-3 复制写入内部剪贴板(结构 + at 时间戳)', !!clip74 && clip74.type === 'iwb-clipboard' && typeof clip74.at === 'number' && clip74.nodes.length === 1, raw74 ? 'len=' + raw74.length : 'null')
assert('74-4 复制不再写系统剪贴板', clipWrites74.length === 0, 'writes=' + clipWrites74.length)
// v3.25.4:复制节点的语义改回「一个键贴所有」——系统剪贴板写不进 text/html 时(WKWebView),
// 退化为写纯文本摘要 + 记住 clip,Ctrl+V 时按摘要精确匹配贴回节点组;所以这里应当有 1 次写入。
assert('74-4 复制写入系统剪贴板(富文本不可用时退化纯文本摘要)', clipWrites74.length === 1, 'writes=' + clipWrites74.length)
// 74-5 Ctrl+Shift+V 永远粘贴节点组(不受系统剪贴板内容影响)
key74('v', { ctrlKey: true, shiftKey: true }); await wait(200)
assert('74-5 Ctrl+Shift+V 粘贴节点组', nodeCount74() === base74 + 1, 'n=' + nodeCount74() + ' expect=' + (base74 + 1))
@@ -1521,7 +1523,8 @@ const nodeXY = (el0) => {
key74('c', { ctrlKey: true }); await wait(80)
const rawBig74 = window.localStorage.getItem('iwb_clipboard') || ''
assert('74-7 剪贴板把大图剥离为 {__blob} 引用(新写入主通道;无 base64)', rawBig74.indexOf('__blob') >= 0 && !/data:image\/[^"']*;base64,[A-Za-z0-9+/=]{3000,}/.test(rawBig74), 'len=' + rawBig74.length)
assert('74-8 大图复制同样不写系统剪贴板', clipWrites74.length === 0, 'writes=' + clipWrites74.length)
// 同上:大图复制也走同一条兜底(摘要里只有「N 个节点」,绝不写 base64)
assert('74-8 大图复制也只写摘要文本(无 base64)', clipWrites74.length === 2 && clipWrites74.every((t) => t.indexOf('base64') < 0), 'writes=' + clipWrites74.length)
// 53. 冲突保护源码断言(Web 无 server:wApi 单机无冲突,跳过 server 部分)
const app53 = fs.readFileSync(path.join(APP, 'app.js'), 'utf8')
// 2026-11-16:persistWs / duplicateWs 搬到 src/runtime-workbench-logic.js(棘轮腾位),