feat(update): 接入 Tauri Updater(check_update/install_update + 签名产物 + latest.json 发布脚本)3.25.2
This commit is contained in:
1 parent
fe4a64f98b
commit
67a46dd03d
9 files changed
+533
-90
No files matched your search
@@ -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 安装包基于本版本构建。
|
||||
|
||||
+46
-62
@@ -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
@@ -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",
|
||||
|
||||
Executable
+76
@@ -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
|
||||
Generated
+336
-6
@@ -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"
|
||||
|
||||
@@ -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
@@ -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(
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
-17
@@ -505,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,
|
||||
@@ -534,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,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user