Compare commits

...
22 Commits
Author SHA1 Message Date
qiqi fb20c97996 docs(facts): 基线锚点同步到 3.25.2
Verify (Gitea) / gate (build · unit · facts) (push) Canceled after 29s
2026-11-17 17:50:47 +08:00
qiqi 67a46dd03d feat(update): 接入 Tauri Updater(check_update/install_update + 签名产物 + latest.json 发布脚本)3.25.2 2026-11-17 17:47:05 +08:00
qiqi fe4a64f98b chore(plugins): 同步标注插件 1.20.2(指针自愈)+ 市场重建
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 1m38s
2026-11-17 17:24:21 +08:00
qiqi 78f8057384 chore(plugins): 同步标注插件 1.20.2(指针状态自愈)+ 市场产物重建
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 1m21s
2026-11-17 17:21:25 +08:00
qiqi ea5aa77b9c fix(plugins): 启动后对已启用插件补一次 activate(此前只注册不激活,开关显示开但插件没跑)+ 启动预热市场缓存
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 1m42s
2026-11-17 17:09:42 +08:00
qiqi f2c634ff38 fix(canvas): 没有上游样式节点的提示词/文本节点不再显示「已固定 / 恢复跟随」(避免误点清空手写文案)
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 1m19s
2026-11-17 17:02:40 +08:00
qiqi 9623d932f7 feat(plugins): 关闭的插件从侧边导航消失;插件面板本地优先渲染 + 市场列表缓存(秒开)
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 1m26s
2026-11-17 16:55:28 +08:00
qiqi b7eb9f8c28 fix(plugins): 读开关状态前先等待文件存储就绪 + 无记录不再强写启用;关闭状态跨重启保持
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 1m22s
2026-11-17 16:51:06 +08:00
qiqi 5dba56363a fix(plugins): 加载阶段不再写启用状态;启动时先快照用户开关再双向应用(关掉的插件重启后保持关闭)
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 1m21s
2026-11-17 16:47:18 +08:00
qiqi d83f7f5eef fix(plugins): 启动一律加载脚本(注册≠启用),加载后按持久化状态激活;修「关闭后再也打不开/未加载」
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 1m22s
2026-11-17 16:43:49 +08:00
qiqi 9b24749481 fix(plugins): 未注册默认启用 + 开关直接加载 + 加载成功回写启用 + 全部启用;插件详情页改扁平行;市场请求双通道
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 3m49s
2026-11-17 16:39:26 +08:00
qiqi 371f114d69 fix(plugins): 未注册插件默认启用 + 开关直接加载(运行时启用)+ 加载成功自愈启用状态 + 全部启用按钮 + 市场请求双通道回退
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 35s
2026-11-17 16:34:16 +08:00
qiqi 06d8551107 style(llm): 渠道卡片去外框改分区+细分隔线,长说明移到悬停提示,模型改圆角胶囊
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m17s
2026-11-17 16:22:18 +08:00
qiqi 0bc49d4eab style(plugins): 市场卡片更紧凑(安装/移除移到右上角、缩小内边距与标签间距、去掉底部空档)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m12s
2026-11-17 16:19:44 +08:00
qiqi 39d7c9e086 style(plugins): 市场卡片等高对齐(徽章移到标题行、描述两行截断、按钮固定底部右侧)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 38s
2026-11-17 16:16:43 +08:00
qiqi 5aeb354043 feat(plugins): 管理页显示加载错误原因 + 「复制诊断」(清单/运行时状态/错误)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m13s
2026-11-17 16:13:25 +08:00
qiqi 9fa45ff7b0 fix(plugins): 设置行去边框盒子改细分隔线 + 市场页展示全部插件并支持 全部/已安装/未安装 筛选(标签筛选与搜索分离)
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 2m33s
2026-11-17 16:09:41 +08:00
qiqi 1ac0877f30 feat(plugins): 插件设置拆成两页(管理页=横向列表+开关 / 市场页=卡片墙安装),对齐 Obsidian 交互
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 1m32s
2026-11-17 16:04:49 +08:00
qiqi 398500b952 feat(plugins): 设置内插件市场改成卡片墙(图标/标签/状态/安装按钮),与 market 页同一套视觉
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 2m38s
2026-11-17 15:59:08 +08:00
qiqi e2253e56c2 feat(market): 插件市场展示页(卡片墙 + 搜索 + 标签筛选),meta 补 icon/color/tags
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 1m55s
2026-11-17 15:55:55 +08:00
qiqi 67c6128d61 fix(site): 下载页 Intel 平台键改为 darwin-x86_64(对齐 releases.json / Tauri 平台名)
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 1m22s
2026-11-17 15:48:09 +08:00
qiqi 3bd6b4d9ff chore(release): 3.25.1 补 Intel Mac 包(darwin-x86_64)
Verify (Gitea) / gate (build · unit · facts) (push) Canceled after 36s
2026-11-17 15:47:32 +08:00
27 changed files with 1221 additions and 248 deletions

No files matched your search

