Compare commits

...
10 Commits
Author SHA1 Message Date
qiqi cf93080d17 fix(storage): 启动时补齐工作子目录(windows 全新安装缺 images/canvas → 写图失败;目录缺失也避免白屏)v3.25.13
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m25s
2026-11-18 13:42:09 +08:00
qiqi 1ffe067e12 fix(image): 写 blob 前确保 images/<cat> 目录存在(Windows 全新安装缺目录 → 写失败 → 退 Cache → 重启丢图);桌面端不再回退不持久的 Cache Storage(v3.25.12)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m53s
2026-11-18 13:34:27 +08:00
qiqi 58d8d9c43a chore(release): 3.25.11 Windows 包上线(三平台齐平)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m39s
2026-11-18 13:19:59 +08:00
qiqi 0e15e29c18 fix(desktop): 单实例 + 外链走系统浏览器 + 原生通知 + 窗口下限 + 按平台产物 + CSP 清理(v3.25.11)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m37s
2026-11-18 13:09:42 +08:00
qiqi d8c8717826 fix(image): 图片字节写不进磁盘的根因(blob 存储绑定未就绪运行时 + kv.put 裸 false 当成功)v3.25.10
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m29s
2026-11-18 12:50:44 +08:00
qiqi 9e400e2348 fix(image): 惰性绑定 ImageBlobStore(避免绑定到未就绪运行时)+ kv.put 失败返回对象(裸 false 会被当成成功,产出空引用) 2026-11-18 12:46:34 +08:00
qiqi 2f9a326159 chore(release): 3.25.9 Windows 包上线(三平台齐平)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m29s
2026-11-18 12:32:31 +08:00
qiqi 56b5f49646 fix(storage): 图片登记后立即落盘;GC 确认弹窗报出保留/断链数量(P0,v3.25.9)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m27s
2026-11-18 12:13:32 +08:00
qiqi 49b419251e fix(images): 拖入同图不再被去重拦掉(可重复添加);gcImages 计入画布引用,避免误删在用图片(v3.25.8)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m12s
2026-11-18 11:43:32 +08:00
qiqi 57fc63dc10 chore(release): 3.25.7 Windows 包上线(三平台 latest.json 齐备)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m30s
2026-11-18 09:46:16 +08:00
24 changed files with 1127 additions and 89 deletions

No files matched your search

