Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf93080d17 | ||
|
|
1ffe067e12 | ||
|
|
58d8d9c43a | ||
|
|
0e15e29c18 | ||
|
|
d8c8717826 | ||
|
|
9e400e2348 | ||
|
|
2f9a326159 | ||
|
|
56b5f49646 | ||
|
|
49b419251e | ||
|
|
57fc63dc10 | ||
|
|
36276455ea | ||
|
|
1afd5d7521 | ||
|
|
22ecd268cf | ||
|
|
0c39873a1a | ||
|
|
fa7c866457 | ||
|
|
fc199776d9 |
No files matched your search
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"nodes": [],
|
||||
"edges": [],
|
||||
"groups": []
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"activeCanvas": "Main"
|
||||
}
|
||||
+119
@@ -14,6 +14,125 @@
|
||||
> 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)剪贴板体检:大图卡顿、路径误判、粘贴落点
|
||||
|
||||
### 修复
|
||||
- **大图剪贴板卡顿**:原先 IPC 传裸 RGBA(12MP 照片 46MB → base64 62MB)。
|
||||
改为传 PNG:读方向由 Rust 编码,写方向直接把 Blob 的 PNG 字节发过去,体积降到几 MB。
|
||||
- **Finder「复制图片」被当成文本粘贴**:macOS 复制图片时常同时给 file:// 文本,
|
||||
classify 会落进文本分支贴出「路径提示词节点」。现在路径样式的文本先问原生剪贴板要图片。
|
||||
- **原生读图一直失效**:Rust 结构体字段是 `png_base64`,前端读的是 `pngBase64`,取不到值。
|
||||
结构体加 `#[serde(rename_all = "camelCase")]`,前端两种写法都兼容。
|
||||
- **节点组粘贴落点**:Ctrl+V 贴节点/节点组也走 `safeSeed`,面板打开时不会被遮住。
|
||||
|
||||
### 清理
|
||||
- 删除已废弃的 `rejectDup` 与 `pasteCtx.closeLibrary`(粘贴不再关闭库面板)。
|
||||
|
||||
## 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
@@ -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 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)
|
||||
|
||||
@@ -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,
|
||||
@@ -7202,6 +7233,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,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 = 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
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "image-workbench-web",
|
||||
"private": true,
|
||||
"version": "3.25.3",
|
||||
"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/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",
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -54,6 +54,18 @@ echo "== 4/4 生成 latest.json"
|
||||
export SIG_ARM="$(cat "$ARM/macos/image-workbench.app.tar.gz.sig")"
|
||||
export SIG_INT="$(cat "$INT/macos/image-workbench.app.tar.gz.sig")"
|
||||
export UPD_VERSION="$V"
|
||||
# Windows 包单独构建:全局 version 提升后,旧 windows 条目会变成「声明新版本、实际旧安装包」,
|
||||
# 客户端会因 app-version 绑定不一致而拒绝安装。所以每次发布 mac 时明确提示并丢弃过期的非 darwin 条目,
|
||||
# 等 Windows 包跟上再用 publish-windows-update.sh 合并回来。
|
||||
curl -s -m 20 https://download.maqiart.eu.org/updates/latest.json -o /tmp/iwb-latest-prev.json 2>/dev/null || echo '{}' > /tmp/iwb-latest-prev.json
|
||||
node -e '
|
||||
const fs = require("fs")
|
||||
let prev = {}
|
||||
try { prev = JSON.parse(fs.readFileSync("/tmp/iwb-latest-prev.json", "utf8")) } catch (e) { prev = {} }
|
||||
const stale = (prev.platforms ? Object.keys(prev.platforms) : []).filter(function (k) { return k.indexOf("darwin-") !== 0 && prev.version !== process.env.UPD_VERSION })
|
||||
if (stale.length) console.log("将丢弃过期的非 darwin 平台条目:" + stale.join(","))
|
||||
'
|
||||
|
||||
node -e '
|
||||
const fs = require("fs")
|
||||
const v = process.env.UPD_VERSION
|
||||
|
||||
Executable
+64
@@ -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"
|
||||
@@ -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.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.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.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,8 +95,48 @@
|
||||
|
||||
<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.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>
|
||||
</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>
|
||||
@@ -116,7 +156,7 @@
|
||||
</div>
|
||||
|
||||
<div class="foot">
|
||||
本页由 <code>scripts/gen-release-page.js</code> 从 releases.json 生成 · 源码 <a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop">git.maqiart.eu.org</a> · 更新于 2026-11-17
|
||||
本页由 <code>scripts/gen-release-page.js</code> 从 releases.json 生成 · 源码 <a href="https://git.maqiart.eu.org/malongan/image-workbench-desktop">git.maqiart.eu.org</a> · 更新于 2026-11-18
|
||||
</div>
|
||||
</div></div>
|
||||
|
||||
|
||||
+7
-7
@@ -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.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.3</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.3-mwkrnrby" 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.3 · 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.3</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.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.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>
|
||||
|
||||
@@ -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.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.3</a>
|
||||
<a class="btn primary" href="/download/">下载 v3.25.13</a>
|
||||
</div>
|
||||
</div></nav>
|
||||
<main>
|
||||
|
||||
+216
-2
@@ -1,12 +1,220 @@
|
||||
{
|
||||
"app": "Image Workbench",
|
||||
"subtitle": "本地优先的 AI 生图无限画布 · 桌面版(Tauri v2)",
|
||||
"updatedAt": "2026-11-17T14:07:06.436Z",
|
||||
"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": "Windows:剪贴板 PNG 传输 + 路径文本转图片 + 大图不卡",
|
||||
"platforms": {
|
||||
"darwin-aarch64": {
|
||||
"file": "updates/darwin-aarch64/image-workbench_3.25.7_aarch64.dmg",
|
||||
"size": 7669562,
|
||||
"sha256": "e4b6b7561391631130a91f0dd408ac03823f5c46963c3a7e5464a75210935af6",
|
||||
"kind": "dmg"
|
||||
},
|
||||
"darwin-x86_64": {
|
||||
"file": "updates/darwin-x86_64/image-workbench_3.25.7_x64.dmg",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"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 +227,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"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Generated
+548
-1
@@ -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,10 +1983,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "image-workbench"
|
||||
version = "3.25.3"
|
||||
version = "3.25.13"
|
||||
dependencies = [
|
||||
"arboard",
|
||||
"base64 0.22.1",
|
||||
"image",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -1777,6 +1997,8 @@ dependencies = [
|
||||
"tauri-plugin-fs",
|
||||
"tauri-plugin-http",
|
||||
"tauri-plugin-log",
|
||||
"tauri-plugin-notification",
|
||||
"tauri-plugin-single-instance",
|
||||
"tauri-plugin-updater",
|
||||
]
|
||||
|
||||
@@ -2119,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"
|
||||
@@ -2284,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"
|
||||
@@ -2558,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"
|
||||
@@ -2597,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"
|
||||
@@ -2738,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"
|
||||
@@ -2770,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"
|
||||
@@ -3659,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"
|
||||
@@ -4214,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"
|
||||
@@ -4347,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"
|
||||
@@ -4669,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"
|
||||
@@ -4727,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"
|
||||
@@ -5556,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"
|
||||
@@ -5680,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"
|
||||
@@ -5694,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",
|
||||
]
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "image-workbench"
|
||||
version = "3.25.3"
|
||||
version = "3.25.13"
|
||||
description = "无限画布 · 生图工作台桌面版"
|
||||
authors = ["malongan"]
|
||||
license = ""
|
||||
@@ -29,5 +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"
|
||||
+113
-29
@@ -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| {
|
||||
@@ -207,6 +208,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())?;
|
||||
@@ -236,18 +250,30 @@ async fn install_update(app: tauri::AppHandle) -> Result<bool, String> {
|
||||
|
||||
use arboard::Clipboard;
|
||||
|
||||
#[derive(serde::Serialize)]
|
||||
struct ClipImagePayload {
|
||||
width: u32,
|
||||
height: u32,
|
||||
rgba_base64: String,
|
||||
}
|
||||
|
||||
fn b64_encode(bytes: &[u8]) -> String {
|
||||
use base64::Engine;
|
||||
base64::engine::general_purpose::STANDARD.encode(bytes)
|
||||
}
|
||||
|
||||
fn b64_decode(s: &str) -> Result<Vec<u8>, String> {
|
||||
use base64::Engine;
|
||||
base64::engine::general_purpose::STANDARD
|
||||
.decode(s.as_bytes())
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
#[derive(serde::Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct ClipImagePayload {
|
||||
width: u32,
|
||||
height: u32,
|
||||
png_base64: String,
|
||||
}
|
||||
|
||||
/// 读系统剪贴板图片 → PNG(base64)
|
||||
///
|
||||
/// 为什么返回 PNG 而不是裸 RGBA:12MP 照片的 RGBA 是 46MB,base64 后 62MB,
|
||||
/// 穿过 IPC 会卡住前端好几秒;PNG 通常只有几 MB。
|
||||
#[tauri::command]
|
||||
fn clipboard_read_image() -> Result<Option<ClipImagePayload>, String> {
|
||||
let mut cb = Clipboard::new().map_err(|e| e.to_string())?;
|
||||
@@ -255,41 +281,99 @@ fn clipboard_read_image() -> Result<Option<ClipImagePayload>, String> {
|
||||
Ok(v) => v,
|
||||
Err(_) => return Ok(None),
|
||||
};
|
||||
let w = img.width as u32;
|
||||
let h = img.height as u32;
|
||||
if w == 0 || h == 0 {
|
||||
return Ok(None);
|
||||
}
|
||||
let raw = img.bytes.into_owned();
|
||||
let buf = image::RgbaImage::from_raw(w, h, raw)
|
||||
.ok_or_else(|| "剪贴板图片像素数据不完整".to_string())?;
|
||||
let mut png: Vec<u8> = Vec::new();
|
||||
{
|
||||
use image::ImageEncoder;
|
||||
let enc = image::codecs::png::PngEncoder::new(&mut png);
|
||||
enc.write_image(buf.as_raw(), w, h, image::ExtendedColorType::Rgba8)
|
||||
.map_err(|e| e.to_string())?;
|
||||
}
|
||||
Ok(Some(ClipImagePayload {
|
||||
width: img.width as u32,
|
||||
height: img.height as u32,
|
||||
rgba_base64: b64_encode(&img.bytes),
|
||||
width: w,
|
||||
height: h,
|
||||
png_base64: b64_encode(&png),
|
||||
}))
|
||||
}
|
||||
|
||||
/// 把 PNG(base64)写进系统剪贴板
|
||||
#[tauri::command]
|
||||
fn clipboard_write_image(width: u32, height: u32, rgba_base64: String) -> Result<bool, String> {
|
||||
use base64::Engine;
|
||||
let bytes = base64::engine::general_purpose::STANDARD
|
||||
.decode(rgba_base64.as_bytes())
|
||||
.map_err(|e| e.to_string())?;
|
||||
let expect = (width as usize) * (height as usize) * 4;
|
||||
if width == 0 || height == 0 || bytes.len() < expect {
|
||||
return Err("图片像素数据不完整".into());
|
||||
}
|
||||
fn clipboard_write_image(png_base64: String) -> Result<bool, String> {
|
||||
let bytes = b64_decode(&png_base64)?;
|
||||
let img = image::load_from_memory(&bytes).map_err(|e| e.to_string())?.to_rgba8();
|
||||
let (w, h) = (img.width() as usize, img.height() as usize);
|
||||
let mut cb = Clipboard::new().map_err(|e| e.to_string())?;
|
||||
cb.set_image(arboard::ImageData {
|
||||
width: width as usize,
|
||||
height: height as usize,
|
||||
bytes: std::borrow::Cow::Owned(bytes),
|
||||
width: w,
|
||||
height: h,
|
||||
bytes: std::borrow::Cow::Owned(img.into_raw()),
|
||||
})
|
||||
.map_err(|e| e.to_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])
|
||||
.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(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||
"productName": "image-workbench",
|
||||
"version": "3.25.3",
|
||||
"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": {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"bundle": {
|
||||
"targets": [
|
||||
"app",
|
||||
"dmg"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"bundle": {
|
||||
"targets": [
|
||||
"nsis"
|
||||
]
|
||||
}
|
||||
}
|
||||
+42
-12
@@ -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)
|
||||
+24
-32
@@ -1,12 +1,13 @@
|
||||
/* native-clipboard.js —— 桌面端原生剪贴板图片(2026-11-17)
|
||||
/* clipboard-native.js —— 桌面端原生剪贴板(2026-11-18)
|
||||
*
|
||||
* 为什么单独一个模块:
|
||||
* WKWebView 的 paste 事件拿不到「从 Finder/预览复制的图片」,
|
||||
* navigator.clipboard.write([ClipboardItem]) 在部分 macOS 版本也不可用。
|
||||
* 图片读写统一走 Rust 侧 arboard(命令 clipboard_read_image / clipboard_write_image),
|
||||
* 这里只做 RGBA ⇄ PNG Blob 的转换与调用封装。
|
||||
* 图片读写统一走 Rust 侧 arboard(命令 clipboard_read_image / clipboard_write_image)。
|
||||
*
|
||||
* 网页版:IWBDesktop 不会把这两个函数注入进来,模块静默不可用,行为与原来一致。
|
||||
* 为什么 IPC 传 PNG 而不是裸 RGBA:
|
||||
* 12MP 照片的 RGBA 是 46MB,base64 后 62MB,穿过 IPC 会卡住前端好几秒;
|
||||
* PNG 通常只有几 MB。读方向由 Rust 编码 PNG,写方向直接把 Blob 的 PNG 字节发过去。
|
||||
*/
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
@@ -30,27 +31,29 @@
|
||||
return u8
|
||||
}
|
||||
|
||||
/** Blob/File → PNG Blob(其它格式统一转一次,避免写进剪贴板后别人贴出来是 HEIC) */
|
||||
function toPngBlob(blobOrFile) {
|
||||
if (blobOrFile && blobOrFile.type === 'image/png') return Promise.resolve(blobOrFile)
|
||||
const C = global.IWBImageBlob
|
||||
if (C && typeof C.toPng === 'function') return Promise.resolve(C.toPng(blobOrFile))
|
||||
return Promise.resolve(blobOrFile)
|
||||
}
|
||||
|
||||
/** 读系统剪贴板里的图片 → PNG File(读不到返回 null) */
|
||||
async function readImage() {
|
||||
const T = tauri()
|
||||
if (!T) return null
|
||||
try {
|
||||
const r = await T.core.invoke('clipboard_read_image')
|
||||
if (!r || !r.width || !r.height || !r.rgbaBase64) return null
|
||||
const u8 = u8FromB64(r.rgbaBase64)
|
||||
const canvas = global.document.createElement('canvas')
|
||||
canvas.width = r.width
|
||||
canvas.height = r.height
|
||||
const ctx = canvas.getContext('2d')
|
||||
const imgData = ctx.createImageData(r.width, r.height)
|
||||
imgData.data.set(u8.subarray(0, r.width * r.height * 4))
|
||||
ctx.putImageData(imgData, 0, 0)
|
||||
const blob = await new Promise((resolve) => canvas.toBlob((b) => resolve(b), 'image/png'))
|
||||
if (!blob) return null
|
||||
const b64 = r && (r.pngBase64 || r.png_base64)
|
||||
if (!b64) return null
|
||||
const u8 = u8FromB64(b64)
|
||||
const blob = new global.Blob([u8], { type: 'image/png' })
|
||||
const name = 'clipboard-' + Date.now() + '.png'
|
||||
try { return new File([blob], name, { type: 'image/png' }) } catch (e) {
|
||||
blob.name = name
|
||||
return blob
|
||||
try { return new global.File([blob], name, { type: 'image/png' }) } catch (e) {
|
||||
const named = /** @type {any} */ (blob)
|
||||
named.name = name
|
||||
return named
|
||||
}
|
||||
} catch (e) { return null }
|
||||
}
|
||||
@@ -60,20 +63,9 @@
|
||||
const T = tauri()
|
||||
if (!T || !blobOrFile) return false
|
||||
try {
|
||||
const C = global.IWBImageBlob
|
||||
const png = (C && typeof C.toPng === 'function') ? await C.toPng(blobOrFile) : blobOrFile
|
||||
const bmp = await global.createImageBitmap(png)
|
||||
const canvas = global.document.createElement('canvas')
|
||||
canvas.width = bmp.width
|
||||
canvas.height = bmp.height
|
||||
const ctx = canvas.getContext('2d')
|
||||
ctx.drawImage(bmp, 0, 0)
|
||||
const data = ctx.getImageData(0, 0, canvas.width, canvas.height).data
|
||||
await T.core.invoke('clipboard_write_image', {
|
||||
width: canvas.width,
|
||||
height: canvas.height,
|
||||
rgbaBase64: b64FromU8(new Uint8Array(data.buffer, data.byteOffset, data.byteLength)),
|
||||
})
|
||||
const png = await toPngBlob(blobOrFile)
|
||||
const buf = new Uint8Array(await png.arrayBuffer())
|
||||
await T.core.invoke('clipboard_write_image', { pngBase64: b64FromU8(buf) })
|
||||
return true
|
||||
} catch (e) { return false }
|
||||
}
|
||||
|
||||
+78
-40
@@ -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,42 +134,43 @@
|
||||
* (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' })
|
||||
|
||||
/* 同图去重(v3.24.75):把这一批里画布上**已有**的图剔掉,只排布剩下的。
|
||||
* 返回 { kept, dupIds, dupCount }:
|
||||
* dupIds —— 命中的已有节点 id(用来"选中原节点",用户才知道东西在哪)
|
||||
* dupCount —— 连同一批内部的重复也算上(粘两张一样的图时,第二张没有"原节点"可选中)
|
||||
* 判据与语义边界见 src/image-dedupe.js(远程链接、复制节点组都**不**去重)。 */
|
||||
function rejectDup(items, ctx) {
|
||||
const D = g.IWBImageDedupe
|
||||
if (!D || typeof D.index !== 'function') return { kept: items, dupIds: [], dupCount: 0 }
|
||||
const idx = D.index(ctx.nodes())
|
||||
const seen = new Set()
|
||||
const kept = []
|
||||
const dupIds = []
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
const v = items[i].data
|
||||
const k = idx.keyOf(v)
|
||||
const hitId = k ? idx.hit(v) : ''
|
||||
if (hitId) { if (dupIds.indexOf(hitId) < 0) dupIds.push(hitId); continue }
|
||||
if (k && seen.has(k)) continue // 同一批里的重复:没有原节点可指,只计数
|
||||
if (k) seen.add(k)
|
||||
kept.push(items[i])
|
||||
/* 指针不在画布上(停在面板/工具栏)时的兜底落点:
|
||||
* 取视口中心,若中心被库面板盖住就往面板旁边挪,避免「贴了但看不见」。 */
|
||||
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
|
||||
}
|
||||
return { kept: kept, dupIds: dupIds, dupCount: items.length - kept.length }
|
||||
// 中心没被面板挡住 ⇒ 返回 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' })
|
||||
|
||||
function addRefs(items, ctx, label) {
|
||||
if (ctx.wsId !== ctx.activeWsId()) { ctx.setNotice({ type: 'err', text: '工作台已切换,已取消粘贴图片' }); return }
|
||||
const dedup = rejectDup(items, ctx)
|
||||
if (!dedup.kept.length) {
|
||||
// 一张都没落:**必须**说清发生了什么并把原节点选中,否则用户看到的是「按了没反应」。
|
||||
if (dedup.dupIds.length) ctx.setSel(dedup.dupIds)
|
||||
ctx.setNotice({ type: 'ok', text: '这 ' + dedup.dupCount + ' 张图已经在画布上了' + (dedup.dupIds.length ? '(已选中原来的节点)' : '') + ',没有重复粘贴' })
|
||||
return
|
||||
}
|
||||
items = dedup.kept
|
||||
// v3.25.6(用户裁定):同一张图允许重复粘贴 —— 粘贴是显式动作,被去重挡掉像「按键没反应」。
|
||||
// 同图去重仍服务于「拖拽 / 批量导入」等被动路径(src/image-dedupe.js 的其它调用方)。
|
||||
if (!items || !items.length) return
|
||||
const stepX = ctx.nodeW('ref') + 24
|
||||
const stepY = ctx.nodeH('ref') + 24
|
||||
let base = spotOf(ctx, 'ref')
|
||||
@@ -177,7 +192,7 @@
|
||||
ctx.pushHistory()
|
||||
ctx.commitCanvas(ctx.nodes().concat(made), undefined, undefined)
|
||||
ctx.setSel(made.map((n) => n.id))
|
||||
ctx.setNotice({ type: 'ok', text: label + (dedup.dupCount ? '(跳过 ' + dedup.dupCount + ' 张重复的)' : '') })
|
||||
ctx.setNotice({ type: 'ok', text: label })
|
||||
}
|
||||
|
||||
/* 多图:并行导入、**一次落盘** —— 撤销一次就回到粘之前(旧实现分 N 次 commit 要按 N 次) */
|
||||
@@ -250,14 +265,16 @@
|
||||
}
|
||||
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()
|
||||
// 先摘掉「粘贴替换」的待命监听:此刻用户要贴的是节点组,不是替换某张参考图。
|
||||
// 不摘的话,点过「粘贴替换」按钮后再贴节点组,会把那张图顺手替换掉(v3.24.67 修过一次同类问题)。
|
||||
try { const PO = g.IWBPasteOnce; if (PO) PO.disarm() } catch (err) { /* ignore */ }
|
||||
if (!ctx.pasteGraph(c.clip, anchor(ctx))) ctx.setNotice({ type: 'err', text: '粘贴节点组失败:剪贴板内容无法识别' })
|
||||
if (!ctx.pasteGraph(c.clip, anchor(ctx) || safeSeed(ctx))) ctx.setNotice({ type: 'err', text: '粘贴节点组失败:剪贴板内容无法识别' })
|
||||
return true
|
||||
}
|
||||
if (c.kind === 'empty') {
|
||||
@@ -314,6 +331,26 @@
|
||||
createRefFromUrl(c.text.trim(), ctx)
|
||||
return true
|
||||
}
|
||||
// 桌面端:Finder/预览里「复制图片」经常同时给出 file:// 文本,classify 会当成普通文本,
|
||||
// 结果贴出来是一个写着路径的提示词节点。这里遇到路径样式的文本先问原生剪贴板要图片。
|
||||
const looksPath = /^(file:\/\/|\/|[A-Za-z]:[\/])/.test(c.text.trim())
|
||||
if (looksPath && typeof ctx.readNativeImage === 'function') {
|
||||
e.preventDefault()
|
||||
ctx.readNativeImage().then((f) => {
|
||||
if (f) pasteImages([f], ctx)
|
||||
else createPrompt(c.text, 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) || safeSeed(ctx))) return true
|
||||
}
|
||||
e.preventDefault()
|
||||
createPrompt(c.text, ctx)
|
||||
return true
|
||||
@@ -353,6 +390,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 +400,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)
|
||||
@@ -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
@@ -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) } }
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
@@ -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)) }
|
||||
} }, '清理未引用图片'),
|
||||
),
|
||||
|
||||
@@ -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) })
|
||||
@@ -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)
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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(棘轮腾位),
|
||||
@@ -2541,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))
|
||||
@@ -2560,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)
|
||||
|
||||
@@ -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
|
||||
|
||||
// ── 历史记账(供回溯,逐条保留)──────────────────────────────────────────────
|
||||
|
||||
@@ -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 失败')
|
||||
Reference in new issue
Block a user