+14
View File
@@ -14,6 +14,20 @@
> 3. 核验正式地址版本 → 之后才移动 `stable` / `stable-verified-<日期>` 标签、更新本 CHANGELOG、写 GitHub Release(`gh release create`)。
> 测试发现问题 → 改 → 再 `deploy:test`,正式环境不受影响。回滚点 `git reset --hard stable`。
## v3.25.2(2026-11-17)在线更新上线:应用内「检查更新 → 立即更新 → 自动重启」
> **状态:✅ 已发布** 双架构签名产物 + `latest.json` 更新源。
### 新增
- **Tauri Updater 接入**:`tauri-plugin-updater` + `check_update`/`install_update` 两条 Rust 命令;
设置 → 通用 → 版本与更新 里可检查、下载、安装并自动重启。
- **签名发布**:`bundle.createUpdaterArtifacts` + minisign 密钥;`.app.tar.gz` 与 `.sig` 由
`scripts/publish-update.sh` 一键产出并上传,同时生成双平台 `latest.json`。
- **文档**:`docs/DESKTOP_UPDATE.md`(发布流程、密钥管理、故障排查)。
### 修复
- 标注插件 v1.20.2:丢失 `mouseup` 后自动收笔 + 失焦/指针取消复位,修「画一次后画布不响应」。
## v3.25.1(2026-11-17)性能与数据卫生:回收 20.2MB 垃圾图片 + 图库清单去 base64(223 倍)+ 备份含插件
> **状态:代码已合并** 分支 `main`。Windows 安装包基于本版本构建。
+47 -4
View File
@@ -3488,9 +3488,16 @@
// 为空 = 跟随上游,节点体把上游文本显示出来(改一个字就落进自己的 data.text)。
function nodeInheritOf(node, nodesArr, edgesArr) {
const own = String((node && node.data && node.data.text) || '').trim()
if (own) return { text: '', sourceNodeId: '', more: 0, own: true }
const info = inheritedTextOf(node && node.id, nodesArr, edgesArr)
return { text: String(info.text || ''), sourceNodeId: String(info.sourceNodeId || ''), more: Number(info.more) || 0, own: false }
// 关键:先查上游。没有上游就根本没有「继承/已固定」这回事(用户是纯手写)
const info = inheritedTextOf(node && node.id, nodesArr, edgesArr) || {}
const hasUpstream = !!(info.sourceNodeId || String(info.text || '').trim())
const base = {
sourceNodeId: String(info.sourceNodeId || ''),
more: Number(info.more) || 0,
hasUpstream: hasUpstream,
}
if (own) return Object.assign({ text: '', own: true }, base)
return Object.assign({ text: String(info.text || ''), own: false }, base)
}
// 纯任务构建器:只根据节点图构造 prompt/参考图任务,不修改 state、不发送请求。
@@ -8550,6 +8557,15 @@ items.push(el('button', { key: 'bgc', className: 'iwb-ctx-item', onClick: (e) =>
const r = PluginHost && typeof PluginHost.setEnabled === 'function' ? PluginHost.setEnabled(id, true) : null
return r && r.ok ? { ok: true } : { ok: false, error: (r && r.error) || '启用失败' }
}
// 后台预热市场索引:设置页打开时直接命中缓存(网络慢也不影响首屏)
function wWarmMarketCache() {
try {
setTimeout(function () {
try { const p = wMarketList(); if (p && typeof p.catch === 'function') p.catch(function () { /* 离线也正常 */ }) } catch (e) { /* ignore */ }
}, 2500)
} catch (e) { /* ignore */ }
}
async function wLoadRuntimePlugins() {
if (typeof fetch !== 'function' || typeof document === 'undefined') return
// 内置清单(随包)先读;外部清单(<资料目录>/plugins/)只覆盖同 id 的条目 —— 合并而非替换
@@ -8579,6 +8595,14 @@ items.push(el('button', { key: 'bgc', className: 'iwb-ctx-item', onClick: (e) =>
}
} catch (e) { /* 开发者模式读取失败不影响启动 */ }
for (const e of ext) { const id = String((e && e.id) || ''); if (id) byId.set(id, Object.assign({}, e, { source: 'external' })) }
// 关键:加载前先快照「用户关掉过哪些插件」,加载过程绝不能覆盖这个状态
let persistedState = {}
try {
const F = (typeof window !== 'undefined') ? window.IWBStorageFile : null
if (F && typeof F.ready === 'function') { try { await F.ready({ wizard: false }) } catch (e) { /* 已就绪 */ } }
const v = lsGet('iwb_plugins', {})
persistedState = (v && typeof v === 'object') ? v : {}
} catch (e) { persistedState = {} }
const manifest = Array.from(byId.values())
if (!manifest.length) return
const list = Array.isArray(manifest) ? manifest : (manifest && Array.isArray(manifest.plugins) ? manifest.plugins : [])
@@ -8600,10 +8624,28 @@ items.push(el('button', { key: 'bgc', className: 'iwb-ctx-item', onClick: (e) =>
// 只下载已启用的;未启用记 idle(不注入脚本),插件管理里勾选时经 wEnsurePluginLoaded 按需下载
// 收进 pending 而非逐个 await:wLoadPluginEntry 在首个 await 前已 append ⇒ 并发抓取;async=false 保证执行顺序不变(冷启动 3 RTT → 1)
// 本地开发插件默认启用(没有持久化状态,不应被当作已关闭的插件)
if (PluginHost && typeof PluginHost.isEnabled === 'function' && (isLocalEntry || PluginHost.isEnabled(id))) pending.push(isLocalEntry ? wLoadLocalPluginEntry(record) : (isExt ? wLoadExternalPluginEntry(record) : wLoadPluginEntry(record)))
// 一律加载脚本(注册 ≠ 启用):脚本注册后才能被开关随时启停;
// 之前按 enabled 预筛,导致状态里残留 false 的插件永远进不了注册表,开关也打不开。
if (PluginHost) pending.push(isLocalEntry ? wLoadLocalPluginEntry(record) : (isExt ? wLoadExternalPluginEntry(record) : wLoadPluginEntry(record)))
else record.status = 'idle'
}
await Promise.all(pending)
// 脚本都注册了:把持久化里明确关掉的插件停用(其余保持启用)
try {
const st = persistedState || {}
for (const r of (wRuntimePlugins || [])) {
if (!r || r.status !== 'loaded') continue
const rec = st[r.id]
if (!rec) continue
const want = rec.enabled !== false
if (!PluginHost || typeof PluginHost.setEnabled !== 'function') continue
// 注意:插件是在 init() 之后才注册的,init 的"激活已启用项"覆盖不到它们。
// 所以这里对 want=true 一律再 setEnabled(true)(activate 幂等:已激活会返回 already),
// 否则会出现"开关显示已启用、实际没跑工厂函数"的假启用状态。
if (want) PluginHost.setEnabled(r.id, true)
else if (typeof PluginHost.isEnabled === 'function' && PluginHost.isEnabled(r.id)) PluginHost.setEnabled(r.id, false)
}
} catch (e) { /* 状态应用失败不影响加载 */ }
try { lsSet('iwb_plugin_load_status', JSON.stringify(wRuntimePlugins.map((r) => ({ id: r.id, status: r.status, source: r.source, error: r.error || '' })))) } catch (e2) { /* probe */ }
try { if (PluginHost && typeof PluginHost.emit === 'function') PluginHost.emit('runtime-plugins-loaded') } catch (e) { /* 通知失败不影响启动 */ }
}
@@ -8790,6 +8832,7 @@ items.push(el('button', { key: 'bgc', className: 'iwb-ctx-item', onClick: (e) =>
}
} catch (e) { /* 预注册失败不影响启动 */ }
wLoadRuntimePlugins()
wWarmMarketCache()
}
// 桌面端关闭图库定时清理(设置里已去掉该项):0 = 不限,避免老图被静默删掉
try {
+46 -62
View File
@@ -1,82 +1,66 @@
# 桌面版在线更新:方案与落地清单(2026-11-17)
# 在线更新(Tauri Updater)
> 现状:设置 → 通用 已有「版本与更新」区块(版本号 + 「检查更新」按钮)。
> 按钮会检测 `window.__TAURI__.updater`;插件装上并配好更新源后自动生效,现在点它只会提示"尚未启用"。
> 目标:用户装过一次之后,以后新版本在应用内点「检查更新」即可升级,不用再手动下载 dmg。
## 一、三种方案
## 一、已经配好的东西
| 方案 | 用户体验 | 需要什么 | 适合 |
|---|---|---|---|
| **A. Tauri 官方 updater** | 应用内检查→下载→自动替换→重启 | 更新源(HTTPS 静态) + 一对签名密钥 + 发布流程 | 要发给别人 |
| B. 手动下载 | 去网盘/Release 下新包替换 | 一个能放包的地方 | 自用、低频 |
| C. 只提示(自研检查) | 提示"有新版本"+下载链接,不自动装 | 一个 version.json | 轻量折中 |
| 组件 | 位置 | 说明 |
|---|---|---|
| 更新插件 | `src-tauri/Cargo.toml` → `tauri-plugin-updater` | Rust 侧用 `UpdaterExt` |
| 更新源 | `src-tauri/tauri.conf.json` → `plugins.updater.endpoints` | `https://download.maqiart.eu.org/updates/latest.json` |
| 签名公钥 | 同上 `plugins.updater.pubkey` | 私钥在 `~/.config/iwb-updater.key`(**务必备份**) |
| 产物开关 | `bundle.createUpdaterArtifacts: true` | 构建 app 时额外产出 `.app.tar.gz` + `.sig` |
| Rust 命令 | `check_update` / `install_update` | 前端通过 `__TAURI__.core.invoke` 调用 |
| 前端入口 | 设置 → 通用 → 版本与更新 | 「检查更新」→「立即更新」→ 自动重启 |
**建议**:现在自用 → 先做 **C**(零密钥、能及时知道);要发给别人再升 A。
## 二、发新版本(一条命令)
## 二、A 方案要素
### 1. 依赖
```bash
# Cargo.toml: tauri-plugin-updater = "2"
npm i @tauri-apps/plugin-updater
./scripts/publish-update.sh 3.25.3 # 改版本 + 双架构签名构建 + 上传 + 生成 latest.json
```
lib.rs: `.plugin(tauri_plugin_updater::Builder::new().build())`;capabilities 加 `"updater:default"`
### 2. 签名密钥(一次生成,永久保管)
```bash
npx tauri signer generate -w ~/.tauri/image-workbench.key
```
私钥绝不进仓库;公钥写进 `plugins.updater.pubkey`。
**丢了私钥 = 老用户永远收不到更新。**
脚本会做四件事:
1. `npx tauri build --bundles app,dmg`(arm64,带签名)
2. `npx tauri build --target x86_64-apple-darwin --bundles app,dmg`(Intel,带签名)
3. 上传 `*.app.tar.gz` / `.sig` / `.dmg` 到 NAS `updates/darwin-{aarch64,x86_64}/`
4. 生成并上传 `updates/latest.json`(两个平台各自带 signature + url)
## 三、latest.json 格式(脚本自动生成)
### 3. 配置
```json
{
"plugins": { "updater": {
"pubkey": "<公钥>",
"endpoints": ["https://<域名>/image-workbench/latest.json"]
} },
"bundle": { "createUpdaterArtifacts": true }
}
```
### 4. 清单 latest.json
```json
{
"version": "3.25.0",
"notes": "…",
"pub_date": "2026-11-17T10:00:00Z",
"version": "3.25.2",
"notes": "更新说明",
"pub_date": "2026-11-17T09:43:08.117Z",
"platforms": {
"darwin-aarch64": { "signature": "<sig>", "url": "…app.tar.gz" },
"windows-x86_64": { "signature": "<sig>", "url": "…nsis.zip" }
"darwin-aarch64": { "signature": "<.sig 内容>", "url": "https://.../image-workbench_3.25.2_aarch64.app.tar.gz" },
"darwin-x86_64": { "signature": "<.sig 内容>", "url": "https://.../image-workbench_3.25.2_x64.app.tar.gz" }
}
}
```
### 5. 构建带签名
```bash
TAURI_SIGNING_PRIVATE_KEY=... TAURI_SIGNING_PRIVATE_KEY_PASSWORD=... npm run app:build
```
产出 `*.app.tar.gz(.sig)` / `*.nsis.zip(.sig)`,与清单一起上传。
⚠️ **两个平台都要有**:缺哪个平台,那个平台的用户就永远「已是最新」。
### 6. 托管选择
| 位置 | 可行 | 注意 |
|---|---|---|
| GitHub Releases | ✅ | 私有库资产需匿名可读 |
| Cloudflare R2/Pages | ✅ | 公开读 + HTTPS |
| 飞牛 NAS / Gitea | ⚠️ | 必须公网 HTTPS 且免鉴权;私有库要 token ⇒ 不可用 |
## 四、用户侧流程
## 三、现在就该定的事
1. 版本号三处一致(tauri.conf / Cargo / package.json),每次发布递增
2. macOS 要出 aarch64 + x64 两套;Windows 出 x64
3. 私钥本机签还是 CI 签
1. 装过任一 3.25.2+ 版本(这是第一个带更新器的版本)
2. 设置 → 通用 → 版本与更新 → **检查更新**
3. 有新版本 → 显示版本号与说明 → 点「立即更新」
4. 自动下载、校验签名、替换、重启(数据目录不受影响)
## 四、C 方案(建议先做)
1. 静态放 `version.json`:`{version, notes, url}`
2. 「检查更新」改成 HTTP GET 比对版本,有新版给下载链接
3. 零密钥、零签名、不影响安装包
## 五、注意
## 五、现状
- ✅ 通用页已显示版本号 + 检查更新按钮
- ⬜ 待你定:A 还是 C
- 提醒:未签名的 macOS 应用即使更新成功,首次打开仍有 Gatekeeper 提示;要消除需 Apple Developer ID($99/年),不影响自用。
- **私钥丢了就不能再发更新**(签名对不上,所有旧客户端会拒绝安装)。备份 `~/.config/iwb-updater.key`
- 公钥写在 `tauri.conf.json` 里进了仓库;私钥**绝不能**进仓库
- macOS 未做 notarization:更新替换后仍是未签名 app,首次打开可能仍要右键→打开
- Windows 将来出包时,在 latest.json 里加 `windows-x86_64`,并在 `bundle.targets` 里用 `nsis`(msi 不支持 updater)
- Cloudflare 会缓存 404:新文件名第一次访问可能短暂 404,换文件名(内容变即哈希变)即可绕过
## 六、首次接入清单(已完成 2026-11-17)
- [x] 生成密钥对(`tauri signer generate`),公钥进 config,私钥留本机
- [x] 加 `tauri-plugin-updater`,注册 `check_update` / `install_update`
- [x] `createUpdaterArtifacts: true`
- [x] 构建 3.25.2(arm + Intel)并发布 latest.json
- [ ] 用户实测:装 3.25.2 后,3.25.3 发布时能一键更新(待验证)
+1 -1
View File
@@ -1,7 +1,7 @@
# 现状架构与性能事实基线(image-workbench-web)
> **本文档是什么**:现状**事实快照**,不是规范。用途:任何性能 / 内存 / 存储相关改动,先对齐这里的现实,避免把已经调好的东西改坏。
> 日期 **2026-10-20**(**2026-11-16 复算 · v3.24.85**)| 基线(**最近一次 bump 版本的提交**,不是主干 HEAD)`main = 3f2eb03`(线上 `v3.25.1+3f2eb03` —— 线上实际运行提交是 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 = 67a46dd`(线上 `v3.25.2+67a46dd` —— 线上实际运行提交是 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 迁出)
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "image-workbench-web",
"private": true,
"version": "3.25.1",
"version": "3.25.2",
"description": "Browser-based node canvas image workbench",
"scripts": {
"build": "node scripts/build.js && node scripts/copy-plugins.js",
+3 -3
View File
@@ -13,9 +13,9 @@
},
{
"id": "image-annotate",
"file": "plugin-image-annotate.86ccc161901c.js",
"version": "1.20.1",
"integrity": "sha256-hszBYZAc1qcloGHrWhXG9Z3Zc/qq0emOnlMNPUar3Pc="
"file": "plugin-image-annotate.a8227863bec8.js",
"version": "1.20.2",
"integrity": "sha256-qCJ4Y77InZpHP4YowJce4TiQ8/ybBQhBZHwznAYgVHE="
},
{
"id": "image-vectorize",
+49 -7
View File
@@ -2,36 +2,78 @@
"batch-export": {
"name": "批量出图",
"desc": "资源中心勾选节点,串行批量生成并打包 ZIP 下载",
"author": "official"
"author": "official",
"icon": "🗂️",
"color": "#e8f0fe",
"tags": [
"出图",
"批处理"
]
},
"blank-canvas": {
"name": "空白画布",
"desc": "新建空白画布节点,用于分区分组",
"author": "official"
"author": "official",
"icon": "⬜",
"color": "#eef2f6",
"tags": [
"画布",
"效率"
]
},
"image-annotate": {
"name": "标注 / 修图",
"desc": "在画布内标注、涂抹、局部重绘",
"author": "official"
"author": "official",
"icon": "🖌️",
"color": "#fdeaea",
"tags": [
"修图",
"标注"
]
},
"image-vectorize": {
"name": "位图转矢量",
"desc": "把位图转成 SVG 矢量路径",
"author": "official"
"author": "official",
"icon": "✒️",
"color": "#eaf3ea",
"tags": [
"转换",
"矢量"
]
},
"style-source": {
"name": "风格库",
"desc": "风格提示词库与一键套用",
"author": "official"
"author": "official",
"icon": "🎨",
"color": "#fdf0e6",
"tags": [
"提示词",
"风格"
]
},
"white-bg-800": {
"name": "白底图",
"desc": "批量生成电商白底图(800px)",
"author": "official"
"author": "official",
"icon": "🧾",
"color": "#eef7fb",
"tags": [
"电商",
"出图"
]
},
"xianyi-cutout": {
"name": "鲜艺抠图",
"desc": "接入鲜艺抠图模型的一键去背景",
"author": "official"
"author": "official",
"icon": "✂️",
"color": "#f3eafd",
"tags": [
"抠图",
"去背景"
]
}
}
@@ -9,7 +9,7 @@
var __IWB_ANNOTATE_MANIFEST__ = {
id: 'image-annotate',
name: '标注 / 修图',
version: '1.20.1',
version: '1.20.2',
apiVersion: 1,
capabilities: ['commands', 'nodeActions', 'canvas', 'canvasWrite'],
settings: {
@@ -4847,6 +4847,14 @@ var __IWB_ANNOTATE_MANIFEST__ = {
};
function onMouseMove(e) {
S._altDown = !!e.altKey;
if (S.isDrawing && e.buttons === 0) {
S.isDrawing = false;
const up = Object.prototype.hasOwnProperty.call(DRAW_UP_HANDLERS, S.tool) ? DRAW_UP_HANDLERS[S.tool] : null;
try {
if (up) up(getPos(e));
} catch (err) {
}
}
if (S.placingImage && S.placingHandle && S.placingStart) {
onPlacementDragMove(e);
return;
@@ -6875,6 +6883,26 @@ var __IWB_ANNOTATE_MANIFEST__ = {
renderLayerPanel();
finishCreateTool("shape", shape.id);
}
function resetPointerState() {
S.isDrawing = false;
S.marquee = null;
S.lassoPts = null;
S.textDrag = null;
S.bitmapDrag = null;
S.shapeDrag = null;
S.penDragPt = -1;
S.penDragPending = null;
S.placingHandle = null;
S.panning = false;
S.interaction = "idle";
if (S.strokeCanvas) S.strokeCanvas.style.display = "none";
document.body.style.cursor = "";
document.body.style.userSelect = "";
try {
renderObjects();
} catch (e) {
}
}
function bindCanvasEvents() {
if (S._canvasEventsBound) return;
S._canvasEventsBound = true;
@@ -6882,6 +6910,11 @@ var __IWB_ANNOTATE_MANIFEST__ = {
S.canvasStack.addEventListener("mousemove", onMouseMove);
S.canvasStack.addEventListener("mousemove", onCanvasHover);
window.addEventListener("mouseup", onMouseUp);
window.addEventListener("blur", resetPointerState);
document.addEventListener("pointercancel", resetPointerState);
document.addEventListener("visibilitychange", () => {
if (document.hidden) resetPointerState();
});
S.canvasStack.addEventListener("contextmenu", (e) => {
e.preventDefault();
if (S.open && !S.placingImage) showSelectionContext(e);
@@ -9130,3 +9163,5 @@ var __IWB_ANNOTATE_MANIFEST__ = {
})
})(typeof window !== 'undefined' ? window : globalThis)
// build-rev: 2026-11-17T17 (pointer-self-heal)
+122
View File
@@ -0,0 +1,122 @@
#!/usr/bin/env node
'use strict'
// 生成插件市场展示页:market/index.json → market.html(纯静态,无后端)
// 设计目标:与下载页同一套视觉;卡片墙 + 搜索 + 标签筛选;「安装」只在应用内做,这里只展示。
const fs = require('fs')
const path = require('path')
const root = path.resolve(__dirname, '..')
const index = JSON.parse(fs.readFileSync(path.join(root, 'market', 'index.json'), 'utf8'))
const list = Array.isArray(index.plugins) ? index.plugins : []
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]))
const tags = []
for (const p of list) for (const t of (p.tags || [])) if (tags.indexOf(t) < 0) tags.push(t)
const kb = (n) => n >= 1024 * 1024 ? (n / 1048576).toFixed(1) + ' MB' : Math.max(1, Math.round(n / 1024)) + ' KB'
const card = (p) => `
<article class="card" data-name="${esc((p.name + ' ' + p.id + ' ' + p.desc + ' ' + (p.tags || []).join(' ')).toLowerCase())}" data-tags="${esc((p.tags || []).join(','))}">
<div class="card-head">
<span class="avatar" style="background:${esc(p.color || '#eef2f6')}">${esc(p.icon || '◻')}</span>
<div class="card-title">
<h3>${esc(p.name)}</h3>
<div class="sub">${esc(p.author === 'official' ? '官方' : p.author)} · v${esc(p.version)} · ${kb(p.size || 0)}</div>
</div>
</div>
<p class="desc">${esc(p.desc)}</p>
<div class="tags">${(p.tags || []).map((t) => `<span class="tag">${esc(t)}</span>`).join('')}</div>
</article>`
const html = `<!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>
<style>
:root { --fg:#1a1a1a; --fg2:#6b6b6b; --line:#ececec; --bg:#fff; --chip:#f4f4f4; }
@media (prefers-color-scheme: dark) {
:root { --fg:#f2f2f2; --fg2:#9a9a9a; --line:#2a2a2a; --bg:#111; --chip:#1d1d1d; }
}
* { box-sizing:border-box; }
body { margin:0; background:var(--bg); color:var(--fg); font:15px/1.65 -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif; }
.wrap { max-width:1080px; margin:0 auto; padding:56px 24px 80px; }
header h1 { font-size:28px; margin:0 0 6px; letter-spacing:-.02em; }
header p { margin:0; color:var(--fg2); font-size:14px; }
.toolbar { display:flex; gap:12px; margin:28px 0 18px; flex-wrap:wrap; align-items:center; }
input[type=search] { flex:1 1 260px; min-width:220px; padding:10px 14px; border:1px solid var(--line); border-radius:10px; background:var(--bg); color:var(--fg); font-size:14px; outline:none; }
input[type=search]:focus { border-color:#111; }
.chips { display:flex; gap:8px; flex-wrap:wrap; }
.chip { padding:6px 12px; border:1px solid var(--line); border-radius:999px; background:transparent; color:var(--fg2); font-size:13px; cursor:pointer; }
.chip.on { background:#111; color:#fff; border-color:#111; }
@media (prefers-color-scheme: dark) { .chip.on { background:#f2f2f2; color:#111; border-color:#f2f2f2; } }
.grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:16px; }
.card { border:1px solid var(--line); border-radius:14px; padding:18px; display:flex; flex-direction:column; gap:12px; }
.card-head { display:flex; gap:12px; align-items:center; }
.avatar { width:44px; height:44px; border-radius:12px; display:flex; align-items:center; justify-content:center; font-size:22px; flex:0 0 44px; }
.card-title h3 { margin:0; font-size:16px; font-weight:600; }
.card-title .sub { color:var(--fg2); font-size:12.5px; margin-top:2px; }
.desc { margin:0; color:var(--fg2); font-size:13.5px; min-height:42px; }
.tags { display:flex; gap:6px; flex-wrap:wrap; margin-top:auto; }
.tag { padding:2px 9px; border-radius:999px; background:var(--chip); color:var(--fg2); font-size:12px; }
.empty { color:var(--fg2); padding:40px 0; text-align:center; }
footer { margin-top:40px; color:var(--fg2); font-size:13px; border-top:1px solid var(--line); padding-top:18px; }
code { background:var(--chip); padding:1px 6px; border-radius:6px; font-size:12.5px; }
</style>
</head>
<body>
<div class="wrap">
<header>
<h1>插件市场</h1>
<p>Image Workbench 插件 · 共 <b>${list.length}</b> 个 · 在应用内「设置 → 插件」安装</p>
</header>
<div class="toolbar">
<input id="q" type="search" placeholder="搜索插件,例如:出图、抠图、矢量…" autocomplete="off">
<div class="chips" id="chips">
<button class="chip on" data-tag="">全部</button>
${tags.map((t) => `<button class="chip" data-tag="${esc(t)}">${esc(t)}</button>`).join('')}
</div>
</div>
<div class="grid" id="grid">${list.map(card).join('')}</div>
<div class="empty" id="empty" hidden>没有匹配的插件</div>
<footer>
安装方式:应用内 <code>设置 → 插件 → 可安装(市场)</code> 点「安装」,重启后生效。<br>
插件目录:<code>~/Documents/ImageWorkbench/plugins/</code>(Windows:<code>%USERPROFILE%\\Documents\\ImageWorkbench\\plugins\\</code>)
</footer>
</div>
<script>
var q = document.getElementById('q')
var grid = document.getElementById('grid')
var empty = document.getElementById('empty')
var chips = document.getElementById('chips')
var activeTag = ''
function apply () {
var kw = (q.value || '').trim().toLowerCase()
var shown = 0
Array.prototype.forEach.call(grid.children, function (el) {
var okKw = !kw || el.dataset.name.indexOf(kw) >= 0
var okTag = !activeTag || (',' + el.dataset.tags + ',').indexOf(',' + activeTag + ',') >= 0
var ok = okKw && okTag
el.hidden = !ok
if (ok) shown++
})
empty.hidden = shown > 0
}
q.addEventListener('input', apply)
chips.addEventListener('click', function (e) {
var b = e.target.closest('.chip')
if (!b) return
Array.prototype.forEach.call(chips.children, function (x) { x.classList.remove('on') })
b.classList.add('on')
activeTag = b.dataset.tag || ''
apply()
})
</script>
</body>
</html>
`
fs.writeFileSync(path.join(root, 'market', 'index.html'), html)
console.log('market/index.html 已生成(' + list.length + ' 个插件 / ' + tags.length + ' 个标签)')
+1 -1
View File
@@ -19,7 +19,7 @@ for (const e of man) {
fs.writeFileSync(path.join(out, 'plugins', e.file), buf)
const m = meta[e.id] || {}
plugins.push({
id: e.id, name: m.name || e.id, desc: m.desc || '', author: m.author || 'official',
id: e.id, name: m.name || e.id, desc: m.desc || '', author: m.author || 'official', icon: m.icon || '', color: m.color || '', tags: Array.isArray(m.tags) ? m.tags : [],
version: e.version, apiVersion: 1,
file: 'plugins/' + e.file,
size: buf.length,
+1 -1
View File
@@ -12,7 +12,7 @@ const data = JSON.parse(fs.readFileSync(inFile, 'utf8'))
const PLATFORMS = [
{ key: 'darwin-aarch64', label: 'macOS · Apple Silicon', hint: 'M1 / M2 / M3 / M4' },
{ key: 'darwin-x64', label: 'macOS · Intel', hint: 'x86_64' },
{ key: 'darwin-x86_64', label: 'macOS · Intel', hint: 'x86_64' },
{ key: 'windows-x86_64', label: 'Windows · x64', hint: '需要 WebView2' },
]
+76
View File
@@ -0,0 +1,76 @@
#!/usr/bin/env bash
# 发布在线更新:签名构建(双架构)+ 上传产物 + 生成 latest.json
#
# 用法:
# ./scripts/publish-update.sh # 用 package.json 的版本
# ./scripts/publish-update.sh 3.25.3 # 先改版本再发布(等价于 set-version + 本脚本)
#
# 依赖:
# · 签名私钥:~/.config/iwb-updater.key(TAURI_SIGNING_PRIVATE_KEY)
# · 公钥已写进 src-tauri/tauri.conf.json → plugins.updater.pubkey
# · NAS 可 ssh(~/.ssh/id_ed25519_fnos)
#
# 产物:
# <target>/bundle/macos/image-workbench.app.tar.gz(.sig) ← 更新器用
# <target>/bundle/dmg/*.dmg ← 官网下载用
# https://download.maqiart.eu.org/updates/latest.json ← 更新源
set -euo pipefail
cd "$(dirname "$0")/.."
[ $# -ge 1 ] && node scripts/set-version.js "$1"
V=$(node -e "console.log(require('./package.json').version)")
KEY="${TAURI_SIGNING_PRIVATE_KEY:-$HOME/.config/iwb-updater.key}"
export TAURI_SIGNING_PRIVATE_KEY="$KEY"
export TAURI_SIGNING_PRIVATE_KEY_PASSWORD="${TAURI_SIGNING_PRIVATE_KEY_PASSWORD:-}"
export CARGO_HOME="${CARGO_HOME:-$PWD/.cargo-home}"
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"
echo "== 1/4 构建 arm64(app + dmg,含签名)"
npx tauri build --bundles app,dmg >/dev/null
echo "== 2/4 构建 x86_64(app + dmg,含签名)"
npx tauri build --target x86_64-apple-darwin --bundles app,dmg >/dev/null
ARM="src-tauri/target/release/bundle"
INT="src-tauri/target/x86_64-apple-darwin/release/bundle"
echo "== 3/4 上传产物"
TMP=$(mktemp -d)
cp "$ARM/macos/image-workbench.app.tar.gz" "$TMP/image-workbench_${V}_aarch64.app.tar.gz"
cp "$ARM/macos/image-workbench.app.tar.gz.sig" "$TMP/image-workbench_${V}_aarch64.app.tar.gz.sig"
cp "$INT/macos/image-workbench.app.tar.gz" "$TMP/image-workbench_${V}_x64.app.tar.gz"
cp "$INT/macos/image-workbench.app.tar.gz.sig" "$TMP/image-workbench_${V}_x64.app.tar.gz.sig"
$SCP "$TMP"/*.app.tar.gz* "$NAS_HOST:$NAS_DIR/updates/darwin-aarch64/" 2>/dev/null || true
$SCP "$TMP/image-workbench_${V}_aarch64.app.tar.gz" "$TMP/image-workbench_${V}_aarch64.app.tar.gz.sig" "$NAS_HOST:$NAS_DIR/updates/darwin-aarch64/"
$SCP "$TMP/image-workbench_${V}_x64.app.tar.gz" "$TMP/image-workbench_${V}_x64.app.tar.gz.sig" "$NAS_HOST:$NAS_DIR/updates/darwin-x86_64/"
$SCP "$ARM/dmg/image-workbench_${V}_aarch64.dmg" "$NAS_HOST:$NAS_DIR/updates/darwin-aarch64/"
$SCP "$INT/dmg/image-workbench_${V}_x64.dmg" "$NAS_HOST:$NAS_DIR/updates/darwin-x86_64/"
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"
node -e '
const fs = require("fs")
const v = process.env.UPD_VERSION
const j = {
version: v,
notes: process.env.UPD_NOTES || "",
pub_date: new Date().toISOString(),
platforms: {
"darwin-aarch64": { signature: process.env.SIG_ARM, url: "https://download.maqiart.eu.org/updates/darwin-aarch64/image-workbench_" + v + "_aarch64.app.tar.gz" },
"darwin-x86_64": { signature: process.env.SIG_INT, url: "https://download.maqiart.eu.org/updates/darwin-x86_64/image-workbench_" + v + "_x64.app.tar.gz" },
},
}
fs.writeFileSync("/tmp/iwb-latest.json", JSON.stringify(j, null, 2))
console.log("latest.json -> v" + v)
'
$SCP /tmp/iwb-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 "== 完成:https://download.maqiart.eu.org/updates/latest.json"
curl -s -m 15 https://download.maqiart.eu.org/updates/latest.json | head -c 200; echo
+4 -4
View File
@@ -40,8 +40,8 @@
</div>
<div class="row">
<div class="name">macOS · Intel<div class="hint">x86_64</div></div>
<div class="meta"></div>
<span class="muted">暂未提供</span>
<div class="meta">版本 3.25.1 · 6.5 MB · .dmg<div class="hash">sha256 7863e4a3257d15a4…</div></div>
<a class="btn" href="/updates/darwin-x86_64/image-workbench_3.25.1_x64.dmg">下载</a>
</div>
<div class="row">
<div class="name">Windows · x64<div class="hint">需要 WebView2</div></div>
@@ -58,8 +58,8 @@
<h2>历史版本</h2>
<div class="row">
<div class="name">3.25.1<div class="hint">性能与数据卫生:图库清单去 base64(223 倍)、画布缩略图落盘、回收 20.2MB 垃圾图、备份含插件</div></div>
<div class="meta">2026-11-17<div class="hint">macOS · Apple Silicon</div></div>
<div class="name">3.25.1<div class="hint">Intel Mac 版:性能与数据卫生(图库清单去 base64、缩略图落盘、回收 20.2MB)</div></div>
<div class="meta">2026-11-17<div class="hint">macOS · Apple Silicon / macOS · Intel</div></div>
</div>
<div class="row">
<div class="name">3.25.0<div class="hint">应用不再内置插件(全部从市场安装);页内确认替代原生 confirm;插件市场与开发者模式</div></div>
+8 -2
View File
@@ -1,18 +1,24 @@
{
"app": "Image Workbench",
"subtitle": "本地优先的 AI 生图无限画布 · 桌面版(Tauri v2)",
"updatedAt": "2026-11-17T07:41:57.912Z",
"updatedAt": "2026-11-17T07:47:02.925Z",
"releases": [
{
"version": "3.25.1",
"date": "2026-11-17",
"notes": "性能与数据卫生:图库清单去 base64(223 倍)、画布缩略图落盘、回收 20.2MB 垃圾图、备份含插件",
"notes": "Intel Mac 版:性能与数据卫生(图库清单去 base64、缩略图落盘、回收 20.2MB)",
"platforms": {
"darwin-aarch64": {
"file": "updates/darwin-aarch64/image-workbench_3.25.1_aarch64.dmg",
"size": 6545041,
"sha256": "5b711840b36a10ba2983ad48923c662897d25e55ea30de9fb7ea944694648124",
"kind": "dmg"
},
"darwin-x86_64": {
"file": "updates/darwin-x86_64/image-workbench_3.25.1_x64.dmg",
"size": 6772292,
"sha256": "7863e4a3257d15a42d698ca79d0edbfb86496f20e67be7389c1de498c01f471b",
"kind": "dmg"
}
}
},
+336 -6
View File
@@ -393,6 +393,15 @@ dependencies = [
"memchr",
]
[[package]]
name = "constant_time_eq"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9eb6feb175df65d0a3ccd3e73484e940d0ac664e8034f0519fd49a93db3071d9"
dependencies = [
"rustversion",
]
[[package]]
name = "cookie"
version = "0.18.2"
@@ -869,6 +878,16 @@ dependencies = [
"typeid",
]
[[package]]
name = "errno"
version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776"
dependencies = [
"libc",
"windows-sys 0.61.2",
]
[[package]]
name = "fastrand"
version = "2.5.0"
@@ -903,6 +922,16 @@ dependencies = [
"rustc_version",
]
[[package]]
name = "filetime"
version = "0.2.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1255e7a9f1902190d4c10a75f2f7f495d3d3ce13e9ba26e6c48683a0f4dbed7"
dependencies = [
"cfg-if",
"libc",
]
[[package]]
name = "find-msvc-tools"
version = "0.1.15"
@@ -1666,7 +1695,7 @@ dependencies = [
[[package]]
name = "image-workbench"
version = "3.25.1"
version = "3.25.2"
dependencies = [
"log",
"serde",
@@ -1677,6 +1706,7 @@ dependencies = [
"tauri-plugin-fs",
"tauri-plugin-http",
"tauri-plugin-log",
"tauri-plugin-updater",
]
[[package]]
@@ -1814,6 +1844,36 @@ dependencies = [
"windows-sys 0.45.0",
]
[[package]]
name = "jni"
version = "0.22.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498"
dependencies = [
"cfg-if",
"combine",
"jni-macros",
"jni-sys 0.4.1",
"log",
"simd_cesu8",
"thiserror 2.0.21",
"walkdir",
"windows-link",
]
[[package]]
name = "jni-macros"
version = "0.22.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3"
dependencies = [
"proc-macro2",
"quote",
"rustc_version",
"simd_cesu8",
"syn 2.0.119",
]
[[package]]
name = "jni-sys"
version = "0.3.1"
@@ -1949,6 +2009,12 @@ version = "0.19.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d9aae57673c1a235149777a74d152f3210ebd3e3b13346d2cdb6809e566bd3c"
[[package]]
name = "linux-raw-sys"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
[[package]]
name = "litemap"
version = "0.8.3"
@@ -2025,6 +2091,12 @@ version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5848f5a9e8117cf94f2f90faac24a87ff81600ff8628c1e3deaab572e76bfa1"
[[package]]
name = "minisign-verify"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "871285dc19d8d0ebe0eef3d0e99a205f2a71363b122632cbbfa4a6c370a960ce"
[[package]]
name = "miniz_oxide"
version = "0.8.9"
@@ -2129,6 +2201,18 @@ version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
[[package]]
name = "nix"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77730ed34f01f4990cb2ea67fec715ecebc6fab9a6396cf83c5529b13f581bdc"
dependencies = [
"bitflags 2.13.2",
"cfg-if",
"cfg_aliases",
"libc",
]
[[package]]
name = "num-conv"
version = "0.2.2"
@@ -2315,6 +2399,18 @@ dependencies = [
"objc2-core-foundation",
]
[[package]]
name = "objc2-osa-kit"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f112d1746737b0da274ef79a23aac283376f335f4095a083a267a082f21db0c0"
dependencies = [
"bitflags 2.13.2",
"objc2",
"objc2-app-kit",
"objc2-foundation",
]
[[package]]
name = "objc2-quartz-core"
version = "0.3.2"
@@ -2378,12 +2474,32 @@ version = "1.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
[[package]]
name = "openssl-probe"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e036b411754132fd6b74e94b74e9a13c5cf606fa93d1885c35860d3060820b1"
[[package]]
name = "option-ext"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "osakit"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "732c71caeaa72c065bb69d7ea08717bd3f4863a4f451402fc9513e29dbd5261b"
dependencies = [
"objc2",
"objc2-foundation",
"objc2-osa-kit",
"serde",
"serde_json",
"thiserror 2.0.21",
]
[[package]]
name = "pango"
version = "0.18.3"
@@ -2945,15 +3061,20 @@ dependencies = [
"http-body",
"http-body-util",
"hyper",
"hyper-rustls",
"hyper-util",
"js-sys",
"log",
"percent-encoding",
"pin-project-lite",
"rustls",
"rustls-pki-types",
"rustls-platform-verifier",
"serde",
"serde_json",
"sync_wrapper",
"tokio",
"tokio-rustls",
"tokio-util",
"tower",
"tower-http",
@@ -3020,6 +3141,19 @@ dependencies = [
"semver",
]
[[package]]
name = "rustix"
version = "1.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa"
dependencies = [
"bitflags 2.13.2",
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.61.2",
]
[[package]]
name = "rustls"
version = "0.23.46"
@@ -3034,6 +3168,18 @@ dependencies = [
"zeroize",
]
[[package]]
name = "rustls-native-certs"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a073f5dc7469f984c52ad2752b63b0807745133b6de880b7b64c1ac4c48aec4"
dependencies = [
"openssl-probe",
"rustls-pki-types",
"schannel",
"security-framework",
]
[[package]]
name = "rustls-pki-types"
version = "1.16.0"
@@ -3044,6 +3190,33 @@ dependencies = [
"zeroize",
]
[[package]]
name = "rustls-platform-verifier"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1167586491e2b18b8bfbb293e8180ec17c201c4f076d7cb3070ca964e7598f98"
dependencies = [
"core-foundation 0.10.1",
"core-foundation-sys",
"jni 0.22.4",
"log",
"once_cell",
"rustls",
"rustls-native-certs",
"rustls-platform-verifier-android",
"rustls-webpki",
"security-framework",
"security-framework-sys",
"webpki-root-certs",
"windows-sys 0.61.2",
]
[[package]]
name = "rustls-platform-verifier-android"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eec689c0bc40ff2458a5977b6619cb718087084a18e02a131c599b62d05e1a5f"
[[package]]
name = "rustls-webpki"
version = "0.103.17"
@@ -3076,6 +3249,15 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "schannel"
version = "0.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9cb23c424d8ee841bb4d813677ca237e2a610067d594fec130f87d6093495ab5"
dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "schemars"
version = "0.8.22"
@@ -3133,6 +3315,29 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "security-framework"
version = "3.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d"
dependencies = [
"bitflags 2.13.2",
"core-foundation 0.10.1",
"core-foundation-sys",
"libc",
"security-framework-sys",
]
[[package]]
name = "security-framework-sys"
version = "2.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
name = "selectors"
version = "0.38.0"
@@ -3382,6 +3587,16 @@ version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea"
[[package]]
name = "simd_cesu8"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520"
dependencies = [
"rustc_version",
"simdutf8",
]
[[package]]
name = "simdutf8"
version = "0.1.5"
@@ -3651,7 +3866,7 @@ dependencies = [
"gdkwayland-sys",
"gdkx11-sys",
"gtk",
"jni",
"jni 0.21.1",
"libc",
"log",
"ndk",
@@ -3684,6 +3899,17 @@ dependencies = [
"syn 2.0.119",
]
[[package]]
name = "tar"
version = "0.4.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840"
dependencies = [
"filetime",
"libc",
"xattr",
]
[[package]]
name = "target-lexicon"
version = "0.12.16"
@@ -3708,7 +3934,7 @@ dependencies = [
"heck 0.5.0",
"http",
"image",
"jni",
"jni 0.21.1",
"libc",
"log",
"mime",
@@ -3910,6 +4136,40 @@ dependencies = [
"time",
]
[[package]]
name = "tauri-plugin-updater"
version = "2.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d957abbcb3f9f6c76d22a3a0f012f30880640d0bccb5634d2b12a9937e4c872b"
dependencies = [
"base64 0.23.1",
"dirs",
"flate2",
"futures-util",
"http",
"infer",
"libc",
"log",
"minisign-verify",
"osakit",
"percent-encoding",
"reqwest 0.13.5",
"rustls",
"semver",
"serde",
"serde_json",
"tar",
"tauri",
"tauri-plugin",
"tempfile",
"thiserror 2.0.21",
"time",
"tokio",
"url",
"windows-sys 0.61.2",
"zip",
]
[[package]]
name = "tauri-runtime"
version = "2.12.2"
@@ -3920,7 +4180,7 @@ dependencies = [
"dpi",
"gtk",
"http",
"jni",
"jni 0.21.1",
"objc2",
"objc2-ui-kit",
"objc2-web-kit",
@@ -3943,7 +4203,7 @@ checksum = "e1aa9d8b7a120f879f44fdc1053f7b7dbf416bf0bbc6a72b714dec46b782b52f"
dependencies = [
"gtk",
"http",
"jni",
"jni 0.21.1",
"log",
"objc2",
"objc2-app-kit",
@@ -4009,6 +4269,19 @@ dependencies = [
"toml 1.2.1+spec-1.1.0",
]
[[package]]
name = "tempfile"
version = "3.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
dependencies = [
"fastrand",
"getrandom 0.4.3",
"once_cell",
"rustix",
"windows-sys 0.61.2",
]
[[package]]
name = "tendril"
version = "0.5.1"
@@ -4344,6 +4617,12 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
[[package]]
name = "typed-path"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ce898823d8cd0f028662d2f349694b1af0a5cc9be83f1d213a00d3147445e1e"
[[package]]
name = "typeid"
version = "1.0.3"
@@ -4648,6 +4927,15 @@ dependencies = [
"system-deps",
]
[[package]]
name = "webpki-root-certs"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "293198dcebfb821155b5092ab94b5a82ff180eddd7241df3bd6e66a4ffd1a585"
dependencies = [
"rustls-pki-types",
]
[[package]]
name = "webpki-roots"
version = "1.0.12"
@@ -5074,7 +5362,7 @@ dependencies = [
"gtk",
"http",
"javascriptcore-rs",
"jni",
"jni 0.21.1",
"libc",
"ndk",
"objc2",
@@ -5120,6 +5408,16 @@ dependencies = [
"pkg-config",
]
[[package]]
name = "xattr"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "963d6fab92d5504b971dc8bd90ca743c2575e590bc8071ea5bc571598667ae08"
dependencies = [
"libc",
"rustix",
]
[[package]]
name = "yoke"
version = "0.8.4"
@@ -5169,6 +5467,20 @@ name = "zeroize"
version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879"
dependencies = [
"zeroize_derive",
]
[[package]]
name = "zeroize_derive"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.119",
]
[[package]]
name = "zerotrie"
@@ -5203,6 +5515,24 @@ dependencies = [
"syn 3.0.10",
]
[[package]]
name = "zip"
version = "9.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "953a376f4930ed5af88e1e65948385f76866b45e7f75b21ac275327d0eeb9b46"
dependencies = [
"constant_time_eq",
"crc32fast",
"getrandom 0.4.3",
"indexmap 2.14.2",
"libc",
"memchr",
"nix",
"typed-path",
"windows-sys 0.61.2",
"zeroize",
]
[[package]]
name = "zlib-rs"
version = "0.6.8"
+2 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "image-workbench"
version = "3.25.1"
version = "3.25.2"
description = "无限画布 · 生图工作台桌面版"
authors = ["malongan"]
license = ""
@@ -28,3 +28,4 @@ tauri-plugin-log = "2"
tauri-plugin-dialog = "2"
tauri-plugin-fs = "2"
tauri-plugin-http = "2"
tauri-plugin-updater = "2"
+31 -1
View File
@@ -205,13 +205,43 @@ fn open_app_data_dir(app: AppHandle) -> Result<String, String> {
Ok(path)
}
use tauri_plugin_updater::UpdaterExt;
#[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())?;
match updater.check().await {
Ok(Some(update)) => Ok(Some(serde_json::json!({
"version": update.version,
"currentVersion": update.current_version,
"notes": update.body.unwrap_or_default(),
"date": update.date.map(|d| d.to_string()).unwrap_or_default()
}))),
Ok(None) => Ok(None),
Err(e) => Err(e.to_string()),
}
}
#[tauri::command]
async fn install_update(app: tauri::AppHandle) -> Result<bool, String> {
let updater = app.updater().map_err(|e| e.to_string())?;
let found = updater.check().await.map_err(|e| e.to_string())?;
let Some(update) = found else { return Ok(false) };
update
.download_and_install(|_chunk, _total| {}, || {})
.await
.map_err(|e| e.to_string())?;
app.restart();
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
let app = tauri::Builder::default()
.plugin(tauri_plugin_http::init())
.plugin(tauri_plugin_fs::init())
.plugin(tauri_plugin_dialog::init())
.invoke_handler(tauri::generate_handler![open_app_data_dir, grant_dir, copy_tree])
.plugin(tauri_plugin_updater::Builder::new().build())
.invoke_handler(tauri::generate_handler![open_app_data_dir, grant_dir, copy_tree, check_update, install_update])
.setup(|app| {
if cfg!(debug_assertions) {
app.handle().plugin(
+11 -2
View File
@@ -1,7 +1,7 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "image-workbench",
"version": "3.25.1",
"version": "3.25.2",
"identifier": "com.malongan.imageworkbench",
"build": {
"frontendDist": "../dist",
@@ -40,6 +40,15 @@
"icons/[email protected]",
"icons/icon.icns",
"icons/icon.ico"
]
],
"createUpdaterArtifacts": true
},
"plugins": {
"updater": {
"endpoints": [
"https://download.maqiart.eu.org/updates/latest.json"
],
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDE3QUU1N0QwQUM5RjE1RjEKUldUeEZaK3MwRmV1RnhjNVhhSlhaSHkvbVRXNDdscHpOa0s0VHF4NHBBQVJBdDQ0dEVlck5FeEsK"
}
}
}
+5 -2
View File
@@ -229,8 +229,11 @@
function isEnabled(id) {
if (plugins.has(id)) return Boolean(recordOf(id).enabled)
// 未注册:直接读持久化开关(不得走 recordOf——那会为陌生 id 创建 state 条目)
return Boolean(state[id] && state[id].enabled)
// 未注册:有持久化记录就按记录;**没有记录 ⇒ 默认启用**
// (否则启动早期 state 还没读到时,所有插件都会被判成「已停用」而进 idle)
const rec = state[id]
if (!rec) return true
return Boolean(rec.enabled)
}
function init(nextDeps) {
+2 -1
View File
@@ -46,7 +46,8 @@
const H = host()
const registered = !!(H && typeof H.list === 'function' && H.list().some(function (p) { return p.id === record.id }))
record.status = registered ? 'loaded' : 'not-registered'
if (registered && typeof H.isEnabled === 'function' && H.isEnabled(record.id)) H.setEnabled(record.id, true)
// 不在加载阶段写启用状态:否则会把用户关掉的插件又打开
// (启用/停用由 app.js 加载完成后按持久化状态统一应用)
return record.status === 'loaded'
}
+35 -6
View File
@@ -13,18 +13,47 @@
return (F && F.plugins) ? F.plugins : null
}
// 桌面端优先走 Tauri 原生 HTTP(WKWebView 在代理/fake-IP 环境下 fetch 会 Load failed)
function marketFetch (url) {
// 桌面端优先走 Tauri 原生 HTTP(WKWebView 在代理/fake-IP 环境下 fetch 会 Load failed);
// 原生失败时再退回 WebView fetch(有些 Windows 公司网络/代理只放行后者),两个错误都带上,便于定位。
async function marketFetch (url) {
const T = (global.__TAURI__ && global.__TAURI__.http) ? global.__TAURI__.http : null
if (T && typeof T.fetch === 'function') return T.fetch(url)
return global.fetch(url, { cache: 'no-store' })
let nativeErr = ''
if (T && typeof T.fetch === 'function') {
try { return await T.fetch(url) } catch (e) { nativeErr = String((e && e.message) || e) }
}
try {
return await global.fetch(url, { cache: 'no-store' })
} catch (e2) {
const webErr = String((e2 && e2.message) || e2)
throw new Error('无法访问 ' + url + (nativeErr ? ('(原生 HTTP:' + nativeErr + ')') : '') + '(网页请求:' + webErr + ')')
}
}
// 本地缓存:上次成功拉到的市场列表(毫秒级出图,后台再刷新)
const CACHE_KEY = 'iwb_market_cache'
function localStore () {
const L = global.IWBStorageLocal || null
return (L && typeof L.getStore === 'function') ? L.getStore() : null
}
function cached () {
try {
const st = localStore()
if (!st) return null
const v = st.get(CACHE_KEY)
return (Array.isArray(v) && v.length) ? v : null
} catch (e) { return null }
}
function saveCache (list) {
try { const st = localStore(); if (st && Array.isArray(list) && list.length) st.set(CACHE_KEY, list) } catch (e) { /* ignore */ }
}
async function list () {
const resp = await marketFetch(MARKET_URL)
if (!resp.ok) throw new Error('市场不可达:HTTP ' + resp.status)
const j = await resp.json()
return Array.isArray(j && j.plugins) ? j.plugins : []
const items = Array.isArray(j && j.plugins) ? j.plugins : []
saveCache(items)
return items
}
async function installed () {
@@ -69,5 +98,5 @@
} catch (e) { return { ok: false, error: String((e && e.message) || e) } }
}
global.IWBRuntimePluginMarket = { list: list, installed: installed, install: install, uninstall: uninstall }
global.IWBRuntimePluginMarket = { list: list, cached: cached, installed: installed, install: install, uninstall: uninstall }
})(typeof window !== 'undefined' ? window : globalThis)
+3
View File
@@ -370,6 +370,9 @@
function inheritBar(info, opts) {
const o = opts || {}
const own = !!info.own
// 没有上游节点(纯手写提示词)就不要显示「已固定 / 恢复跟随」,
// 否则点「恢复跟随」会把用户手写的文案清空。
if (!info.hasUpstream) return null
if (!own && !info.text) return null
const srcName = nodeLabelOf(info.sourceNodeId, o.nodes)
const parts = [
+1 -1
View File
@@ -566,7 +566,7 @@ function SettingsModal(props) {
}, I(SET_NAV_ICONS[t[0]] || 'settings'), el('span', null, t[1]))),
el('div', { className: 'iwb-set-nav-group' }, '插件'),
el('button', { key: 'nav-plugins', className: 'iwb-tab iwb-set-nav-item' + (tab === 'plugins' ? ' iwb-tab-active' : ''), onClick: () => setTab('plugins') }, I('panel'), el('span', null, '插件管理')),
pluginItems.map((p) => el('button', { key: 'nav-plugin:' + p.id, className: 'iwb-tab iwb-set-nav-item' + (tab === 'plugin:' + p.id ? ' iwb-tab-active' : ''), onClick: () => setTab('plugin:' + p.id) }, I('star'), el('span', null, p.name))),
pluginItems.filter((p) => p && p.enabled).map((p) => el('button', { key: 'nav-plugin:' + p.id, className: 'iwb-tab iwb-set-nav-item' + (tab === 'plugin:' + p.id ? ' iwb-tab-active' : ''), onClick: () => setTab('plugin:' + p.id) }, I('star'), el('span', null, p.name))),
),
el('div', { className: 'iwb-modal-body' },
tab === 'gen' ? genTab : tab === 'llm' ? llmTab : tab === 'img' ? imgTab : tab === 'backup' ? backupTab : tab === 'hotkeys' ? hotkeyTab : tab === 'sizes' ? sizePresetTab : tab === 'plugins' ? pluginsTab : (typeof tab === 'string' && tab.indexOf('plugin:') === 0) ? pluginSettingsPage : tab === 'diag' ? diagTab : generalTab,
+300 -139
View File
@@ -123,54 +123,85 @@
try { const st = pluginDevStore(); if (st) st.set('iwb_plugin_dev', !!on) } catch (e) { /* ignore */ }
}
// 桌面端插件管理(参考 Obsidian):搜索 + 已安装(开关/设置)+ 可安装(市场)
// 桌面端插件管理:两页 —— 管理页(横向列表 + 开关)/ 市场页(卡片墙 + 安装)
function DesktopPluginsTab (props) {
const { PluginHost, pluginItems, setPluginsRev, setTab, wRuntimePlugins } = props
const [market, setMarket] = React.useState(null)
const [view, setView] = React.useState('manage')
const [market, setMarket] = React.useState(function () {
try { const M = (typeof window !== 'undefined') ? window.IWBRuntimePluginMarket : null; return M && M.cached ? M.cached() : null } catch (e) { return null }
})
const [inst, setInst] = React.useState({})
const [q, setQ] = React.useState('')
const [msg, setMsg] = React.useState('')
const [busy, setBusy] = React.useState('')
const [restart, setRestart] = React.useState(false)
const [devMode, setDevMode] = React.useState(function () {
return pluginDevGet()
})
const [devMode, setDevMode] = React.useState(function () { return pluginDevGet() })
const [mf, setMf] = React.useState('all') // 市场页筛选:all / installed / available
const [mt, setMt] = React.useState('') // 市场页标签筛选(空=全部标签)
const D = (typeof window !== 'undefined') ? window.IWBDesktop : null
const refresh = React.useCallback(async () => {
if (!D || !D.market) { setMarket([]); return }
// 先读本地清单(毫秒级)→ 立刻把「已安装」渲染出来;市场列表(网络)随后补上
try {
const list = await D.market.list()
const cur = await D.market.installed()
const map = {}
for (const p of (cur || [])) if (p && p.id) map[p.id] = p.version || ''
setMarket(list); setInst(map); setMsg('')
} catch (e) { setMarket([]); setMsg('市场加载失败:' + String((e && e.message) || e)) }
setInst(map)
} catch (e) { /* 本地清单失败不阻塞市场请求 */ }
try {
const list = await D.market.list()
setMarket(list); setMsg('')
} catch (e) { setMsg('市场加载失败:' + String((e && e.message) || e)) }
}, [D])
React.useEffect(() => { refresh() }, [refresh])
const act = async (kind, id) => {
React.useEffect(function () { refresh() }, [refresh])
const act = async function (kind, id) {
if (!D || !D.market) return
setBusy(id)
try {
const r = kind === 'install' ? await D.market.install(id) : await D.market.uninstall(id)
if (!r || !r.ok) { setMsg((r && r.error) || '操作失败'); return }
setMsg(kind === 'install' ? '已安装,重启应用后生效' : '已移除外部副本,重启后回退内置')
setMsg(kind === 'install' ? '已安装,重启应用后生效' : '已移除')
await refresh()
setRestart(true)
if (kind === 'install') setRestart(true)
} finally { setBusy('') }
}
const toggle = (p, on) => {
const r = PluginHost.setEnabled(p.id, on)
setPluginsRev((v) => v + 1)
if (!r.ok) setMsg(p.name + ':' + r.error)
// 用 src 模块加载脚本(不引 app.js 全局),成功后再写启用状态
const loadRuntimePlugin = async function (id) {
const rec = (wRuntimePlugins || []).find(function (r) { return r && r.id === id })
const L = (typeof window !== 'undefined') ? window.IWBRuntimePluginLoader : null
if (!rec || !L) { setMsg('插件清单里没有该 id'); return false }
let ok = false
try {
if (rec.source === 'local') ok = await L.loadLocal(rec)
else if (rec.source === 'external') ok = await L.loadExternal(rec)
else ok = await L.loadBuiltin(rec)
} catch (e) { setMsg('加载失败:' + String((e && e.message) || e)); return false }
if (!ok) { setMsg('加载失败:' + (rec.error || '脚本已加载但插件未注册')); return false }
return true
}
const toggle = async function (id, on, registered) {
setBusy(id)
try {
// 打开一个「未加载」的插件:先加载脚本,再写启用状态(否则只是记了个开关,插件依然不生效)
if (on && !registered) {
const okLoad = await loadRuntimePlugin(id)
if (!okLoad) return
}
const r = PluginHost.setEnabled(id, on)
if (!r.ok) setMsg('切换失败:' + r.error)
else setMsg(on ? '已启用' : '已停用(重启后保持关闭)')
} finally {
setPluginsRev(function (v) { return v + 1 })
setBusy('')
}
}
const kw = q.trim().toLowerCase()
const hit = (name, desc) => !kw || (String(name) + ' ' + String(desc || '')).toLowerCase().indexOf(kw) >= 0
const hit = function (name, desc) { return !kw || (String(name) + ' ' + String(desc || '')).toLowerCase().indexOf(kw) >= 0 }
const mList = market || []
const findM = (id) => mList.find((m) => m && m.id === id) || {}
const findM = function (id) { return mList.find(function (m) { return m && m.id === id }) || {} }
const regById = {}
for (const p of (pluginItems || [])) regById[p.id] = p
// 已安装:以资料目录 plugins/ 清单为准(装了就列出来,哪怕加载失败也能看到/移除)
const installedRows = Object.keys(inst).map((id) => {
const installedRows = Object.keys(inst).map(function (id) {
const m = findM(id)
const reg = regById[id]
return {
@@ -178,94 +209,220 @@
name: m.name || (reg && reg.name) || id,
version: m.version || inst[id] || (reg && reg.version) || '',
desc: m.desc || '',
author: m.author || '',
icon: m.icon || '◻',
color: m.color || '#eef2f6',
tags: m.tags || [],
enabled: reg ? !!reg.enabled : true,
compatible: reg ? !!reg.compatible : true,
registered: !!reg,
newer: !!(m.version && inst[id] && m.version !== inst[id]),
}
}).filter((row) => hit(row.name, row.desc))
const availRows = mList.filter((m) => !(m.id in inst) && !regById[m.id] && hit(m.name, m.desc))
const updatable = Object.keys(inst).filter((id) => findM(id).version && findM(id).version !== inst[id]).length
const dirHint = (() => {
}).filter(function (row) { return hit(row.name, row.desc) })
const availRows = mList.filter(function (m) { return !(m.id in inst) && !regById[m.id] && hit(m.name, m.desc) })
const updatable = Object.keys(inst).filter(function (id) { const m = findM(id); return m.version && m.version !== inst[id] }).length
const dirHint = (function () {
const F = (typeof window !== 'undefined') ? window.IWBStorageFile : null
return (F && F.dir && F.dir()) ? (F.dir() + '/plugins/') : '资料目录/plugins/'
})()
return el('div', { className: 'iwb-set-page' },
el('div', { className: 'iwb-set-page-title' }, '插件'),
el('div', { className: 'iwb-hint' }, '插件从市场安装到:' + dirHint + '(应用本体不再自带插件)'),
el('div', { className: 'iwb-row' },
el('label', { className: 'iwb-check', title: '本地开发用:把插件放到 plugins/local/<id>/plugin.js' },
el('input', {
type: 'checkbox',
checked: devMode,
onChange: function (e) {
const on = e.target.checked
setDevMode(on)
pluginDevSet(on)
setMsg(on ? '已开启开发者模式,重启后加载 plugins/local/ 下的插件' : '已关闭开发者模式,重启后只加载市场安装的插件')
const kb = function (n) { return !n ? '' : (n >= 1048576 ? (n / 1048576).toFixed(1) + ' MB' : Math.max(1, Math.round(n / 1024)) + ' KB') }
// ── 管理页:横向列表(名称/版本/作者 + 描述 + 操作 + 开关),像 Obsidian「第三方插件」 ──
const manageView = function () {
return el('div', { className: 'iwb-set-page' },
el('div', { className: 'iwb-set-page-title' }, '插件'),
el('div', { className: 'iwb-mk-setrow' },
el('div', { className: 'iwb-mk-setrow-main' },
el('div', { className: 'iwb-mk-setrow-title' }, '插件市场'),
el('div', { className: 'iwb-hint' }, '浏览并安装由官方 / 社区制作的插件'),
),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: function () { setView('market'); setMsg('') } }, '浏览'),
),
el('div', { className: 'iwb-mk-setrow' },
el('div', { className: 'iwb-mk-setrow-main' },
el('div', { className: 'iwb-mk-setrow-title' }, '插件安装情况'),
el('div', { className: 'iwb-hint' }, (installedRows.length ? ('你目前已经安装了 ' + installedRows.length + ' 个插件') : '还没有安装插件') + (updatable ? (',其中 ' + updatable + ' 个可更新') : '')),
),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: refresh }, '检查更新'),
),
el('div', { className: 'iwb-mk-setrow' },
el('div', { className: 'iwb-mk-setrow-main' },
el('div', { className: 'iwb-mk-setrow-title' }, '开发者模式'),
el('div', { className: 'iwb-hint' }, '加载 plugins/local/<id>/plugin.js(未签名,仅本地调试)'),
),
el('label', { className: 'iwb-switch' },
el('input', {
type: 'checkbox', checked: devMode,
onChange: function (e) {
const on = e.target.checked
setDevMode(on); pluginDevSet(on)
setMsg(on ? '已开启开发者模式,重启后加载 plugins/local/ 下的插件' : '已关闭开发者模式')
},
}),
el('span', { className: 'iwb-switch-track' }, el('span', { className: 'iwb-switch-dot' })),
),
),
el('div', { className: 'iwb-mk-setrow' },
el('div', { className: 'iwb-mk-setrow-main' },
el('div', { className: 'iwb-mk-setrow-title' }, '插件诊断'),
el('div', { className: 'iwb-hint' }, '加载失败时点这里复制诊断 JSON(含清单、运行时状态、错误原因)'),
),
el('button', {
className: 'iwb-btn iwb-btn-sm',
onClick: async function () {
try {
const F = (typeof window !== 'undefined') ? window.IWBStorageFile : null
let manifest = /** @type {any} */ ([])
try { manifest = await F.plugins.manifest() } catch (e) { manifest = String(e && e.message) }
let marketInfo = null
try { const mm = await D.market.list(); marketInfo = { ok: true, count: (mm || []).length } } catch (e) { marketInfo = { ok: false, error: String((e && e.message) || e) } }
const payload = {
market: marketInfo,
dir: (F && F.dir) ? F.dir() : '',
devMode: pluginDevGet(),
manifest: manifest,
runtime: (wRuntimePlugins || []).map(function (r) { return { id: r.id, status: r.status, source: r.source, error: r.error || '', file: r.file, version: r.version } }),
registered: (pluginItems || []).map(function (p) { return { id: p.id, enabled: p.enabled, compatible: p.compatible } }),
}
const text = JSON.stringify(payload, null, 2)
try { await navigator.clipboard.writeText(text) } catch (e) { try { const ta = document.createElement('textarea'); ta.value = text; document.body.appendChild(ta); ta.select(); document.execCommand('copy'); ta.remove() } catch (e2) { /* ignore */ } }
setMsg('诊断已复制到剪贴板')
} catch (e) { setMsg('诊断生成失败:' + String((e && e.message) || e)) }
},
}),
' 开发者模式(加载 plugins/local/<id>/plugin.js,未签名)'),
),
el('div', { className: 'iwb-row' },
el('label', { className: 'iwb-check', title: '用于本地开发:把插件放到 plugins/local/<id>/plugin.js' },
el('input', {
type: 'checkbox', checked: devMode,
onChange: (e) => {
const on = e.target.checked
setDevMode(on)
pluginDevSet(on)
setMsg(on ? '已开启开发者模式,重启后加载 plugins/local/ 下的插件' : '已关闭开发者模式,重启后只加载市场安装的插件')
},
}),
' 开发者模式(加载 plugins/local/<id>/plugin.js,未签名)'),
),
el('div', { className: 'iwb-row' },
el('input', { className: 'iwb-input iwb-grow', placeholder: '搜索已安装的插件…', value: q, onChange: (e) => setQ(e.target.value) }),
),
el('div', { className: 'iwb-row' },
el('span', { className: 'iwb-hint', style: { flex: '1 1 auto' } },
'已安装 ' + installedRows.length + ' 个' + (mList.length ? (' · 市场 ' + mList.length + ' 个 · 可安装 ' + availRows.length + ' 个') : '') + (updatable ? (' · 可更新 ' + updatable + ' 个') : '')),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: refresh }, '检查更新'),
),
el('div', { className: 'iwb-section-sub' }, '已安装插件'),
installedRows.length ? installedRows.map((p) => {
const rt = (wRuntimePlugins || []).find((r) => r && r.id === p.id)
const status = !p.registered ? '未加载' : (rt && rt.status === 'error' ? '加载失败' : '已加载')
const tagWarn = status !== '已加载'
return el('div', { key: p.id, className: 'iwb-plugin-item' },
el('div', { className: 'iwb-plugin-main' },
el('label', { className: 'iwb-plugin-title' },
el('input', { type: 'checkbox', checked: p.enabled, disabled: !p.registered || !p.compatible, onChange: (e) => p.registered && toggle(regById[p.id], e.target.checked) }),
el('span', null, p.name + ' v' + p.version),
el('span', { className: 'iwb-plugin-tag' + (tagWarn ? ' iwb-plugin-tag-warn' : ''), title: (rt && rt.error) || '' }, status),
p.newer ? el('span', { className: 'iwb-plugin-tag' }, '可更新') : null,
}, '复制诊断'),
),
el('div', { className: 'iwb-row' },
el('span', { className: 'iwb-hint', style: { flex: '1 1 auto' } }, '开关灰色或显示「未加载」时,点右侧按钮会当场加载并启用'),
el('button', { className: 'iwb-btn iwb-btn-sm', disabled: !!busy, onClick: async function () {
const list = installedRows.filter(function (p) { return !p.registered })
if (!list.length) { setMsg('已安装的插件都已加载'); return }
setBusy('__all__')
let ok = 0
for (const p of list) {
try { const good = await loadRuntimePlugin(p.id); if (good) { PluginHost.setEnabled(p.id, true); ok++ } } catch (e) { /* ignore */ }
}
setBusy('')
setPluginsRev(function (v) { return v + 1 })
setMsg('已启用 ' + ok + '/' + list.length + ' 个插件')
} }, busy === '__all__' ? '处理中…' : '全部启用'),
),
el('div', { className: 'iwb-section-sub' }, '已安装插件'),
el('div', { className: 'iwb-row' },
el('input', { className: 'iwb-input iwb-grow', placeholder: '搜索已安装的插件…', value: q, onChange: function (e) { setQ(e.target.value) } }),
),
installedRows.length ? el('div', { className: 'iwb-mk-list' }, installedRows.map(function (p) {
const rt = (wRuntimePlugins || []).find(function (r) { return r && r.id === p.id })
const statusText = !p.registered ? '未加载' : (rt && rt.status === 'error' ? '加载失败' : '')
const warn = !!statusText
return el('div', { key: p.id, className: 'iwb-mk-row' },
el('span', { className: 'iwb-mk-avatar', style: { background: p.color } }, p.icon),
el('div', { className: 'iwb-mk-row-main' },
el('div', { className: 'iwb-mk-row-title' },
el('span', { className: 'iwb-mk-row-name' }, p.name),
el('span', { className: 'iwb-mk-row-ver' }, 'v' + p.version),
p.author ? el('span', { className: 'iwb-mk-row-author' }, p.author === 'official' ? '官方' : p.author) : null,
statusText ? el('span', { className: 'iwb-plugin-tag' + (warn ? ' iwb-plugin-tag-warn' : ''), title: (rt && rt.error) || '' }, statusText) : null,
p.newer ? el('span', { className: 'iwb-plugin-tag' }, '可更新') : null,
),
el('div', { className: 'iwb-mk-row-desc' }, p.desc || ''),
(rt && rt.error) ? el('div', { className: 'iwb-hint', style: { color: 'var(--iwb-err)' } }, '错误:' + rt.error) : null,
),
p.desc ? el('div', { className: 'iwb-plugin-desc' }, p.desc) : null,
el('div', { className: 'iwb-mk-row-actions' },
p.newer ? el('button', { className: 'iwb-btn iwb-btn-sm', disabled: !!busy, onClick: function () { act('install', p.id) } }, '更新') : null,
p.registered ? el('button', { className: 'iwb-btn iwb-btn-sm', onClick: function () { setTab('plugin:' + p.id) } }, '设置') : null,
el('button', { className: 'iwb-btn iwb-btn-sm', disabled: !!busy, onClick: function () { act('uninstall', p.id) } }, '移除'),
el('label', { className: 'iwb-switch', title: p.registered ? '启用 / 停用' : '未加载,无法启用' },
el('input', {
type: 'checkbox', checked: p.enabled, disabled: !p.compatible,
onChange: function (e) { toggle(p.id, e.target.checked, p.registered) },
}),
el('span', { className: 'iwb-switch-track' }, el('span', { className: 'iwb-switch-dot' })),
),
),
)
})) : el('div', { className: 'iwb-hint' }, kw ? '没有匹配的插件' : (market === null ? '读取插件清单中…' : '还没有安装插件——点上面的「浏览」进入市场')),
restart ? el('div', { className: 'iwb-mk-setrow' },
el('div', { className: 'iwb-mk-setrow-main' },
el('div', { className: 'iwb-mk-setrow-title' }, '需要重启应用才能生效'),
el('div', { className: 'iwb-hint' }, '新装的插件在重启后加载'),
),
el('div', { className: 'iwb-plugin-actions' },
p.registered ? el('button', { className: 'iwb-btn iwb-btn-sm', onClick: () => setTab('plugin:' + p.id) }, '设置') : null,
p.newer ? el('button', { className: 'iwb-btn iwb-btn-sm', disabled: !!busy, onClick: () => act('install', p.id) }, '更新') : null,
el('button', { className: 'iwb-btn iwb-btn-sm', disabled: !!busy, onClick: () => act('uninstall', p.id) }, '移除'),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: function () { window.location.reload() } }, '立即重启'),
) : null,
msg ? el('div', { className: 'iwb-hint' }, msg) : null,
)
}
// ── 市场页:卡片墙 + 安装(与 market.maqiart.eu.org 同一套数据/视觉)──
const marketView = function () {
return el('div', { className: 'iwb-set-page' },
el('div', { className: 'iwb-set-page-title' },
el('button', { className: 'iwb-btn iwb-btn-sm', style: { marginRight: 10 }, onClick: function () { setView('manage') } }, '返回'),
'插件市场',
),
el('div', { className: 'iwb-hint' }, '共 ' + mList.length + ' 个插件 · 安装在 ' + dirHint),
el('div', { className: 'iwb-row' },
el('input', { className: 'iwb-input iwb-grow', placeholder: '搜索插件,例如:出图、抠图、矢量…', value: q, onChange: function (e) { setQ(e.target.value) } }),
),
(function () {
const tags = []
for (const m of mList) for (const t of (m.tags || [])) if (tags.indexOf(t) < 0) tags.push(t)
return el('div', { className: 'iwb-mk-filters' }, tags.map(function (t) {
return el('button', { key: t, className: 'iwb-mk-chip' + (mt === t ? ' on' : ''), onClick: function () { setMt(mt === t ? '' : t) } }, t)
}))
})(),
(function () {
const all = mList.filter(function (m) { return hit(m.name, m.desc) })
const shown = all.filter(function (m) {
if (mt && (m.tags || []).indexOf(mt) < 0) return false
const isInst = (m.id in inst) || !!regById[m.id]
if (mf === 'installed') return isInst
if (mf === 'available') return !isInst
return true
})
return el('div', null,
el('div', { className: 'iwb-mk-filters' },
el('button', { className: 'iwb-mk-chip' + (mf === 'all' ? ' on' : ''), onClick: function () { setMf('all') } }, '全部 ' + all.length),
el('button', { className: 'iwb-mk-chip' + (mf === 'installed' ? ' on' : ''), onClick: function () { setMf('installed') } }, '已安装 ' + all.filter(function (m) { return (m.id in inst) || !!regById[m.id] }).length),
el('button', { className: 'iwb-mk-chip' + (mf === 'available' ? ' on' : ''), onClick: function () { setMf('available') } }, '未安装 ' + all.filter(function (m) { return !((m.id in inst) || !!regById[m.id]) }).length),
),
shown.length ? el('div', { className: 'iwb-mk-grid' }, shown.map(function (m) {
const bits = []
if (m.author) bits.push(m.author === 'official' ? '官方' : m.author)
if (m.version) bits.push('v' + m.version)
if (m.size) bits.push(kb(m.size))
return el('div', { key: m.id, className: 'iwb-mk-card' },
el('div', { className: 'iwb-mk-head' },
el('span', { className: 'iwb-mk-avatar', style: { background: m.color || '#eef2f6' } }, m.icon || '◻'),
el('div', { className: 'iwb-mk-titles' },
el('div', { className: 'iwb-mk-name' }, m.name || m.id,
((m.id in inst) || regById[m.id]) ? el('span', { className: 'iwb-plugin-tag', style: { marginLeft: 6 } }, '已安装') : null,
),
el('div', { className: 'iwb-mk-sub' }, bits.join(' · ')),
),
el('div', { className: 'iwb-mk-actions' },
((m.id in inst) || regById[m.id])
? el('button', { className: 'iwb-btn iwb-btn-sm', disabled: !!busy, onClick: function () { act('uninstall', m.id) } }, '移除')
: el('button', { className: 'iwb-btn iwb-btn-sm iwb-btn-primary', disabled: !!busy, onClick: function () { act('install', m.id) } }, busy === m.id ? '处理中…' : '安装'),
),
),
m.desc ? el('div', { className: 'iwb-mk-desc' }, m.desc) : null,
(m.tags && m.tags.length) ? el('div', { className: 'iwb-mk-tags' }, m.tags.map(function (t) { return el('span', { key: t, className: 'iwb-mk-tag' }, t) })) : null,
)
})) : el('div', { className: 'iwb-hint' }, mList.length ? '没有匹配的插件' : '市场加载中…'),
)
})(),
restart ? el('div', { className: 'iwb-mk-setrow' },
el('div', { className: 'iwb-mk-setrow-main' },
el('div', { className: 'iwb-mk-setrow-title' }, '需要重启应用才能生效'),
el('div', { className: 'iwb-hint' }, '安装完成后重启即可在「管理」页看到'),
),
)
}) : el('div', { className: 'iwb-hint' }, kw ? '没有匹配的插件' : '还没有安装插件——从下面的市场里挑一个'),
availRows.length ? el('div', { className: 'iwb-section-sub' }, '可安装(市场)') : null,
availRows.map((m) => el('div', { key: m.id, className: 'iwb-plugin-item' },
el('div', { className: 'iwb-plugin-main' },
el('div', { className: 'iwb-plugin-title' }, el('span', null, (m.name || m.id) + ' v' + m.version)),
m.desc ? el('div', { className: 'iwb-plugin-desc' }, m.desc) : null,
),
el('div', { className: 'iwb-plugin-actions' },
el('button', { className: 'iwb-btn iwb-btn-sm', disabled: !!busy, onClick: () => act('install', m.id) }, busy === m.id ? '处理中…' : '安装'),
),
)),
restart ? el('div', { className: 'iwb-row' },
el('span', { className: 'iwb-hint', style: { flex: '1 1 auto' } }, '需要重启应用才能生效'),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: () => window.location.reload() }, '立即重启'),
) : null,
msg ? el('div', { className: 'iwb-hint' }, msg) : null,
)
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: function () { window.location.reload() } }, '立即重启'),
) : null,
msg ? el('div', { className: 'iwb-hint' }, msg) : null,
)
}
return view === 'market' ? marketView() : manageView()
}
function renderPluginsTab (ctx) {
@@ -348,27 +505,26 @@
function VersionBlock (props) {
const version = props && props.version ? String(props.version) : ''
const [msg, setMsg] = React.useState('')
const [found, setFound] = React.useState(null)
const invoke = (cmd) => {
const T = (typeof window !== 'undefined') ? window.__TAURI__ : null
if (!T || !T.core || typeof T.core.invoke !== 'function') return Promise.reject(new Error('Tauri 未就绪'))
return T.core.invoke(cmd)
}
const check = async () => {
try {
const U = (typeof window !== 'undefined' && window.__TAURI__ && window.__TAURI__.updater) ? window.__TAURI__.updater : null
if (!U || typeof U.check !== 'function') {
setMsg('在线更新尚未启用:需要配置更新源地址与签名公钥(见 docs/DESKTOP_UPDATE.md)')
return
}
setMsg('正在检查…')
const u = await U.check()
if (!u) { setMsg('已是最新版本'); return }
setMsg('发现新版本 ' + (u.version || '') + ',点「立即更新」下载安装')
window.__IWB_UPDATE__ = u
} catch (e) { setMsg('检查失败:' + String((e && e.message) || e)) }
const r = await invoke('check_update')
if (!r) { setFound(null); setMsg('已是最新版本(v' + version + ')'); return }
setFound(r)
setMsg('发现新版本 v' + (r.version || '') + (r.notes ? ':' + r.notes : ''))
} catch (e) { setFound(null); setMsg('检查失败:' + String((e && e.message) || e)) }
}
const install = async () => {
try {
const u = window.__IWB_UPDATE__
if (!u || typeof u.downloadAndInstall !== 'function') { setMsg('没有可安装的更新'); return }
setMsg('正在下载安装…')
await u.downloadAndInstall()
setMsg('安装完成,请重启应用')
setMsg('正在下载并安装,完成后会自动重启…')
await invoke('install_update')
setMsg('安装完成,正在重启…')
} catch (e) { setMsg('更新失败:' + String((e && e.message) || e)) }
}
return el('div', null,
@@ -377,9 +533,9 @@
el('span', { className: 'iwb-label' }, '版本'),
el('span', { className: 'iwb-hint', style: { flex: '1 1 auto' } }, version || '未知'),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: check }, '检查更新'),
window.__IWB_UPDATE__ ? el('button', { className: 'iwb-btn iwb-btn-sm', onClick: install }, '立即更新') : null,
found ? el('button', { className: 'iwb-btn iwb-btn-sm iwb-btn-primary', onClick: install }, '立即更新') : null,
),
el('div', { className: 'iwb-hint' }, '当前为本地目录版;在线更新需要「更新源 + 签名密钥」两样东西配好才会生效。'),
el('div', { className: 'iwb-hint' }, '更新源:download.maqiart.eu.org/updates/latest.json(签名校验通过才会安装)'),
msg ? el('div', { className: 'iwb-hint' }, msg) : null,
)
}
@@ -551,35 +707,40 @@
function renderPluginSettingsPage (ctx) {
const { PluginHost, activePlugin, setMsg, setPluginsRev, setTab } = ctx
const pluginSettingsPage = activePlugin ? el('div', { className: 'iwb-set-page' },
el('div', { className: 'iwb-set-page-head' },
el('div', { className: 'iwb-set-page-headtext' },
el('div', { className: 'iwb-set-page-title' }, activePlugin.name),
el('div', { className: 'iwb-hint' }, activePlugin.id + ' · v' + activePlugin.version + (activePlugin.compatible ? '' : ' · apiVersion 不兼容') + (activePlugin.enabled ? ' · 已启用' : ' · 未启用')),
el('div', { className: 'iwb-mk-setrow' },
el('div', { className: 'iwb-mk-setrow-main' },
el('div', { className: 'iwb-mk-setrow-title' }, activePlugin.name,
el('span', { className: 'iwb-plugin-tag' + (activePlugin.enabled ? '' : ' iwb-plugin-tag-warn'), style: { marginLeft: 8 } }, activePlugin.enabled ? '已启用' : '未启用'),
activePlugin.compatible ? null : el('span', { className: 'iwb-plugin-tag iwb-plugin-tag-warn', style: { marginLeft: 4 } }, 'apiVersion 不兼容'),
),
el('div', { className: 'iwb-hint' }, activePlugin.id + ' · v' + activePlugin.version),
),
el('button', { className: 'iwb-btn iwb-btn-sm', disabled: !activePlugin.compatible, onClick: () => { const r = PluginHost.setEnabled(activePlugin.id, !activePlugin.enabled); setPluginsRev((v) => v + 1); if (!r.ok) setMsg({ type: 'err', text: r.error }) } }, activePlugin.enabled ? '停用' : '启用'),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: function () { setTab('plugins') } }, '返回'),
),
activePlugin.error ? el('div', { className: 'iwb-status-err' }, activePlugin.error) : null,
Object.keys(activePlugin.settingsSchema || {}).length ? Object.keys(activePlugin.settingsSchema).map((key) => {
el('div', { className: 'iwb-section-sub' }, '设置'),
Object.keys(activePlugin.settingsSchema || {}).length ? Object.keys(activePlugin.settingsSchema).map(function (key) {
const spec = activePlugin.settingsSchema[key] || {}
const value = activePlugin.settings && activePlugin.settings[key] !== undefined ? activePlugin.settings[key] : spec.default
const commit = (next) => { PluginHost.setSetting(activePlugin.id, key, next); setPluginsRev((v) => v + 1) }
return el('div', { key, className: 'iwb-set-row' },
el('div', { className: 'iwb-set-row-text' },
el('div', { className: 'iwb-set-row-title' }, spec.label || key),
spec.desc ? el('div', { className: 'iwb-set-row-desc' }, spec.desc) : null,
const commit = function (next) { PluginHost.setSetting(activePlugin.id, key, next); setPluginsRev(function (v) { return v + 1 }) }
return el('div', { key: key, className: 'iwb-mk-setrow' },
el('div', { className: 'iwb-mk-setrow-main' },
el('div', { className: 'iwb-mk-setrow-title' }, spec.label || key),
spec.desc ? el('div', { className: 'iwb-hint' }, spec.desc) : null,
),
spec.type === 'boolean'
? el('input', { type: 'checkbox', checked: Boolean(value), onChange: (e) => commit(e.target.checked) })
? el('label', { className: 'iwb-switch' },
el('input', { type: 'checkbox', checked: Boolean(value), onChange: function (e) { commit(e.target.checked) } }),
el('span', { className: 'iwb-switch-track' }, el('span', { className: 'iwb-switch-dot' })),
)
: el('input', {
className: 'iwb-input', type: spec.type === 'number' ? 'number' : 'text',
value: value === undefined ? '' : String(value),
onChange: (e) => commit(spec.type === 'number' ? Number(e.target.value) : e.target.value),
}),
className: 'iwb-input', type: spec.type === 'number' ? 'number' : 'text',
style: { maxWidth: '260px' },
value: value === undefined ? '' : String(value),
onChange: function (e) { commit(spec.type === 'number' ? Number(e.target.value) : e.target.value) },
}),
)
}) : el('div', { className: 'iwb-hint' }, '该插件没有可配置项。'),
el('div', { className: 'iwb-row', style: { marginTop: '12px' } },
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: () => setTab('plugins') }, '← 返回插件列表'),
),
) : el('div', { className: 'iwb-hint' }, '插件不存在或已卸载。')
return pluginSettingsPage
}
@@ -622,7 +783,7 @@
const { addLlmAddr, addLlmKey, addLlmModel, addLlmProvider, api, delLlmAddr, delLlmKey, delLlmModel, delLlmProvider, draft, llmAddrInput, llmAddrRes, llmAddrTesting, llmKeyInput, llmModelInput, llmTestMsg, llmTestSel, llmTesting, llmWarn, msg, setLlm, setLlmAddr, setLlmAddrDefault, setLlmAddrInput, setLlmDefaultModel, setLlmKey, setLlmKeyInput, setLlmModelInput, setLlmProv, setLlmTestSel, testLlm, testLlmAddrs } = ctx
const llmTab = el('div', { className: 'iwb-section' },
el('div', { className: 'iwb-section-title' }, 'LLM 渠道(可选,用于提示词润色)'),
el('div', { className: 'iwb-hint' }, '支持多个渠道:每个渠道独立 Base URL / 多个 Key / 多个模型,可分别测试;润色使用「默认渠道」。已保存的 Key 也能直接选择测试。'),
el('div', { className: 'iwb-hint' }, '可选 · 用于提示词润色;润色使用「默认渠道」。'),
(draft.llm.providers || []).length
? draft.llm.providers.map((p, pi) => {
const isDef = p.id === draft.llm.defaultProviderId
@@ -639,19 +800,19 @@
el('button', { className: 'iwb-btn iwb-btn-sm' + (isDef ? ' iwb-btn-primary' : ''), title: isDef ? '当前默认渠道(润色用)' : '设为默认渠道', onClick: () => setLlm({ defaultProviderId: p.id }) }, isDef ? '✓ 默认' : '设为默认'),
el('button', { className: 'iwb-btn iwb-btn-sm', title: '删除该渠道', onClick: () => delLlmProvider(pi) }, '删除'),
),
el('div', { className: 'iwb-label' }, '地址(可多个,第一行为主地址;填到 /v1 为止,不要带 /chat/completions —— 应用会自动拼接口路径)'),
el('div', { className: 'iwb-label', title: '可填多个;第一行是主地址。地址填到 /v1 为止,不要带 /chat/completions —— 应用会自动拼接口路径' }, '地址'),
[p.baseUrl || ''].concat(p.fallbacks || []).map((a, ai) => el('div', { key: ai, className: 'iwb-row' },
el('input', { className: 'iwb-input iwb-grow', value: a || '', placeholder: ai === 0 ? '主地址,如 https://api.example.com/v1' : '备用地址,如 https://api2.example.com/v1', onChange: (e) => setLlmAddr(pi, ai, e.target.value) }),
ai === 0 ? el('span', { className: 'iwb-hint iwb-llm-main' }, '主') : el('button', { className: 'iwb-btn iwb-btn-sm', title: '设为主地址(润色优先使用)', onClick: () => setLlmAddrDefault(pi, ai) }, '设为主'),
el('button', { className: 'iwb-btn iwb-btn-xs', title: '删除该地址', onClick: () => delLlmAddr(pi, ai) }, '×'),
)),
el('div', { className: 'iwb-row' },
el('input', { className: 'iwb-input iwb-grow', value: llmAddrInput[pi] || '', placeholder: '备用地址,回车添加(填到 /v1 为止,不要带 /chat/completions)', onChange: (e) => setLlmAddrInput((m) => ({ ...m, [pi]: e.target.value })), onKeyDown: (e) => { if (e.key === 'Enter') { e.preventDefault(); addLlmAddr(pi) } } }),
el('input', { className: 'iwb-input iwb-grow', value: llmAddrInput[pi] || '', placeholder: '备用地址(可选),回车添加', onChange: (e) => setLlmAddrInput((m) => ({ ...m, [pi]: e.target.value })), onKeyDown: (e) => { if (e.key === 'Enter') { e.preventDefault(); addLlmAddr(pi) } } }),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: () => addLlmAddr(pi) }, '+ 地址'),
el('button', { className: 'iwb-btn', disabled: !!llmAddrTesting[pi], onClick: () => testLlmAddrs(pi) }, llmAddrTesting[pi] ? '测试中…' : '测全部地址'),
),
(llmAddrRes[pi] && llmAddrRes[pi].length) ? el('div', { className: 'iwb-llm-addrres' }, llmAddrRes[pi].map((r, ri) => el('div', { key: ri, className: 'iwb-hint', style: { color: r.ok ? '#15803d' : '#b91c1c', whiteSpace: 'pre-wrap' } }, (r.ok ? '✓ ' : '✗ ') + (r.url || '') + ' · ' + r.ms + 'ms' + (r.ok ? (' · ' + r.models + ' 模型') : (' · ' + (r.error || '')))))) : null,
el('div', { className: 'iwb-label' }, 'Key(可多个;名称框窄、密钥框占满;测试时选择用哪个 Key)'),
el('div', { className: 'iwb-label', title: '可填多个 Key;测试时可选择用哪个' }, 'Key'),
pKeys.map((k) => el('div', { key: k.id, className: 'iwb-row' },
el('input', { className: 'iwb-input iwb-llm-keyname', value: k.name || '', placeholder: '名称', title: 'Key 名称', onChange: (e) => setLlmKey(pi, k.id, { name: e.target.value }) }),
el('input', { className: 'iwb-input iwb-grow', value: k.value || '', placeholder: k.masked ? ('已保存 ' + k.masked + '(留空保持不变,重新输入覆盖)') : 'API Key', onChange: (e) => setLlmKey(pi, k.id, { value: e.target.value }) }),
@@ -662,7 +823,7 @@
el('input', { className: 'iwb-input iwb-grow', value: keyInp.value || '', placeholder: '新 API Key', onChange: (e) => setLlmKeyInput((m) => ({ ...m, [pi]: Object.assign({}, m[pi] || {}, { value: e.target.value }) })) }),
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: () => addLlmKey(pi) }, '+ Key'),
),
el('div', { className: 'iwb-label' }, '模型(「✓」为默认模型,润色用;点击名称切换默认)'),
el('div', { className: 'iwb-label', title: '点模型名切换默认(✓);润色用默认模型' }, '模型'),
pModels.length ? el('div', { className: 'iwb-modellist' }, pModels.map((m, mi) => {
const active = (p.defaultModel || '') === m.name
return el('div', { key: mi, className: 'iwb-modelrow' + (active ? ' iwb-modelrow-active' : '') },
@@ -690,10 +851,10 @@
el('div', { className: 'iwb-row' },
el('button', { className: 'iwb-btn', onClick: addLlmProvider }, '+ 添加渠道'),
),
el('div', { className: 'iwb-label' }, '默认润色指令(全局模板,LLM 节点内可覆盖;最多两行,可滚动)'),
el('div', { className: 'iwb-label', title: '全局模板;LLM 节点内可覆盖' }, '默认润色指令'),
el('textarea', { className: 'iwb-input iwb-hdrbox', style: { minHeight: '40px', maxHeight: '64px', overflowY: 'auto' }, value: draft.llm.defaultInstruction || '', onChange: (e) => setLlm({ defaultInstruction: e.target.value }) }, null),
llmWarn ? el('div', { className: 'iwb-hint', style: { color: '#b91c1c' } }, llmWarn) : null,
el('div', { className: 'iwb-hint' }, '流程可不经过 LLM(直接连 生图)。LLM 节点未填指令时使用此模板。默认渠道缺失时使用第一个渠道。'),
el('div', { className: 'iwb-hint' }, '流程可不经过 LLM(直接连生图);节点未填指令时用此模板。'),
)
return llmTab
}
+83 -1
View File
@@ -1965,4 +1965,86 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
.iwb-confirm-box { width: min(460px, calc(100vw - 48px)); background: var(--iwb-layer); color: var(--iwb-text); border-radius: 12px; padding: 18px 20px 14px; box-shadow: 0 12px 40px rgba(0,0,0,.28); }
.iwb-confirm-title { font-weight: 650; font-size: 15px; margin-bottom: 8px; }
.iwb-confirm-text { font-size: 13.5px; line-height: 1.65; color: var(--iwb-text2); white-space: pre-wrap; word-break: break-word; }
.iwb-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.iwb-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
/* 插件市场卡片(设置 → 插件 / 与 market.maqiart.eu.org 同一套视觉) */
.iwb-mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin: 4px 0 6px; }
.iwb-mk-card { border: 1px solid var(--iwb-border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 132px; }
.iwb-mk-head { display: flex; gap: 10px; align-items: center; }
.iwb-mk-avatar { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex: 0 0 36px; }
.iwb-mk-titles { min-width: 0; }
.iwb-mk-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; flex-wrap: wrap; }
.iwb-mk-sub { color: var(--iwb-text2); font-size: 12px; margin-top: 2px; }
.iwb-mk-desc { color: var(--iwb-text2); font-size: 12.5px; line-height: 1.5; flex: 1 1 auto; }
.iwb-mk-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.iwb-mk-tag { padding: 1px 8px; border-radius: 999px; background: var(--iwb-layer2); color: var(--iwb-text2); font-size: 11px; }
.iwb-mk-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 2px; }
/* 设置行(Obsidian 风格:标题 + 说明 + 右侧控件) */
.iwb-set-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--iwb-border); }
.iwb-set-row-main { flex: 1 1 auto; min-width: 0; }
.iwb-set-row-title { font-weight: 600; font-size: 14px; }
/* 开关 */
.iwb-switch { display: inline-flex; align-items: center; cursor: pointer; flex: 0 0 auto; }
.iwb-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.iwb-switch-track { width: 38px; height: 22px; border-radius: 999px; background: var(--iwb-border); position: relative; transition: background .15s; }
.iwb-switch-dot { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.iwb-switch input:checked + .iwb-switch-track { background: #6b5ce7; }
.iwb-switch input:checked + .iwb-switch-track .iwb-switch-dot { transform: translateX(16px); }
.iwb-switch input:disabled + .iwb-switch-track { opacity: .45; }
/* 已安装插件:横向列表 */
.iwb-mk-list { display: flex; flex-direction: column; }
.iwb-mk-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--iwb-border); }
.iwb-mk-row-main { flex: 1 1 auto; min-width: 0; }
.iwb-mk-row-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.iwb-mk-row-name { font-weight: 600; font-size: 14px; }
.iwb-mk-row-ver { color: var(--iwb-text2); font-size: 12px; }
.iwb-mk-row-author { color: var(--iwb-text2); font-size: 12px; }
.iwb-mk-row-desc { color: var(--iwb-text2); font-size: 12.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iwb-mk-row-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.iwb-mk-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px; }
.iwb-mk-chip { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--iwb-border); background: transparent; color: var(--iwb-text2); font-size: 12px; cursor: pointer; }
.iwb-mk-chip.on { background: var(--iwb-text); color: var(--iwb-layer); border-color: var(--iwb-text); }
/* 插件设置:行(无边框盒子,只有细分隔线) */
.iwb-mk-setrow { display: flex; align-items: center; gap: 16px; padding: 14px 2px; border: 0; border-bottom: 1px solid var(--iwb-border); background: transparent; border-radius: 0; margin: 0; }
.iwb-mk-setrow:last-of-type { border-bottom: 0; }
.iwb-mk-setrow-main { flex: 1 1 auto; min-width: 0; }
.iwb-mk-setrow-title { font-weight: 600; font-size: 14px; line-height: 1.4; }
.iwb-mk-setrow .iwb-hint { margin-top: 3px; line-height: 1.55; }
/* 市场页筛选条 */
.iwb-mk-filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 0 12px; align-items: center; }
.iwb-mk-filters .iwb-mk-sep { width: 1px; height: 16px; background: var(--iwb-border); margin: 0 4px; }
/* 市场卡片:等高、底部按钮对齐 */
.iwb-mk-grid { align-items: stretch; }
.iwb-mk-card { min-height: 178px; display: flex; flex-direction: column; gap: 8px; }
.iwb-mk-card .iwb-mk-desc { flex: 1 1 auto; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 38px; }
.iwb-mk-card .iwb-mk-tags { min-height: 20px; align-items: center; }
.iwb-mk-card .iwb-mk-actions { margin-top: auto; display: flex; align-items: center; justify-content: flex-end; min-height: 30px; }
.iwb-mk-card .iwb-mk-name { line-height: 1.35; }
.iwb-mk-card .iwb-plugin-tag { font-size: 11px; padding: 0 6px; line-height: 16px; }
/* 市场卡片:紧凑版(按钮在右上角,去掉底部空档) */
.iwb-mk-card { min-height: 0; padding: 10px 12px; gap: 6px; border-radius: 10px; }
.iwb-mk-head { align-items: flex-start; gap: 8px; }
.iwb-mk-titles { flex: 1 1 auto; min-width: 0; }
.iwb-mk-head .iwb-mk-actions { flex: 0 0 auto; margin: 0; padding: 0; min-height: 0; }
.iwb-mk-card .iwb-mk-avatar { width: 32px; height: 32px; flex: 0 0 32px; font-size: 17px; border-radius: 9px; }
.iwb-mk-card .iwb-mk-name { font-size: 13.5px; }
.iwb-mk-card .iwb-mk-sub { font-size: 11.5px; margin-top: 1px; }
.iwb-mk-card .iwb-mk-desc { font-size: 12px; line-height: 1.45; min-height: 0; margin-top: 2px; }
.iwb-mk-card .iwb-mk-tags { min-height: 0; margin-top: 2px; gap: 5px; }
.iwb-mk-card .iwb-mk-tag { font-size: 10.5px; padding: 0 7px; line-height: 16px; }
.iwb-mk-grid { gap: 10px; }
.iwb-mk-card .iwb-btn-sm { padding: 3px 10px; font-size: 12px; }
/* LLM 渠道:去掉外框,改成分区 + 细分隔线;默认渠道用左侧色条标记 */
.iwb-settings-modal .iwb-llm-card { border: 0; border-top: 1px solid var(--iwb-border); border-radius: 0; background: transparent; padding: 12px 0 8px; margin: 0; }
.iwb-settings-modal .iwb-llm-card:first-of-type { border-top: 0; }
.iwb-settings-modal .iwb-llm-card-def { border-left: 2px solid #6b5ce7; padding-left: 12px; }
.iwb-settings-modal .iwb-llm-card .iwb-label { font-size: 12px; color: var(--iwb-text2); font-weight: 600; margin: 10px 0 4px; }
.iwb-settings-modal .iwb-llm-card .iwb-row { margin: 4px 0; gap: 8px; }
.iwb-settings-modal .iwb-llm-card .iwb-input { padding: 6px 10px; font-size: 13px; }
.iwb-settings-modal .iwb-modellist { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 4px; }
.iwb-settings-modal .iwb-modelrow { padding: 2px 8px; border-radius: 999px; background: var(--iwb-layer2); border: 1px solid transparent; margin: 0; font-size: 12.5px; }
.iwb-settings-modal .iwb-modelrow-active { border-color: #6b5ce7; background: rgba(107,92,231,.08); }
.iwb-settings-modal .iwb-llm-card .iwb-btn-xs { opacity: .5; }
.iwb-settings-modal .iwb-llm-card .iwb-btn-xs:hover { opacity: 1; }
+2 -1
View File
@@ -227,7 +227,8 @@ const lazyHost = sandbox.IWBPluginHostFactory()
const lazyState = { 'lazy-plugin': { enabled: true, settings: {}, data: {} } }
lazyHost.init({ readState: () => lazyState, writeState: () => {}, log: () => {} })
assert.strictEqual(lazyHost.isEnabled('lazy-plugin'), true, '未注册插件也应读出持久化的启用开关')
assert.strictEqual(lazyHost.isEnabled('never-heard'), false, '持久化里没有的未注册插件应为 false')
// 2026-11-17:改为默认 true —— 启动早期持久化还没读到时,若按 false 处理会把所有插件判成"已停用"而进 idle
assert.strictEqual(lazyHost.isEnabled('never-heard'), true, '持久化里没有记录的未注册插件按默认启用(true)')
assert.strictEqual(Object.keys(lazyState).join(','), 'lazy-plugin', 'isEnabled 查询不得为未注册插件创建 state 条目')
console.log('plugin host checks passed')
+1
View File
@@ -29,6 +29,7 @@ interface Window {
IWBRuntimePluginLoader?: any
IWBRuntimePluginMarket?: any
IWBRuntimePluginBackup?: any
IWBPluginRuntime?: any
IWBDesktop?: any
IWBStorageFallbackIndexedDb?: any
// 画布 / 工作台