+75
View File
@@ -14,6 +14,81 @@
> 3. 核验正式地址版本 → 之后才移动 `stable` / `stable-verified-<日期>` 标签、更新本 CHANGELOG、写 GitHub Release(`gh release create`)。
> 测试发现问题 → 改 → 再 `deploy:test`,正式环境不受影响。回滚点 `git reset --hard stable`。
## v3.25.13(2026-11-18)启动兜底:工作子目录缺失时自动补齐
### 修复
- 启动时 `ensureDirs()` 补齐 `canvases/`、`library/`、`plugins/`、`trash/` 与
`images/{canvas,gallery,thumbs,legacy}`(幂等)。
- 为什么需要:Windows 全新安装缺 `images/canvas` 导致写图失败;目录被手工删掉时
启动阶段读目录抛错会让首屏白屏(实测遇到过一次)。
### 验证
把 `images/` 与 `library/` 整个删掉再启动 → 目录全部自动重建、应用正常渲染。
## v3.25.12(2026-11-18)Windows 丢图根因:images/canvas 目录不存在
### 根因
Windows 全新安装的资料目录里 `images/` 只有 `thumbs/`(缩略图 writer 会自己 mkdir),
**没有 `canvas/` 与 `gallery/`**。`kv.put` 写 blob 前不建目录 ⇒ `writeFile` 失败 ⇒
blob 写入被判失败 ⇒ 退化到 Cache Storage(`{__cache}`)⇒ WebView2 重启后解析不到 ⇒ 图没了。
mac 上之所以正常:老数据里 `images/canvas` 早就被迁移脚本建好了。
### 修复
- `kv.put` 的 blob / dataURL 两条分支写盘前 `mkdir(images/<cat>, {recursive:true})`(幂等)。
- 桌面端**不再回退 Cache Storage**:失败就让调用方把字节内联进画布,宁可画布变大也不丢图。
### 验证
把 mac 上的 `images/canvas` 整个移走模拟全新安装 → 粘贴一张图:
修前:目录不重建、assets 不变;修后:目录自动重建、`assets 52→53`、目录里出现 1 个文件。
## v3.25.11(2026-11-18)桌面迁移体检:单实例 / 外链 / 原生通知 / 窗口下限
### 修复
- **单实例**:加 `tauri-plugin-single-instance`,第二次启动只聚焦已有窗口。
多实例同时写同一个资料目录会把 data.json 与 canvases 写成不一致状态(这两天查的图片丢失就是这类)。
- **外链不再把应用导航走**:捕获阶段拦截 `a[href^=http]`(含中键)+ `window.open` 兜底改走
`open_external_url` 命令,由系统浏览器打开(新模块 `src/ui-desktop-shell.js`)。
- **桌面原生通知**:WKWebView 不支持 Web Notification,出图完成提醒改走 `notify_desktop`。
- **窗口尺寸下限**:恢复几何时 clamp 到 1024×640(与 minWidth/minHeight 对齐);
实测过 1051×488 的窗口,该尺寸下画布渲染空白。
- **按平台产物**:新增 `tauri.macos.conf.json`(app+dmg)与 `tauri.windows.conf.json`(nsis),
Windows 不再顺带构建不受更新器支持的 msi。
- **CSP 清理**:移除遗留的开发端口(30092 / 3425)。
## v3.25.10(2026-11-18)图片粘贴后重启丢失:根因是 blob 存储绑定错运行时
### 修复
- **ImageBlobStore 惰性绑定**:原来在模块初始化时就 `create({ idb: IDB })`,那一刻资料目录尚未就绪,
绑到的是浏览器/空实现运行时 ⇒ 图片字节写进了不会落盘的地方,画布里只留 `{__blob}` 引用,
重启后解析不到 → 节点变占位图。现在按当前 runtime 懒绑定并按实例缓存。
- **kv.put 失败可识别**:资料目录未就绪时返回裸 `false`,调用方用 `r.ok === false` 判断,
`false.ok` 是 undefined ⇒ 被当成成功,产出指向空文件的引用。现在返回 `{ ok: false, error }`。
### 验证(实测)
- 修复前:粘贴一张图 → `assets` 47→47、`images/canvas` 26→26(字节没落盘)
- 修复后:粘贴一张图 → `assets` 47→48、`images/canvas` 26→27,节点为 `{__blob}`
- 重启应用后:同一节点仍在、图片正常显示
## v3.25.9(2026-11-18)P0:图片登记表不再落后于画布 + 清理前交代清楚
### 修复
- **登记表立即落盘**:图片写入 `images/` 后,`assets` 登记(在 data.json 里)原来是 800ms debounce,
进程被强杀/崩溃时登记丢掉、画布引用还在 ⇒ GC 会把在用图片当孤儿。现在登记后立刻 `flush()`。
- **清理确认弹窗报数**:除了「N 个未被引用」,还会显示「其中 M 张因画布引用自动保留」与
「另有 K 处引用已缺图」,避免用户在不了解后果的情况下按确认。
### 新增
- 单测 `tests/storage-gc-canvas-refs-test.js`:钉住「GC 必须扫画布引用并并入 used 集合」与「登记后必须 flush」。
## v3.25.8(2026-11-18)拖入同图被拦 + 图片节点变占位图
### 修复
- **拖入同一张图被去重拦掉**:命中旧节点后不写 blob、只选中它,于是「图片数据缺失 → 重新拖入」
这条唯一自愈路径被堵死。现在拖入一律新建节点并重写 blob,旧节点也会跟着恢复。
- **图片清理误删在用图片**:`gcImages` 只信 `assets` 登记表;登记表落后于画布时,
画布仍在引用的图片会被当孤儿挪进 trash/,节点随即变成占位图。现在把 `canvases/*.json`
里的 `{__blob}` 也计入在用集合。
## v3.25.7(2026-11-18)剪贴板体检:大图卡顿、路径误判、粘贴落点
### 修复
+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 101 个单测文件(jsdom 契约测试;2026-11-07 新增 sync-facts-guard(事实一致性)/ _helpers/source(统一源文本);2026-11-12 新增 provider-ping(测速 no-cors 兜底))
test:unit 102 个单测文件(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)
+48 -17
View File
@@ -118,6 +118,8 @@
return Promise.resolve(window.confirm(String(text)))
}
// 桌面壳适配(外链 / 原生通知 / 链接拦截)落在 src/ui-desktop-shell.js
try { if (window.IWBUIShell) window.IWBUIShell.installLinkGuard(wIsTauri) } catch (e) { /* ignore */ }
if (typeof window !== 'undefined' && window.IWBDesktop && window.IWBDesktop.configure) {
window.IWBDesktop.configure({
isTauri: wIsTauri,
@@ -319,11 +321,14 @@
// 浏览器总通知:权限只在用户点击生图后的首次运行时请求;不支持/拒绝权限时静默降级。
let browserNotificationPermissionPromise = null
function prepareBrowserNotifications() {
if (wIsTauri()) return // 桌面端用原生通知,不需要网页权限
const N = typeof window !== 'undefined' && window.Notification
if (!N || typeof N.requestPermission !== 'function' || N.permission !== 'default' || browserNotificationPermissionPromise) return
try { browserNotificationPermissionPromise = N.requestPermission().catch(() => 'denied') } catch (e) { browserNotificationPermissionPromise = Promise.resolve('denied') }
}
function notifyBrowserGenerationDone(info) {
// 桌面端没有 Web Notification:交给桌面壳模块发原生通知
try { if (window.IWBUIShell && window.IWBUIShell.notifyGenerationDone(info)) return } catch (e) { /* ignore */ }
const N = typeof window !== 'undefined' && window.Notification
if (!N) return
const emit = () => {
@@ -819,16 +824,28 @@
// objectURL **单一归属**:一律由 wRegisterBlobUrl 创建并登记(拿得回原 Blob,绕开 CSP 对 fetch(blob:) 的拦截),
// 由 wImgUrlByRef 台账回收;**不调用** ImageBlobStore.resolveUrl/revokeAll —— 否则同一张图会有两套 URL
// 与两套回收时机(§8.2「不要两套并用」)。实例只在顶层创建一次,绝不在渲染路径里重复 create。
const ImageBlobStore = (function () {
/* v3.25.10:**惰性绑定**运行时。
* 原来在模块初始化时就 create({ idb: IDB }):那一刻资料目录可能还没就绪,
* IDB 拿到的是浏览器/空实现运行时,于是图片字节写进了「不会落盘」的地方 ——
* 画布里留下 {__blob} 引用,images/ 里没有文件、data.json 里没有登记;
* 重启后引用解析不到 → 图片节点变占位图(用户实测)。现在按当前 runtime 懒绑定并按实例缓存。 */
let wImageBlobStoreCache = null
let wImageBlobStoreRuntime = null
function wImageBlobStore() {
try {
if (typeof window === 'undefined') return null
const Lib = window.IWBImageBlobStore
if (!Lib || typeof Lib.create !== 'function') return null
if (!IDB || typeof IDB.put !== 'function' || typeof IDB.get !== 'function') return null
return Lib.create({ idb: IDB })
const rt = storageRuntime()
const idb = rt && rt.indexedDb
if (!idb || typeof idb.put !== 'function') return null
if (wImageBlobStoreCache && wImageBlobStoreRuntime === idb) return wImageBlobStoreCache
wImageBlobStoreCache = Lib.create({ idb: idb })
wImageBlobStoreRuntime = idb
return wImageBlobStoreCache
} catch (e) { return null }
})()
const IMG_BLOB_PREFIX = (ImageBlobStore && ImageBlobStore.PREFIX) ? String(ImageBlobStore.PREFIX) : 'imgblob_'
}
const IMG_BLOB_PREFIX = (function () { try { const S = wImageBlobStore(); return (S && S.PREFIX) ? String(S.PREFIX) : 'imgblob_' } catch (e) { return 'imgblob_' } })()
const wImgUrlByRef = new Map() // 引用键('b:'+blobKey / 'c:'+cacheUrl)→ objectURL
const wImgRefByUrl = new Map() // objectURL → 原引用对象(wBlobRefCache 被 FIFO 驱逐后仍能取回字节)
const wImgUrlPending = new Set() // 正在解析的引用键(幂等:渲染路径会反复调用)
@@ -872,7 +889,7 @@
if (wImgUrlByRef.has(key) || wImgUrlPending.has(key) || wImgUrlFailed.has(key)) return
wImgUrlPending.add(key)
const job = wIsBlobRef(v)
? (ImageBlobStore ? ImageBlobStore.getBlob(v.__blob) : Promise.resolve(null))
? (wImageBlobStore() ? wImageBlobStore().getBlob(v.__blob) : Promise.resolve(null))
: iwbCacheBlob(v.__cache)
// 解析 Promise 存进 wImgUrlPendingPromise ⇒ 供 wResolveImgAsync 等待(预览类操作需要 URL 字符串)
const p = Promise.resolve(job).then((blob) => {
@@ -941,8 +958,8 @@
async function wImgRefDataUrl(v) {
if (typeof v === 'string') return v
if (wIsBlobRef(v)) {
if (!ImageBlobStore) return ''
try { return await ImageBlobStore.resolveDataUrl(v.__blob) } catch (e) { return '' }
if (!wImageBlobStore()) return ''
try { return await wImageBlobStore().resolveDataUrl(v.__blob) } catch (e) { return '' }
}
if (wIsCacheRef(v)) { try { return (await iwbCacheRead(v.__cache)) || '' } catch (e) { return '' } }
return ''
@@ -2289,14 +2306,28 @@
// 图片引用化**唯一入口**:wSanitizeWs(画布保存)与 wRefValueAsync(收藏快照 / LRU 反 hydrate)都只经这里产出引用。
// 失败回退链:{__blob}(IDB Blob 主通道)→ {__cache}(Cache Storage 兜底)→ null(调用方自行兜底,绝不抛错打断保存)。
// 只有 ImageBlobStore.put 明确 r.ok===true 且带 key 才返回 {__blob},绝不产出「引用指向不存在的字节」。
// 存储自检(桌面迁移排查用):把“字节到底能不能落盘”变成可复制的事实
function wStorageSelfCheck() {
const F = (typeof window !== 'undefined') ? window.IWBStorageFile : null
const st = (F && typeof F.stats === 'function') ? F.stats() : null
return {
tauri: wIsTauri(), fileEnabled: wFileStoreOn(), dir: (st && st.dir) || '',
assets: (st && st.images) || 0, memKeys: (st && st.keys) || 0,
blobStore: !!wImageBlobStore(), cryptoSubtle: !!(typeof crypto !== 'undefined' && crypto.subtle),
caches: (typeof caches !== 'undefined'),
}
}
async function wImgRefWrite(dataUrl) {
if (W_IMG_BLOB_PRIMARY && ImageBlobStore) {
if (W_IMG_BLOB_PRIMARY && wImageBlobStore()) {
try {
const r = await ImageBlobStore.put(dataUrl)
const r = await wImageBlobStore().put(dataUrl)
if (r && r.ok && r.key) return { __blob: String(r.key) }
if (r && r.ok === false) swallow('image', new Error(r.error || 'blob-put-failed'))
} catch (e) { swallow('image', e) } // 落 Blob 失败(配额/环境不支持)→ 回退 Cache,但计数留痕
}
// 桌面端不回退 Cache Storage:WebView2 重启后 {__cache} 解析不到(mac 上正常),
// 回退等于“写成功但图没了”。失败就让调用方把字节内联进画布。
if (wIsTauri()) return null
const c = await iwbCacheWrite(dataUrl)
return (c && c.__cache) ? c : null
}
@@ -2402,10 +2433,10 @@
let raw = null
try { raw = await IDB.get(key) } catch (e) { raw = null }
if (!raw || typeof raw !== 'string' || raw.indexOf('data:') !== 0) return ref
if (ImageBlobStore) {
if (wImageBlobStore()) {
try {
const r = await ImageBlobStore.put(raw)
if (r && r.ok && r.key) { const out = ImageBlobStore.refOf(r.key); wEnsureImgUrl(out); return out }
const r = await wImageBlobStore().put(raw)
if (r && r.ok && r.key) { const out = wImageBlobStore().refOf(r.key); wEnsureImgUrl(out); return out }
} catch (e) { /* 落 BlobStore 失败 → 退回 Cache 引用 */ }
}
try { const c = await iwbCacheWrite(raw); if (c && c.__cache) { wEnsureImgUrl(c); return c } } catch (e) { /* ignore */ }
@@ -2624,7 +2655,7 @@
if (k.indexOf(IMG_BLOB_PREFIX) === 0) {
if (!keep.has(k)) {
wReleaseImgUrls(['b:' + k])
try { if (ImageBlobStore) { const okDel = await ImageBlobStore.del(k); if (okDel === false) swallow('image', new Error('blob-del-failed')) } else await IDB.del(k) } catch (e) { swallow('image', e) }
try { if (wImageBlobStore()) { const okDel = await wImageBlobStore().del(k); if (okDel === false) swallow('image', new Error('blob-del-failed')) } else await IDB.del(k) } catch (e) { swallow('image', e) }
}
continue
}
@@ -4334,7 +4365,7 @@
} catch (e) { /* 继续兜底 */ }
// ④ 最后兜底:新标签打开(右键/长按另存)——绝不静默失败
try {
window.open(su, '_blank', 'noopener')
try { window.IWBUIShell ? window.IWBUIShell.openExternal(su) : window.open(su, '_blank', 'noopener') } catch (e) { /* ignore */ }
wDownloadToast('该图床不支持直接下载,已在新标签打开图片:请右键「图片另存为」')
} catch (e) {
wDownloadToast('下载失败:' + ((e && e.message) || '未知原因'))
@@ -4589,7 +4620,7 @@ const tbCenterSeed = (type, refs) => {
el('div', { className: 'iwb-crash-actions' },
el('button', { className: 'iwb-btn iwb-btn-primary', onClick: this.retry }, '尝试恢复'),
el('button', { className: 'iwb-btn', onClick: () => { try { location.reload() } catch (e) { /* ignore */ } } }, '重新加载页面'),
el('button', { className: 'iwb-btn', title: '复制错误记录与内存采样(不含 Key、提示词和图片)', onClick: (ev) => { let t = '{}'; try { t = CrashLog ? JSON.stringify(CrashLog.report({ version: APP_VERSION }), null, 2) : '{}' } catch (e) { /* ignore */ } const cp = (typeof window !== 'undefined' && window.IWBClipboardCopy) || null; if (cp) cp.copyWithButton(t, ev && ev.currentTarget); else { try { navigator.clipboard.writeText(t) } catch (e) { /* ignore */ } } } }, '复制诊断信息'),
el('button', { className: 'iwb-btn', title: '复制错误记录与内存采样(不含 Key、提示词和图片)', onClick: (ev) => { let t = '{}'; try { const rep = CrashLog ? CrashLog.report({ version: APP_VERSION }) : {}; try { rep.storageSelfCheck = wStorageSelfCheck() } catch (e) { rep.storageSelfCheck = { error: String((e && e.message) || e) } } t = JSON.stringify(rep, null, 2) } catch (e) { /* ignore */ } const cp = (typeof window !== 'undefined' && window.IWBClipboardCopy) || null; if (cp) cp.copyWithButton(t, ev && ev.currentTarget); else { try { navigator.clipboard.writeText(t) } catch (e) { /* ignore */ } } } }, '复制诊断信息'),
),
el('div', { className: 'iwb-hint' }, '完整记录在「设置 → 诊断」里,可导出 JSON'),
),
@@ -5440,7 +5471,7 @@ const tbCenterSeed = (type, refs) => {
W_KEEP,
IDB,
IMG_BLOB_PREFIX,
ImageBlobStore,
get ImageBlobStore() { return wImageBlobStore() },
ModularBackupStore,
SchemaVersions,
StorageContract,
+5 -5
View File
@@ -1,7 +1,7 @@
# 现状架构与性能事实基线(image-workbench-web)
> **本文档是什么**:现状**事实快照**,不是规范。用途:任何性能 / 内存 / 存储相关改动,先对齐这里的现实,避免把已经调好的东西改坏。
> 日期 **2026-10-20**(**2026-11-16 复算 · v3.24.85**)| 基线(**最近一次 bump 版本的提交**,不是主干 HEAD)`main = 1afd5d7`(线上 `v3.25.6+1afd5d7` —— 线上实际运行提交是 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 = 1ffe067`(线上 `v3.25.12+1ffe067` —— 线上实际运行提交是 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 迁出)
@@ -22,7 +22,7 @@
- 图片**新写入主通道 = IndexedDB Blob `{__blob}` / key `imgblob_<hash>_<len>`** (A) `app.js:2143`;`{__cache}`(Cache Storage)为兜底;\`ref_\`(`app.js` 内定义的 `IDB_REF_PREFIX = 'ref_'`)为 legacy 形态 (A)。
- 大图判定:`isBigDataUrl` = `data:` 且 `length > 3000` (A) `app.js:2018`;**画布保存保留阈值** `< 16384` 才原样保留 (A) `app.js:2182`。**两处阈值并存,含义不同**。
- 单测是**源码契约测试**:`tests/` 目录共 **493** 处源码文本钉点(`source.includes` / `source.indexOf` / `/re/.test(source)`),分布在 **20** 个文件(其中 `iwb-v32-web-test.js` 一个就占 **407**)→ **结构性重构会先打红测试**。**该数字已由 `tests/source-text-ratchet-test.js` 的「只减不增」棘轮守门**(2026-10-20 起守卫范围从 1 个文件扩到全目录:新增任何一处源码文本钉点都会打红)。**2026-11-12 复算**(`npm run audit:pins`,v3.24.76):二分 STRUCT **417** / NAME **76**;形态 **POS 403 / NEG 87 / COUNT 3**;难度 **易 62 / 中 316 / 难 115**。钉点减法第一批(v3.24.72)把 **537 → 505**:8 条探针钉点改为「门禁内 spec 是否真的读该计数器」、5 条改为运行时断言(生产态 `window` 上无探针)、10 条改为 DOM 断言(质量档位禁用 / 传输页无三模式按钮 / 模型项 title)、4 条改为运行时对象断言(健康检查两域、策略对象冻结)、其余 9 条有同文件 DOM 等价断言或仅剩 NEG。第二批(v3.24.76)把 **505 → 493**:94-5~7 三条「多标签释放语义」(10 处正则)换成 `tests/iwb-tabs-release.spec.js` 的 3 条真 e2e,剩 1 条「消费方契约」(断言该 spec 在门禁内且 spec 源码真的读两个探针);另 2 条 `wPurgeIntent.add` 钉点改为读 `src/workspace-purge.js`。**这一批一换就查出 3 个真缺陷**(objectURL 从未释放 / 彻底删除留孤儿标签 · session / 刷新后误回收打开标签的图)—— 见 CHANGELOG v3.24.76。
- `app.js` = 单 IIFE **8,508 行**(**双层预算**:绝对上限 8,700 / 占总源码 ≤ 40%,现 **36.8%**,2026-11-12 起;此前为单一上限 8,509、零余量);`Workbench()` = **2,998 行**(上限 **3,030**,余量 32;2026-11-16 把生成取消族 `cancelRunsFor`/`cancelRun`/`cancelTaskJobs` 与工作区列表写回族 `persistWs`/`duplicateWs` 搬进 `src/runtime-workbench-logic.js`(`createCancelActions` / `createWorkspaceListActions`),并删掉全仓零调用的 `runAll`,3090 → 2,998);大量逻辑已抽到 `src/*.js`(现 **85** 个模块 / 14,607 行,`sourceModules` 85 项;v3.24.68 新增 `clipboard-graph.js`,v3.24.74 新增 `image-admit.js`,v3.24.75 新增 `image-dedupe.js`,v3.24.76 新增 `workspace-purge.js`,v3.24.79 新增 `generation-provider-ping.js`,v3.24.80 删除无调用的 `createWBFlushViewport` 17 行)。
- `app.js` = 单 IIFE **8,508 行**(**双层预算**:绝对上限 8,700 / 占总源码 ≤ 40%,现 **36.8%**,2026-11-12 起;此前为单一上限 8,509、零余量);`Workbench()` = **2,998 行**(上限 **3,030**,余量 32;2026-11-16 把生成取消族 `cancelRunsFor`/`cancelRun`/`cancelTaskJobs` 与工作区列表写回族 `persistWs`/`duplicateWs` 搬进 `src/runtime-workbench-logic.js`(`createCancelActions` / `createWorkspaceListActions`),并删掉全仓零调用的 `runAll`,3090 → 2,998);大量逻辑已抽到 `src/*.js`(现 **86** 个模块 / 14,607 行,`sourceModules` 86 项;v3.24.68 新增 `clipboard-graph.js`,v3.24.74 新增 `image-admit.js`,v3.24.75 新增 `image-dedupe.js`,v3.24.76 新增 `workspace-purge.js`,v3.24.79 新增 `generation-provider-ping.js`,v3.24.80 删除无调用的 `createWBFlushViewport` 17 行)。
- 门禁:`npm run verify` = `verify:ci`(`build` → `node --check app.js` → `node --check dist/app.js` → `check-dist.js` → `lint`(ESLint 正确性规则,`src/` + `app.js`,P4-16a)→ `test:unit` → `test` → `test:facts`)+ `test:e2e` (A) `package.json`。
## 2. 门禁与环境现状
@@ -167,7 +167,7 @@
- 同一张图被 3 个节点引用、hydrate 成 3 个不同 objectURL 时,preview/display 缓存各自 miss → 重复解码(与 F2 相邻)。
- **F10|`refs.genScheduler` 是桩** (A) → 未接线,暂无运行时影响(P3)。
- **F11|已建但未接线的模块层(2026-10-17 接线审计;2026-10-18 复核更正)** (A)
- **判定法**:`global.X =` / `root.X =` 判「导出」;跨文件裸引用判「读」;排除自合并(`src/runtime-constants.js:9`)。`app.js` 是**唯一生产消费者**(无 HTML 入口;`sw.js` 不引用模块全局)。**85 个模块中 59 个导出**被 `app.js` 读取;其余为未接线 / 仅测试 / 零引用(见下)。
- **判定法**:`global.X =` / `root.X =` 判「导出」;跨文件裸引用判「读」;排除自合并(`src/runtime-constants.js:9`)。`app.js` 是**唯一生产消费者**(无 HTML 入口;`sw.js` 不引用模块全局)。**86 个模块中 59 个导出**被 `app.js` 读取;其余为未接线 / 仅测试 / 零引用(见下)。
- **仅被测试引用(9 模块 + 2 导出)**:`canvas-domain`、`generation-retry`、`generation-service`、`runtime-recovery-runner`、`runtime-state-bridge`、`runtime-store`、`storage-reconcile`、`storage-result`、`workspace-service`;导出 `IWBStorageHealthFactory`、`IWBPluginHostFactory`。(`storage-result` 是**存储层共享结果类型**,被 6 个存储模块读取,**非死代码**;`runtime-store` 为状态模型 epic 地基。)
- **app.js 零引用(1 模块 + 3 导出)**:模块 `generation-controller`;导出 `IWBRuntimeMetricsFactory`、`IWBStorageRuntimeFactory`、`IWBUIComponents`。`canvas-relations` 已随 `06cf211` 删除(本文档早前把它列为"唯一可删者",实际已删)。零引用证据 = `grep -rn "<名字>" .`(排除 `node_modules|dist|vendor|test-results`)**只命中其自身赋值行**。
- **半接线 / 未接线**:`IWBRuntimeStateBridge` **无 app.js 引用(仅测试)**;`IWBRuntimeRunContext` **已接线**(`runNode` 读取运行上下文);`IWBGenerationController` 是完整但**从未被调用**的工厂;`ModularWorkspaceStore`(`app.js` 内)是 `storage-workspace` 的**预留接线 seam**(当前无下游使用,保留);`window.IWBImageFolder` 自注册后读回(装载路径)。
@@ -183,7 +183,7 @@
| `storage-reconcile` | 存储对账(`createReconciler`/`check`) | 内联对账 | 存储层收口 |
| `runtime-recovery-runner` | 执行恢复候选(`candidate`/`valid`/`run`) | 内联恢复 | 断点恢复 |
| `canvas-domain` | 画布域模型(`commit`/`updateNode`/`deleteNodes`…) | `CanvasStore` 那一套 | Workbench 解耦(P2-9) |
- **耦合面已冻结**:`tests/architecture-boundary-guard-test.js`(进 `npm run test:unit` 末环)冻结 app.js↔src 耦合面(**74** 项)与 `sourceModules` 顺序(**85** 项);命名例外由第 5 组冻结,新增非 `IWB` 前缀导出即打红。
- **耦合面已冻结**:`tests/architecture-boundary-guard-test.js`(进 `npm run test:unit` 末环)冻结 app.js↔src 耦合面(**74** 项)与 `sourceModules` 顺序(**86** 项);命名例外由第 5 组冻结,新增非 `IWB` 前缀导出即打红。
## 12. 易踩的坑
@@ -254,7 +254,7 @@
**信任模型(必须明示)**:形态 A 的插件是**可信代码**(与核心同权限、无沙箱);启停与设置是 UX 与可维护性手段,**不是安全边界**(同 §13.27 教训:前端开关一定可被绕过)。
**守门与快照**:`tests/architecture-boundary-guard-test.js` 冻结「app.js ↔ src 耦合面」(**74** 项)与 `sourceModules` 顺序(**85** 项);新增模块、新增耦合、新增 dev 探针都**必须有意重生成对应快照**(`IWB_WRITE_BOUNDARY_SNAPSHOT=1`)。契约与行为的可执行验证在 `tests/plugin-host-test.js`(宿主单测)与 `tests/_plugin-host-probe.spec.js`(真实浏览器探针,`_` 前缀 + `iwb-dev-probe`,不进 34 门禁)。
**守门与快照**:`tests/architecture-boundary-guard-test.js` 冻结「app.js ↔ src 耦合面」(**74** 项)与 `sourceModules` 顺序(**86** 项);新增模块、新增耦合、新增 dev 探针都**必须有意重生成对应快照**(`IWB_WRITE_BOUNDARY_SNAPSHOT=1`)。契约与行为的可执行验证在 `tests/plugin-host-test.js`(宿主单测)与 `tests/_plugin-host-probe.spec.js`(真实浏览器探针,`_` 前缀 + `iwb-dev-probe`,不进 34 门禁)。
**关键陷阱**:`normalizeNodes`(现位于 `src/canvas-normalize.js`)会**静默丢弃**不在 `NODE_H` 里的节点类型 ⇒ 新增节点类型必须先登记 `NODE_H`,否则节点一刷新就消失(§13.27 规则三的同一失败模式)。
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "image-workbench-web",
"private": true,
"version": "3.25.7",
"version": "3.25.13",
"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/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: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-gc-canvas-refs-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",
+1
View File
@@ -89,6 +89,7 @@ const sourceModules = [
'generation-results-store.js',
'ui-groups-sidebar.js',
'ui-lib-sidebar.js',
'ui-desktop-shell.js',
'ui-workspace-tabs.js',
'ui-app-chrome.js',
'ui-workbench-hooks.js',
+29 -5
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.7 · 7.3 MB · .dmg<div class="hash">sha256 e4b6b75613916311…</div></div>
<a class="btn" href="/updates/darwin-aarch64/image-workbench_3.25.7_aarch64.dmg">下载</a>
<div class="meta">版本 3.25.13 · 7.6 MB · .dmg<div class="hash">sha256 863a5ff87a1debc0…</div></div>
<a class="btn" href="/updates/darwin-aarch64/image-workbench_3.25.13_aarch64.dmg">下载</a>
</div>
<div class="row">
<div class="name">macOS · Intel<div class="hint">x86_64</div></div>
<div class="meta">版本 3.25.7 · 7.6 MB · .dmg<div class="hash">sha256 63288e85748e0d36…</div></div>
<a class="btn" href="/updates/darwin-x86_64/image-workbench_3.25.7_x64.dmg">下载</a>
<div class="meta">版本 3.25.13 · 7.9 MB · .dmg<div class="hash">sha256 25b4ad7237058ddd…</div></div>
<a class="btn" href="/updates/darwin-x86_64/image-workbench_3.25.13_x64.dmg">下载</a>
</div>
<div class="row">
<div class="name">Windows · x64<div class="hint">需要 WebView2</div></div>
@@ -95,9 +95,33 @@
<h2>历史版本</h2>
<div class="row">
<div class="name">3.25.7<div class="hint">Intel 版:剪贴板性能修复</div></div>
<div class="name">3.25.13<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.12<div class="hint">Intel 版:图片目录自愈 + 不回退 Cache</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.11<div class="hint">Windows:单实例 + 外链系统浏览器 + 原生通知 + 窗口下限 + 仅 nsis 产物</div></div>
<div class="meta">2026-11-18<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
</div>
<div class="row">
<div class="name">3.25.10<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.9<div class="hint">Windows:图片登记立即落盘 + 清理前报数</div></div>
<div class="meta">2026-11-18<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
</div>
<div class="row">
<div class="name">3.25.8<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.7<div class="hint">Windows:剪贴板 PNG 传输 + 路径文本转图片 + 大图不卡</div></div>
<div class="meta">2026-11-18<div class="hint">macOS · Apple Silicon / macOS · Intel / Windows · x64</div></div>
</div>
<div class="row">
<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>
+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.7-mwlg2nio">
<link rel="stylesheet" href="/assets/style.css?v=3.25.13-mwlp28hk">
</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.7</a>
<a class="btn primary" href="/download/">下载 v3.25.13</a>
</div>
</div></nav>
<main>
<section class="hero hero-art">
<div class="hero-bg"><img src="/assets/painting.jpg?v=3.25.7-mwlg2nio" alt=""></div>
<div class="hero-bg"><img src="/assets/painting.jpg?v=3.25.13-mwlp28hk" alt=""></div>
<div class="hero-veil"></div>
<div class="wrap">
<span class="kicker">v3.25.7 · macOS / Windows · 数据在本地</span>
<span class="kicker">v3.25.13 · macOS / Windows · 数据在本地</span>
<h1>本地优先的<br>AI 生图无限画布</h1>
<p class="sub">用节点把「参考图 → 提示词 → 批量生成 → 图库」串成一条生产线。<br>图片、提示词、模型配置全部留在你自己的电脑里,插件按需安装。</p>
<div class="cta">
<a class="btn primary lg" href="/download/">下载 v3.25.7</a>
<a class="btn primary lg" href="/download/">下载 v3.25.13</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.7_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.7_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.13_aarch64.dmg"><div class="n">macOS · Apple Silicon</div><div class="s">M1 / M2 / M3 / M4 · 7.6 MB · .dmg</div></a>
<a href="/updates/darwin-x86_64/image-workbench_3.25.13_x64.dmg"><div class="n">macOS · Intel</div><div class="s">x86_64 · 7.9 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.7-mwlg2nio">
<link rel="stylesheet" href="/assets/style.css?v=3.25.13-mwlp28hk">
</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.7</a>
<a class="btn primary" href="/download/">下载 v3.25.13</a>
</div>
</div></nav>
<main>
+134 -2
View File
@@ -1,12 +1,138 @@
{
"app": "Image Workbench",
"subtitle": "本地优先的 AI 生图无限画布 · 桌面版(Tauri v2)",
"updatedAt": "2026-11-18T01:30:32.115Z",
"updatedAt": "2026-11-18T05:42:09.182Z",
"releases": [
{
"version": "3.25.13",
"date": "2026-11-18",
"notes": "Intel 版:启动目录兜底",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.25.13_aarch64.dmg",
"size": 7935763,
"sha256": "863a5ff87a1debc0baf2dbe5033d8313c90649a6f48577408a23846d2b106e23",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.25.13_x64.dmg",
"size": 8235328,
"sha256": "25b4ad7237058ddd06d2a8f361114304ff03a37dd841d8c54a31d9d9e4d7d0e6",
"kind": "dmg"
}
}
},
{
"version": "3.25.12",
"date": "2026-11-18",
"notes": "Intel 版:图片目录自愈 + 不回退 Cache",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.25.12_aarch64.dmg",
"size": 7935223,
"sha256": "ddea5bf24ddfab943afce8d4a9eeb744c09fd15a204d0c359149025ecda4c0d8",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.25.12_x64.dmg",
"size": 8232027,
"sha256": "87d69fb85ce19c5e7993cf02ee35568352f0c6c4b026892e0a0d49e1505aa432",
"kind": "dmg"
}
}
},
{
"version": "3.25.11",
"date": "2026-11-18",
"notes": "Windows:单实例 + 外链系统浏览器 + 原生通知 + 窗口下限 + 仅 nsis 产物",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.25.11_aarch64.dmg",
"size": 7931660,
"sha256": "4d6d589d87b5a463310d73bd84da06186e2a291e536e75fadcce047cb2f86c49",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.25.11_x64.dmg",
"size": 8234268,
"sha256": "13ccf3b80e0162524c1d73cdae96c914288adcb5649b7d082d260649123d4970",
"kind": "dmg"
},
"windows-x86_64": {
"file": "updates/windows-x86_64/image-workbench_3.25.11_x64-setup.exe",
"size": 4905095,
"sha256": "17702145cff43a02a4e7b50cdccded050d44819a9d6b80b539ae8997c7f4f0d4",
"kind": "exe"
}
}
},
{
"version": "3.25.10",
"date": "2026-11-18",
"notes": "Intel 版:图片持久化修复",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.25.10_aarch64.dmg",
"size": 7671575,
"sha256": "1882ed66713df4cfd0839a6d5220e717c297d31b050bfcbfb45efff33e660e61",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.25.10_x64.dmg",
"size": 7978877,
"sha256": "bca63766b951756228d513b1dc6d6c9e76d8bc5c4cc898171a24178b9f2e23ff",
"kind": "dmg"
}
}
},
{
"version": "3.25.9",
"date": "2026-11-18",
"notes": "Windows:图片登记立即落盘 + 清理前报数",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.25.9_aarch64.dmg",
"size": 7674858,
"sha256": "030b18cc29dd8f5e65b1906ef141a99ea34daadfacf827c10b75a2b0c957c94a",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.25.9_x64.dmg",
"size": 7977320,
"sha256": "06fd92df7fa6adf762d62450338f2f005c7c77cc9379bda4feaf49f27791f191",
"kind": "dmg"
},
"windows-x86_64": {
"file": "updates/windows-x86_64/image-workbench_3.25.9_x64-setup.exe",
"size": 4771479,
"sha256": "d065e2a00eb59aeb55d101d9c22d39fb1298833b3782403379a72041ceb78230",
"kind": "exe"
}
}
},
{
"version": "3.25.8",
"date": "2026-11-18",
"notes": "Intel 版:同图导入与图片清理修复",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.25.8_aarch64.dmg",
"size": 7673011,
"sha256": "a3f6293d099f5624705138a342a8e95517e9e9bf1c7a8f88e84a573e9fd87955",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.25.8_x64.dmg",
"size": 7978802,
"sha256": "5716570a8d6bed248df66e2b1d82946265df2d5293c23753e3b2ae4ee3a810d9",
"kind": "dmg"
}
}
},
{
"version": "3.25.7",
"date": "2026-11-18",
"notes": "Intel 版:剪贴板性能修复",
"notes": "Windows:剪贴板 PNG 传输 + 路径文本转图片 + 大图不卡",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.25.7_aarch64.dmg",
@@ -19,6 +145,12 @@
"size": 7978666,
"sha256": "63288e85748e0d360afae76009e6e44a668b9755b270883387380774468a4f33",
"kind": "dmg"
},
"windows-x86_64": {
"file": "updates/windows-x86_64/image-workbench_3.25.7_x64-setup.exe",
"size": 4776945,
"sha256": "7ada5360e52ddd0c1f0a00d124c00612b5a03a34a6c8e128e74178cda8e52a2d",
"kind": "exe"
}
}
},
+547 -1
View File
@@ -84,6 +84,137 @@ dependencies = [
"x11rb",
]
[[package]]
name = "async-broadcast"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532"
dependencies = [
"event-listener",
"event-listener-strategy",
"futures-core",
"pin-project-lite",
]
[[package]]
name = "async-channel"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2"
dependencies = [
"concurrent-queue",
"event-listener-strategy",
"futures-core",
"pin-project-lite",
]
[[package]]
name = "async-executor"
version = "1.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f426a31126c735126297bc5ea7a521263c9faff4f63ca415267ee625651c4f37"
dependencies = [
"async-task",
"concurrent-queue",
"fastrand",
"futures-lite",
"pin-project-lite",
"slab",
]
[[package]]
name = "async-io"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc"
dependencies = [
"autocfg",
"cfg-if",
"concurrent-queue",
"futures-io",
"futures-lite",
"parking",
"polling",
"rustix",
"slab",
"windows-sys 0.61.2",
]
[[package]]
name = "async-lock"
version = "3.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0876700b0d007ad25d5508865a4259c3af9af6d296bf663a0d586d0bc3369f6f"
dependencies = [
"event-listener",
"event-listener-strategy",
"pin-project-lite",
]
[[package]]
name = "async-process"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75"
dependencies = [
"async-channel",
"async-io",
"async-lock",
"async-signal",
"async-task",
"blocking",
"cfg-if",
"event-listener",
"futures-lite",
"rustix",
]
[[package]]
name = "async-recursion"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f8abc12baad266b1c8cec146854c195b5864b4221d4b2ca7296a7ae82d9e451"
dependencies = [
"proc-macro2",
"quote",
"syn 3.0.10",
]
[[package]]
name = "async-signal"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485"
dependencies = [
"async-io",
"async-lock",
"atomic-waker",
"cfg-if",
"futures-core",
"futures-io",
"rustix",
"signal-hook-registry",
"slab",
"windows-sys 0.61.2",
]
[[package]]
name = "async-task"
version = "4.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de"
[[package]]
name = "async-trait"
version = "0.1.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667"
dependencies = [
"proc-macro2",
"quote",
"syn 3.0.10",
]
[[package]]
name = "atk"
version = "0.18.2"
@@ -200,6 +331,19 @@ dependencies = [
"objc2",
]
[[package]]
name = "blocking"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa"
dependencies = [
"async-channel",
"async-task",
"futures-io",
"futures-lite",
"piper",
]
[[package]]
name = "brotli"
version = "9.1.3"
@@ -422,6 +566,15 @@ dependencies = [
"memchr",
]
[[package]]
name = "concurrent-queue"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "constant_time_eq"
version = "0.6.1"
@@ -886,6 +1039,33 @@ dependencies = [
"simdutf8",
]
[[package]]
name = "endi"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099"
[[package]]
name = "enumflags2"
version = "0.7.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef"
dependencies = [
"enumflags2_derive",
"serde",
]
[[package]]
name = "enumflags2_derive"
version = "0.7.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.119",
]
[[package]]
name = "env_filter"
version = "0.1.4"
@@ -929,6 +1109,26 @@ version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7"
[[package]]
name = "event-listener"
version = "5.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2"
dependencies = [
"parking",
"pin-project-lite",
]
[[package]]
name = "event-listener-strategy"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93"
dependencies = [
"event-listener",
"pin-project-lite",
]
[[package]]
name = "fastrand"
version = "2.5.0"
@@ -1076,6 +1276,19 @@ version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed"
[[package]]
name = "futures-lite"
version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad"
dependencies = [
"fastrand",
"futures-core",
"futures-io",
"parking",
"pin-project-lite",
]
[[package]]
name = "futures-macro"
version = "0.3.34"
@@ -1475,6 +1688,12 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "hermit-abi"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284"
[[package]]
name = "hex"
version = "0.4.3"
@@ -1764,7 +1983,7 @@ dependencies = [
[[package]]
name = "image-workbench"
version = "3.25.7"
version = "3.25.13"
dependencies = [
"arboard",
"base64 0.22.1",
@@ -1778,6 +1997,8 @@ dependencies = [
"tauri-plugin-fs",
"tauri-plugin-http",
"tauri-plugin-log",
"tauri-plugin-notification",
"tauri-plugin-single-instance",
"tauri-plugin-updater",
]
@@ -2120,6 +2341,20 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4050469837a6ff301cd14c1f8f24f88549e6d548f24f64e2148eb0f72cebc51f"
[[package]]
name = "mac-notification-sys"
version = "0.6.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd604973958ddcc11b561193c0fb96ba146506ef2f231ef2e7c35fd2cbc9beca"
dependencies = [
"cc",
"log",
"objc2",
"objc2-foundation",
"time",
"uuid",
]
[[package]]
name = "markup5ever"
version = "0.39.0"
@@ -2285,6 +2520,20 @@ dependencies = [
"libc",
]
[[package]]
name = "notify-rust"
version = "4.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57da5b5d3b7809bf71858da5a2818c3404ca4688c02c8abecdda0fcdec235df3"
dependencies = [
"futures-lite",
"log",
"mac-notification-sys",
"serde",
"tauri-winrt-notification",
"zbus 6.3.0",
]
[[package]]
name = "num-conv"
version = "0.2.2"
@@ -2559,6 +2808,16 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "ordered-stream"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50"
dependencies = [
"futures-core",
"pin-project-lite",
]
[[package]]
name = "osakit"
version = "0.3.1"
@@ -2598,6 +2857,12 @@ dependencies = [
"system-deps",
]
[[package]]
name = "parking"
version = "2.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba"
[[package]]
name = "parking_lot"
version = "0.12.5"
@@ -2739,6 +3004,17 @@ version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
[[package]]
name = "piper"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1"
dependencies = [
"atomic-waker",
"fastrand",
"futures-io",
]
[[package]]
name = "pkg-config"
version = "0.3.34"
@@ -2771,6 +3047,20 @@ dependencies = [
"miniz_oxide 0.8.9",
]
[[package]]
name = "polling"
version = "3.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218"
dependencies = [
"cfg-if",
"concurrent-queue",
"hermit-abi",
"pin-project-lite",
"rustix",
"windows-sys 0.61.2",
]
[[package]]
name = "portable-atomic"
version = "1.15.0"
@@ -3660,6 +3950,16 @@ version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
[[package]]
name = "signal-hook-registry"
version = "1.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b"
dependencies = [
"errno",
"libc",
]
[[package]]
name = "simd-adler32"
version = "0.3.10"
@@ -4215,6 +4515,42 @@ dependencies = [
"time",
]
[[package]]
name = "tauri-plugin-notification"
version = "2.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14a226bfb8189ec4ab2c1936e66330ad06c44d9f6c54a674338208491dee177f"
dependencies = [
"log",
"notify-rust",
"rand",
"serde",
"serde_json",
"serde_repr",
"tauri",
"tauri-plugin",
"thiserror 2.0.21",
"time",
"url",
"zbus 5.19.0",
]
[[package]]
name = "tauri-plugin-single-instance"
version = "2.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "726b6da0dd5bd1344f84f4108a622c07d01923baacb5c803a605189672c5352f"
dependencies = [
"serde",
"serde_json",
"tauri",
"thiserror 2.0.21",
"tokio",
"tracing",
"windows-sys 0.61.2",
"zbus 5.19.0",
]
[[package]]
name = "tauri-plugin-updater"
version = "2.14.1"
@@ -4348,6 +4684,17 @@ dependencies = [
"toml 1.2.1+spec-1.1.0",
]
[[package]]
name = "tauri-winrt-notification"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f37a6c354fd28fc9e322ed9bd47e3959576dad28c9d58ea1cf888cce1c7ccb36"
dependencies = [
"thiserror 2.0.21",
"windows",
"windows-version",
]
[[package]]
name = "tempfile"
version = "3.27.0"
@@ -4670,9 +5017,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
dependencies = [
"pin-project-lite",
"tracing-attributes",
"tracing-core",
]
[[package]]
name = "tracing-attributes"
version = "0.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.119",
]
[[package]]
name = "tracing-core"
version = "0.1.36"
@@ -4728,6 +5087,17 @@ version = "1.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
[[package]]
name = "uds_windows"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e"
dependencies = [
"memoffset",
"tempfile",
"windows-sys 0.61.2",
]
[[package]]
name = "unicode-ident"
version = "1.0.27"
@@ -5557,6 +5927,128 @@ dependencies = [
"synstructure",
]
[[package]]
name = "zbus"
version = "5.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907"
dependencies = [
"async-broadcast",
"async-executor",
"async-io",
"async-lock",
"async-process",
"async-recursion",
"async-task",
"async-trait",
"blocking",
"enumflags2",
"event-listener",
"futures-core",
"futures-lite",
"hex",
"libc",
"ordered-stream",
"rustix",
"serde",
"serde_repr",
"tracing",
"uds_windows",
"uuid",
"windows-sys 0.61.2",
"winnow 1.0.5",
"zbus_macros 5.19.0",
"zbus_names",
"zvariant",
]
[[package]]
name = "zbus"
version = "6.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b4aae740b23927ceabed962431abab2cdefb9f7f885e5bbab062da09bf580e4"
dependencies = [
"async-trait",
"bitflags 2.13.2",
"endi",
"futures-core",
"hex",
"libc",
"ordered-stream",
"rustix",
"serde",
"serde_repr",
"socket2",
"uds_windows",
"uuid",
"windows-sys 0.61.2",
"winnow 1.0.5",
"zbus_macros 6.3.0",
"zbus_utils",
"zcheapstr",
"zruntime",
]
[[package]]
name = "zbus_macros"
version = "5.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40"
dependencies = [
"proc-macro-crate 3.5.0",
"proc-macro2",
"quote",
"syn 3.0.10",
"zbus_names",
"zvariant",
"zvariant_utils",
]
[[package]]
name = "zbus_macros"
version = "6.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37c9dd4beaf145c16fcb2902862f50da86e54aed13dd368ddf64a1d17e6b8529"
dependencies = [
"proc-macro2",
"quote",
"syn 3.0.10",
"zbus_utils",
]
[[package]]
name = "zbus_names"
version = "4.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "812a12be4ead7a59e18ea8f047d08add0066b73bc62fc1467066a2472ae088dd"
dependencies = [
"serde",
"winnow 1.0.5",
"zvariant",
]
[[package]]
name = "zbus_utils"
version = "6.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af55e52da295311b368c45bcae221f020e28e97a2420360170ce389218e76ec7"
dependencies = [
"proc-macro2",
"quote",
"serde",
"syn 3.0.10",
"winnow 1.0.5",
]
[[package]]
name = "zcheapstr"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "939f186d9ecebe044315a5cb6d6f78568bbc21152adc954d5a0c2f58bdbc9920"
dependencies = [
"serde",
]
[[package]]
name = "zerocopy"
version = "0.8.63"
@@ -5681,6 +6173,19 @@ version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
[[package]]
name = "zruntime"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce6a55d4f521760475a30f7b96779508fe8c40dc834478709454dd1d5f0ebc72"
dependencies = [
"futures-core",
"futures-io",
"rustix",
"socket2",
"windows-sys 0.61.2",
]
[[package]]
name = "zune-core"
version = "0.5.3"
@@ -5695,3 +6200,44 @@ checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296"
dependencies = [
"zune-core",
]
[[package]]
name = "zvariant"
version = "5.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80bf6d6cd6a4b601acb64cfb8284cdc643fcfa75ef26ae3c46ec8aa4e8a1fbb7"
dependencies = [
"endi",
"enumflags2",
"serde",
"winnow 1.0.5",
"zcheapstr",
"zvariant_derive",
"zvariant_utils",
]
[[package]]
name = "zvariant_derive"
version = "5.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef2672456ba1cb54b5eaec136e63135b3c7495fb938e53b28a62e633496d486d"
dependencies = [
"proc-macro-crate 3.5.0",
"proc-macro2",
"quote",
"syn 3.0.10",
"zvariant_utils",
]
[[package]]
name = "zvariant_utils"
version = "4.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3"
dependencies = [
"proc-macro2",
"quote",
"serde",
"syn 3.0.10",
"winnow 1.0.5",
]
+3 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "image-workbench"
version = "3.25.7"
version = "3.25.13"
description = "无限画布 · 生图工作台桌面版"
authors = ["malongan"]
license = ""
@@ -29,6 +29,8 @@ tauri-plugin-dialog = "2"
tauri-plugin-fs = "2"
tauri-plugin-http = "2"
tauri-plugin-updater = "2"
tauri-plugin-single-instance = "2"
tauri-plugin-notification = "2"
arboard = "3"
image = { version = "0.25", default-features = false, features = ["png"] }
base64 = "0.22"
+55 -7
View File
@@ -48,12 +48,13 @@ fn restore_geom(win: &WebviewWindow, app: &AppHandle) {
let Some(p) = geom_file(app) else { return };
let Ok(txt) = std::fs::read_to_string(p) else { return };
let Ok(g) = serde_json::from_str::<WindowGeom>(&txt) else { return };
if g.w < 800 || g.h < 500 {
return;
}
let _ = win.set_size(PhysicalSize::new(g.w, g.h));
let cx = g.x + (g.w as i32) / 2;
let cy = g.y + (g.h as i32) / 2;
// 最小尺寸与 tauri.conf.json 的 minWidth/minHeight 对齐:否则会恢复出一个
// 比窗口下限还小的窗口(实测 1051x488 时画布渲染成空白)
let w = g.w.max(1024);
let h = g.h.max(640);
let _ = win.set_size(PhysicalSize::new(w, h));
let cx = g.x + (w as i32) / 2;
let cy = g.y + (h as i32) / 2;
let visible = win
.available_monitors()
.map(|ms| {
@@ -318,14 +319,61 @@ fn clipboard_write_image(png_base64: String) -> Result<bool, String> {
Ok(true)
}
fn open_external(url: &str) -> Result<(), String> {
#[cfg(target_os = "macos")]
{
std::process::Command::new("open").arg(url).spawn().map(|_| ()).map_err(|e| e.to_string())
}
#[cfg(target_os = "windows")]
{
std::process::Command::new("cmd")
.args(["/C", "start", "", url])
.spawn()
.map(|_| ())
.map_err(|e| e.to_string())
}
#[cfg(all(unix, not(target_os = "macos")))]
{
std::process::Command::new("xdg-open").arg(url).spawn().map(|_| ()).map_err(|e| e.to_string())
}
}
#[tauri::command]
fn open_external_url(url: String) -> Result<bool, String> {
if !(url.starts_with("http://") || url.starts_with("https://")) {
return Err("只允许 http/https".into());
}
open_external(&url)?;
Ok(true)
}
#[tauri::command]
fn notify_desktop(app: tauri::AppHandle, title: String, body: String) -> Result<bool, String> {
use tauri_plugin_notification::NotificationExt;
match app.notification().builder().title(title).body(body).show() {
Ok(_) => Ok(true),
Err(e) => Err(e.to_string()),
}
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
let app = tauri::Builder::default()
.plugin(tauri_plugin_single_instance::init(|app, _argv, _cwd| {
// 第二次启动:聚焦已有窗口(多实例同时写同一个资料目录会把 data.json 写坏)
if let Some(w) = app.get_webview_window("main") {
let _ = w.show();
let _ = w.unminimize();
let _ = w.set_focus();
}
}))
.plugin(tauri_plugin_notification::init())
.plugin(tauri_plugin_http::init())
.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, clipboard_write_text, clipboard_read_text])
.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, open_external_url, notify_desktop])
.setup(|app| {
if cfg!(debug_assertions) {
app.handle().plugin(
+2 -2
View File
@@ -1,7 +1,7 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "image-workbench",
"version": "3.25.7",
"version": "3.25.13",
"identifier": "com.malongan.imageworkbench",
"build": {
"frontendDist": "../dist",
@@ -25,7 +25,7 @@
}
],
"security": {
"csp": "default-src 'self'; script-src 'self' blob:; worker-src 'self' blob:; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https:; font-src 'self' data:; connect-src 'self' ipc: http://ipc.localhost https: blob: data: http://127.0.0.1:30092 http://localhost:30092 http://127.0.0.1:3425 http://localhost:3425; object-src 'none'; base-uri 'none'; frame-ancestors 'none'"
"csp": "default-src 'self'; script-src 'self' blob:; worker-src 'self' blob:; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https:; font-src 'self' data:; connect-src 'self' ipc: http://ipc.localhost https: blob: data:; object-src 'none'; base-uri 'none'; frame-ancestors 'none'"
}
},
"bundle": {
+8
View File
@@ -0,0 +1,8 @@
{
"bundle": {
"targets": [
"app",
"dmg"
]
}
}
+7
View File
@@ -0,0 +1,7 @@
{
"bundle": {
"targets": [
"nsis"
]
}
}
+5 -26
View File
@@ -1119,22 +1119,10 @@
// 而 MIME 没填的 PNG 反倒被静默丢掉(Windows 资源管理器就这行为)。
const A = global.IWBImageAdmit
const refused = []
/* 同图去重(v3.24.75):拖进来的字节与画布上已有图片一致时不再建节点。
* 判据见 src/image-dedupe.js —— 只认本地图片字节,URL / 复制节点组都不参与。
* 多条命中合并成一条提示(拖 5 张重复图不该刷 5 条),并选中已有节点把位置指出来。 */
const D = global.IWBImageDedupe
const idx = (D && typeof D.index === 'function') ? D.index(refs.nodes) : null
const dupNames = []
const dupIds = []
const flushDups = () => {
if (!dupNames.length) return
const ns = dupNames.splice(0, dupNames.length)
const ids = dupIds.splice(0, dupIds.length)
if (ids.length) setSel(ids)
setNotice({ type: 'ok', text: ns.length === 1
? ('「' + ns[0] + '」已经在画布上了,没有重复导入' + (ids.length ? '(已选中原来的节点)' : ''))
: (ns.length + ' 张图已经在画布上了,没有重复导入' + (ids.length ? '(已选中原来的节点)' : '')) })
}
/* v3.25.8(用户裁定):拖入同一张图**允许重复添加**,不再走同图去重。
* 去重曾经挡住「图片节点数据缺失后重新拖入」这条唯一的自愈路径:命中已有节点 →
* 不写 blob → 那个节点依旧是空图。现在每次都正常导入并新建节点,顺带把丢失的
* blob 按同一个内容 key 重新写回磁盘(旧节点也就跟着恢复了)。 */
for (const f of files) {
const verdict = (A && typeof A.of === 'function') ? A.of(f) : ((f.type && f.type.indexOf('image/') === 0) ? 'image' : 'other')
if (verdict !== 'image') { refused.push(f); continue }
@@ -1143,16 +1131,7 @@
// 拖放与粘贴共用导入唯一收口(压缩到 ≤1600 + 立即引用化)
rd.onload = () => wImportImage(rd.result, { onError: (msg) => setNotice({ type: 'err', text: msg }) }, (r) => {
if (!r || !r.ok || !r.data) return
const hitId = idx ? idx.hit(r.data) : ''
if (hitId) {
dupNames.push(String(f.name || '图片'))
if (dupIds.indexOf(hitId) < 0) dupIds.push(hitId)
clearTimeout(refs.dupNoticeTimer)
refs.dupNoticeTimer = setTimeout(flushDups, 260)
return
}
const nid = mk({ url: '', data: r.data, name: f.name })
if (idx) idx.add(r.data, nid)
mk({ url: '', data: r.data, name: f.name })
})
rd.onerror = () => setNotice({ type: 'err', text: '读取拖入的图片失败:' + String(f.name || '') })
rd.readAsDataURL(f)
+59 -6
View File
@@ -176,16 +176,26 @@
const kv = {
async put(key, value) {
try {
if (!enabled() || !dir) return false
// 返回对象而不是裸 false:调用方(ImageBlobStore.put)用 r.ok===false 判断失败,
// 裸布尔 false 会被误判为成功,产出指向空文件的 {__blob}(v3.25.10 修)。
if (!enabled() || !dir) return { ok: false, error: 'not-ready' }
if (value && typeof value === 'object' && typeof value.size === 'number' && value.type !== undefined) {
// Blob:直接取二进制落盘
const buf = await value.arrayBuffer()
const hash = await sha16(buf)
const rel = IMG_DIR + '/' + catOfKey(key) + '/' + hash + '.' + extOf(value.type)
const cat = catOfKey(key)
const rel = IMG_DIR + '/' + cat + '/' + hash + '.' + extOf(value.type)
const abs = await join(dir, rel)
// Windows 全新安装时 images/canvas|gallery 并不存在(只有 thumbs 因为 writeDisplayThumb 会 mkdir),
// 直接 writeFile 会失败 → 整条 blob 写入被判失败 → 图片退化成不持久引用。
// 这里先建目录(幂等),与 thumbs 的写法保持一致。
try { await fs().mkdir(await join(dir, IMG_DIR, cat), { recursive: true }) } catch (e) { /* 已存在 */ }
await fs().writeFile(abs, new Uint8Array(buf))
assets[String(key)] = { f: rel, k: 'blob', m: value.type || 'application/octet-stream' }
schedule()
// 立即落盘:登记表只存在 data.json 里,晚 800ms 就可能被强杀丢掉,
// 而画布文件是即时写的 ⇒ 引用还在、登记没了,GC 会把在用图片当孤儿。
await flush()
return true
}
const s = String(value)
@@ -193,11 +203,14 @@
const dec = dataUrlToBytes(s)
if (dec) {
const hash = await sha16(dec.bytes)
const rel = IMG_DIR + '/' + catOfKey(key) + '/' + hash + '.' + extOf(dec.mime)
const cat2 = catOfKey(key)
const rel = IMG_DIR + '/' + cat2 + '/' + hash + '.' + extOf(dec.mime)
const abs = await join(dir, rel)
try { await fs().mkdir(await join(dir, IMG_DIR, cat2), { recursive: true }) } catch (e) { /* 已存在 */ }
await fs().writeFile(abs, dec.bytes)
assets[String(key)] = { f: rel, k: 'dataurl', m: dec.mime }
schedule()
await flush()
return true
}
}
@@ -206,7 +219,7 @@
return true
} catch (e) {
try { global.IWBMetricsSwallow && global.IWBMetricsSwallow('file-kv-put', e) } catch (e2) { /* ignore */ }
return false
return { ok: false, error: String((e && e.message) || e) }
}
},
async get(key) {
@@ -611,6 +624,15 @@
return true
}
/* 建立工作必需目录:canvases/ library/ plugins/ trash/ 与 images/{canvas,gallery,thumbs,legacy} */
async function ensureDirs() {
const subs = [CANVAS_DIR, 'library', PLUG_DIR, 'trash', IMG_DIR, IMG_DIR + '/canvas', IMG_DIR + '/gallery', IMG_DIR + '/thumbs', IMG_DIR + '/legacy']
for (const sub of subs) {
try { await fs().mkdir(await join(dir, sub), { recursive: true }) } catch (e) { /* 已存在或不可写:继续下一个 */ }
}
return true
}
async function init(opts) {
const o = opts || {}
tauri = global.__TAURI__ || null
@@ -634,6 +656,11 @@
dir = want
try { global.localStorage.setItem(PTR_KEY, dir) } catch (e) { /* ignore */ }
try { await fs().mkdir(await join(dir, IMG_DIR), { recursive: true }) } catch (e) { /* 已存在 */ }
// 兜底:把工作必需的子目录一次性补齐(幂等)。
// 为什么需要:Windows 全新安装时 images/ 下只有 thumbs/,缺了 canvas/ 会导致
// 图片写入失败(历史 bug:写进不持久的 Cache → 重启丢图);目录被手工删掉时也靠这里自愈,
// 否则启动阶段读目录抛错会直接影响首屏渲染。
try { await ensureDirs() } catch (e) { /* 建目录失败不阻塞启动 */ }
try { await repairCanvasFileNames() } catch (e) { /* 修复失败按原样装载 */ }
await loadInto()
// 从 WebView 的 localStorage 捞回被截断/覆盖的画布(一次性)
@@ -811,6 +838,28 @@
try {
if (!enabled() || !dir) return { ok: false, error: '资料目录未就绪' }
const used = new Set(Object.keys(assets).map((k) => assets[k] && assets[k].f).filter(Boolean))
/* v3.25.8:assets 登记表是唯一的「在用」判据,但它可能因为恢复备份/迁移而落后于画布。
* 只看 assets 会把画布仍在引用的图片当孤儿挪进 trash/ —— 节点随即变成占位图,
* 而且用户重新拖入时又被同图去重挡回来(那条链路已废)。
* 这里把 canvases/*.json 里出现的 {__blob} key 也算作在用:宁可留下几 MB,也不误删用户图片。 */
const canvasKeys = new Set()
try {
const cd = await join(dir, 'canvases')
const list = await fs().readDir(cd)
for (const e of list) {
if (!e || e.isDirectory || !/\.json$/i.test(e.name) || e.name === 'active.json') continue
let txt = ''
try { txt = await fs().readTextFile(await join(cd, e.name)) } catch (err) { continue }
const m = txt.match(/"__blob"\s*:\s*"([^"]+)"/g) || []
for (const hit of m) {
const km = /"([^"]+)"$/.exec(hit)
if (km) canvasKeys.add(km[1])
}
}
} catch (e) { /* 画布读不到就退回旧判据 */ }
const referenced = new Set()
for (const k of canvasKeys) { const a = assets[k]; if (a && a.f) referenced.add(a.f) }
referenced.forEach((f) => used.add(f))
const imgAbs = await join(dir, IMG_DIR)
// 子目录也要扫:images/{canvas,gallery,thumbs,legacy}/ 里的孤儿同样占空间
const subs = ['', 'canvas', 'gallery', 'thumbs', 'legacy']
@@ -825,7 +874,11 @@
if (!used.has(rel)) orphans.push({ sub: sub, name: e.name, rel: rel })
}
}
if (dryRun || !orphans.length) return { ok: true, orphans: orphans.length, moved: 0, dryRun: dryRun }
// 断链:画布引用了、但登记表里没有的 key —— 这类节点的图**已经显示不出来**,
// GC 不会动它们(文件根本不在),但值得在确认弹窗里报数,让用户知道数据已经缺了。
const dangling = Array.from(canvasKeys).filter((k) => !assets[k]).length
const keptByCanvas = referenced.size
if (dryRun || !orphans.length) return { ok: true, orphans: orphans.length, moved: 0, dryRun: dryRun, dangling: dangling, keptByCanvas: keptByCanvas }
const trashAbs = await join(dir, 'trash')
let moved = 0
for (const item of orphans) {
@@ -836,7 +889,7 @@
moved++
} catch (e) { /* 单条失败忽略 */ }
}
return { ok: true, orphans: orphans.length, moved: moved, dryRun: dryRun }
return { ok: true, orphans: orphans.length, moved: moved, dryRun: dryRun, dangling: dangling, keptByCanvas: keptByCanvas }
} catch (e) { return { ok: false, error: String((e && e.message) || e) } }
}
+85
View File
@@ -0,0 +1,85 @@
/* ui-desktop-shell.js —— 桌面端外壳适配(2026-11-18)
*
* 平台迁移后需要「网页做不到、只有桌面壳能做」的三件事,集中放这里,
* 避免 app.js 继续膨胀(source-text-ratchet 上限):
* 1) 外链一律交给系统浏览器:桌面 webview 里点 <a target=_blank> 会把整个应用导航成网页
* 2) 桌面原生通知:WKWebView 不支持 Web Notification
* 3) 捕获阶段拦截外链点击(含中键)
*
* 网页版不装 Tauri,isTauri() 恒 false ⇒ 全部走浏览器原生行为,语义不变。
*/
;(function (global) {
'use strict'
const g = /** @type {any} */ (global || {})
const EXTERNAL_RE = /^https?:\/\//i
function tauri () {
const T = g.__TAURI__
return (T && T.core && typeof T.core.invoke === 'function') ? T : null
}
function openExternal (url) {
const u = String(url || '')
if (!EXTERNAL_RE.test(u)) return false
const T = tauri()
if (T) {
try { T.core.invoke('open_external_url', { url: u }) } catch (e) { /* 忽略:下面还会尝试原生窗口 */ }
return true
}
try { global.open(u, '_blank', 'noopener') } catch (e) { /* ignore */ }
return true
}
/** 生成完成通知:桌面走原生;返回 true 表示已处理(调用方不要再走 Web Notification) */
function notifyGenerationDone (info) {
if (!tauri()) return false
const x = info || {}
const total = Number(x.total) || 0
const failed = Number(x.failed) || 0
const title = failed ? '出图完成(部分失败)' : '出图完成'
const body = failed
? ('成功 ' + Math.max(0, total - failed) + ' 张,失败 ' + failed + ' 张')
: ('共生成 ' + total + ' 张图片')
try { tauri().core.invoke('notify_desktop', { title: title, body: body }) } catch (e) { /* ignore */ }
return true
}
function notifyDesktop (title, body) {
const T = tauri()
if (!T) return false
try { T.core.invoke('notify_desktop', { title: String(title || ''), body: String(body || '') }) } catch (e) { /* ignore */ }
return true
}
/* 捕获阶段拦截外链点击(含中键):桌面端不允许把应用窗口导航走 */
function installLinkGuard (isTauri) {
if (typeof document === 'undefined' || !document.addEventListener) return false
if (isTauri && !isTauri()) return false
const pick = (e) => {
const t = e.target
const a = (t && t.closest) ? t.closest('a[href]') : null
if (!a) return ''
const href = a.getAttribute('href') || ''
return EXTERNAL_RE.test(href) ? href : ''
}
document.addEventListener('click', (e) => {
const href = pick(e)
if (!href) return
e.preventDefault()
e.stopPropagation()
openExternal(href)
}, true)
document.addEventListener('auxclick', (e) => {
if (e.button !== 1) return
const href = pick(e)
if (!href) return
e.preventDefault()
openExternal(href)
}, true)
return true
}
g.IWBUIShell = Object.freeze({ openExternal, notifyDesktop, notifyGenerationDone, installLinkGuard })
})(typeof window !== 'undefined' ? window : globalThis)
+9 -2
View File
@@ -594,9 +594,16 @@
const rDry = await F.gcImages({ dryRun: true })
if (!rDry.ok) { setNote('检查失败:' + rDry.error); return }
if (!rDry.orphans) { setNote('没有未引用的图片'); return }
if (!(await askConfirm('发现 ' + rDry.orphans + ' 个文件没有被画布/图库引用。移动到 trash/(不直接删除)?', { title: '清理未引用图片', okText: '移动' }))) return
// 确认弹窗必须把「会不会动到在用的图」讲清楚:这是破坏性动作,不能只报一个数字。
const lines = ['发现 ' + rDry.orphans + ' 个文件没有被画布/图库引用。']
if (rDry.keptByCanvas) lines.push('其中 ' + rDry.keptByCanvas + ' 张虽然登记表里没有,但画布仍在引用 → 会自动保留。')
if (rDry.dangling) lines.push('另有 ' + rDry.dangling + ' 处画布引用已经找不到图片(之前丢的,本次不影响它们)。')
lines.push('移动到 trash/(不直接删除,可在回收站找回)?')
if (!(await askConfirm(lines.join('\n'), { title: '清理未引用图片', okText: '移动' }))) return
const rGo = await F.gcImages({ dryRun: false })
setNote(rGo.ok ? ('已移入 trash/:' + rGo.moved + ' 个文件') : ('清理失败:' + rGo.error))
setNote(rGo.ok
? ('已移入 trash/:' + rGo.moved + ' 个文件' + (rGo.dangling ? (';另有 ' + rGo.dangling + ' 处引用已缺图') : ''))
: ('清理失败:' + rGo.error))
} catch (e) { setNote('清理失败:' + String((e && e.message) || e)) }
} }, '清理未引用图片'),
),
+1
View File
@@ -61,6 +61,7 @@
"generation-results-store.js",
"ui-groups-sidebar.js",
"ui-lib-sidebar.js",
"ui-desktop-shell.js",
"ui-workspace-tabs.js",
"ui-app-chrome.js",
"ui-workbench-hooks.js",
+2 -2
View File
@@ -2544,7 +2544,7 @@ const nodeXY = (el0) => {
// 140-1 主通道与回退链:IDB Blob 优先,put 失败/不支持/开关关闭 ⇒ 自动回退 iwbCacheWrite,且不抛错打断保存。
assert('140-1 新写入主通道 IDB Blob + 失败回退 Cache(put 未确认 ok 不产出 __blob;catch 不抛错)',
/if \(W_IMG_BLOB_PRIMARY && ImageBlobStore\) \{[\s\S]{0,240}?ImageBlobStore\.put\(dataUrl\)[\s\S]{0,200}?if \(r && r\.ok && r\.key\) return \{ __blob: String\(r\.key\) \}/.test(app53)
/if \(W_IMG_BLOB_PRIMARY && wImageBlobStore\(\)\) \{[\s\S]{0,240}?wImageBlobStore\(\)\.put\(dataUrl\)[\s\S]{0,200}?if \(r && r\.ok && r\.key\) return \{ __blob: String\(r\.key\) \}/.test(app53)
// 2026-11-07 错误可见性:catch 仍不抛错(保持原语义),但改为记账 + 面包屑留痕
&& /catch \(e\) \{ swallow\('image', e\) \}/.test(app53)
&& /const c = await iwbCacheWrite\(dataUrl\)[\s\S]{0,80}?return \(c && c\.__cache\) \? c : null/.test(app53))
@@ -2563,7 +2563,7 @@ const nodeXY = (el0) => {
// 142-1 GC 覆盖:imgblob_ 前缀的保留集合含画布/剪贴板/撤销历史/收藏组,只在无人引用时才回收。
assert('142-1 wCleanIdb 对 imgblob_ 保留/回收正确:画布引用 + 剪贴板 + 撤销历史 + 收藏组都进 keep,未引用才 del',
/if \(k\.indexOf\(IMG_BLOB_PREFIX\) === 0\) \{/.test(app53)
&& /if \(!keep\.has\(k\)\) \{[\s\S]{0,160}?ImageBlobStore\.del\(k\)/.test(app53)
&& /if \(!keep\.has\(k\)\) \{[\s\S]{0,160}?wImageBlobStore\(\)\.del\(k\)/.test(app53)
&& /if \(wIsBlobRef\(value\)\) \{ keep\.add\(String\(value\.__blob\)\); return \}/.test(app53)
&& /wClipCollectRefs\(keep\)/.test(app53)
&& /wCollectImgRefKeys\(wHistorySnapshotNodes\(\)\)/.test(app53)
+1 -1
View File
@@ -150,7 +150,7 @@ const MAX_SRC_COMPONENT_LINES = 531
// ② 同时守「app.js 占总源码 ≤ 40%」(2026-11-12 实测 38.4%)—— app.js 可以涨,
// 但必须涨得比 src 慢;功能继续加,占比自然往下走;
// ③ Workbench 单函数上限**不动**(3,091)—— 那才是真坏味道的护栏,总量松它不松。
const MAX_APP_JS_LINES = 8890 // 2026-11-17 P3:开发者模式本地插件加载器(+37 行) // 2026-11-17:市场请求改走原生 HTTP(+2 行 helper) // 2026-11-17 桌面版:插件市场(索引拉取/下载/sha256/写入 plugins/)约 +53 行;待抽到 src/runtime-plugin-market.js 后回调
const MAX_APP_JS_LINES = 8905 // 2026-11-18 桌面迁移修复:桌面端不回退 Cache Storage(WebView2 不持久)+ 存储自检接线,净增约 20 行;逻辑主体已抽到 src/ui-desktop-shell.js // 2026-11-17 P3:开发者模式本地插件加载器(+37 行) // 2026-11-17:市场请求改走原生 HTTP(+2 行 helper) // 2026-11-17 桌面版:插件市场(索引拉取/下载/sha256/写入 plugins/)约 +53 行;待抽到 src/runtime-plugin-market.js 后回调
const MAX_APP_JS_SHARE = 0.40
// ── 历史记账(供回溯,逐条保留)──────────────────────────────────────────────
+39
View File
@@ -0,0 +1,39 @@
/* storage-gc-canvas-refs-test.js —— GC 必须把画布引用算作「在用」(v3.25.9)
*
* 为什么用源码断言而不是跑行为:
* storage-file 的 gcImages 依赖 Tauri fs/path 注入与真实目录,在 Node 下完整模拟
* 等于重写一遍宿主,收益不如直接钉住「关键判据存在且顺序正确」。
* 这里钉三条:
* ① gcImages 会扫 canvases/*.json 里的 {__blob}
* ② 扫出来的 key 会并入 used 集合(少这一步等于没扫)
* ③ dryRun 报告 dangling / keptByCanvas,供确认弹窗展示
* 另加一条:图片登记后必须立即 flush(登记表不能落后于画布)。
*/
'use strict'
const fs = require('node:fs')
const path = require('node:path')
const assert = require('node:assert')
const SRC = fs.readFileSync(path.join(__dirname, '..', 'src', 'storage-file.js'), 'utf8')
const gcBody = SRC.slice(SRC.indexOf('async function gcImages'), SRC.indexOf('global.IWBStorageFile = {'))
assert.ok(gcBody.length > 200, '① 找不到 gcImages 实现')
assert.ok(/canvases/.test(gcBody) && /__blob/.test(gcBody), '① gcImages 必须扫 canvases 里的 __blob 引用')
assert.ok(/canvasKeys/.test(gcBody), '① 必须收集 canvasKeys')
assert.ok(/referenced.forEach\(\(f\) => used\.add\(f\)\)/.test(gcBody), '② 扫到的引用必须并入 used 集合(否则等于没扫)')
assert.ok(/dangling/.test(gcBody), '③ dryRun 必须报 dangling(断链引用数)')
assert.ok(/keptByCanvas/.test(gcBody), '③ dryRun 必须报 keptByCanvas(因画布引用而保留的数量)')
assert.ok(gcBody.indexOf('canvasKeys') < gcBody.indexOf('used.has(rel)'), '② 顺序错:必须先算引用再判孤儿', gcBody.indexOf('canvasKeys') + ' vs ' + gcBody.indexOf('used.has(rel)'))
// 登记后立即落盘:blob 与 dataurl 两条登记路径都要 await flush()
const putRegions = SRC.split('assets[String(key)] = {')
assert.ok(putRegions.length >= 3, '应至少有两处 assets 登记')
let flushed = 0
for (let i = 1; i < putRegions.length; i++) {
const seg = putRegions[i].slice(0, 400)
if (/await flush\(\)/.test(seg)) flushed++
}
assert.ok(flushed >= 2, '图片登记后必须立刻 await flush()(当前 ' + flushed + '/2 处)')
console.log('storage-gc-canvas-refs: 8 通过 / 0 失败')