* feat(updater): Beta 渠道接通 auto-update(Builder.endpoints runtime 切换)
CLAUDE.md 之前的论断「tauri-plugin-updater 2.10 Builder 不暴露 endpoints()」在
2.10.1 已不成立 —— Builder 现在有 .endpoints(Vec<Url>) -> Result<Self>,build()
里 self.endpoints.unwrap_or_else(|| self.config.endpoints.clone()) 走 runtime 覆盖。
实现 channel-aware 自动更新(不 fork plugin、不写自定义下载/签名校验):
Rust(~100 行新增)
- commands.rs::app_check_update_with_channel:
Stable → webview.updater_builder().build()?.check()(默认 endpoints 从 tauri.conf)
Beta → fetch_latest_beta_release() → 拼镜像 + 直连两份 -beta manifest URL
→ builder.endpoints(urls)?.build()?.check()
- AppUpdateMetadata 字段形状对齐 plugin 的 UpdateMetadata(rid + currentVersion
+ version + body + rawJson),前端 new Update(metadata) 即可复用 plugin 的
download / install / close。
- lib.rs 注册新 command。
前端(~30 行改动)
- AutoUpdate.tsx::checkForUpdates 从 import('@tauri-apps/plugin-updater').check
改为 invoke('app_check_update_with_channel');其余 download / install / close
全走 plugin 原生 JS API(new Update(metadata) 后链式调用)。
- SettingsModal::BetaChannelControl 删掉「打开 GitHub 下载」按钮 ——
auto-update 接管了,手动下载路径冗余;保留「最新 Beta 版本号 + 刷新」做信息透明。
- i18n 5 个 locale 改 betaChannelDesc 文案,把「需要手动下载安装」改成
「自动接收最新 Beta 版本」。betaChannelDownloadBtn 等 i18n key 暂留(无用但无害)。
物理隔离仍生效:Beta tag 的 manifest 文件名带 -beta 后缀,跟 Stable 的
latest-{tgt}-{arch}.json 在 GitHub Release assets 里是分开两份;即使代码逻辑
错把 Beta URL 给 Stable 用户也是 HTTP 404,不会拿到错档。
验证:cargo test --lib serial 270 / 0 / 0;tsc clean;vite build clean。
* feat(settings): BetaChannelControl 加版本比对 + 「立即更新」按钮
之前 BetaChannelControl 在 toggle 打开后,只机械显示「最新 Beta: vX-beta-tauri」,
不管本机版本是不是已经等于那个 tag。用户报告:「显示有最新 Beta,但应该比对版本号」。
修复:
- parseVersionFromBetaTag("v1.3.4-1-beta-tauri") → "1.3.4-1"
- semverGreater(remote, local) 做 SemVer 风格比对(支持 X.Y.Z 和 X.Y.Z-N,覆盖
本仓库实际版本格式;prerelease 按 SemVer 规则 lower than no-prerelease)
- 本机 >= 最新 → 「最新 Beta: vX」 + 蓝色「已是最新」chip
- 本机 < 最新 → 「最新 Beta: vX」 + 「立即更新」按钮(蓝色高亮)
- 「立即更新」点击 → useAutoUpdate.checkForUpdates → 走和全局「检查更新」按钮
完全相同的 download/install 流程,UpdateDialog 直接挂在 BetaChannelControl 内部
- 用户的第二个 feature 诉求:「在 Beta 渠道旁边一键检查 + 自动更新」 = 这个按钮
i18n 5 个 locale 加 4 个 key:betaChannelUpToDate / betaChannelUpdateNow /
betaChannelUpdateNowTitle / betaChannelChecking。
* chore(release): bump 1.3.4-1 → 1.3.4-2 for Beta channel
`-2` 后缀让 appVersion.ts 的 IS_BETA_BUILD 仍判为 Beta,UI BETA 标签照常显示。
配本 PR 的 Beta auto-update + BetaChannelControl「立即更新」按钮,1.3.4-1 用户
切到 Beta 渠道后点检查会发现 1.3.4-2 并走 auto-update 流程一键升上来。
发布 tag:v1.3.4-2-beta-tauri。
---------
Co-authored-by: baiqing <lbx12309@icloud.com>
124 lines
3.4 KiB
JSON
124 lines
3.4 KiB
JSON
{
|
|
"$schema": "https://schema.tauri.app/config/2",
|
|
"productName": "OpenLess",
|
|
"version": "1.3.4-2",
|
|
"identifier": "com.openless.app",
|
|
"build": {
|
|
"beforeDevCommand": "npm run dev",
|
|
"beforeBuildCommand": "npm run build",
|
|
"devUrl": "http://localhost:1420",
|
|
"frontendDist": "../dist"
|
|
},
|
|
"app": {
|
|
"withGlobalTauri": true,
|
|
"macOSPrivateApi": true,
|
|
"windows": [
|
|
{
|
|
"label": "main",
|
|
"title": "OpenLess",
|
|
"width": 1240,
|
|
"height": 800,
|
|
"minWidth": 980,
|
|
"minHeight": 640,
|
|
"resizable": true,
|
|
"decorations": true,
|
|
"transparent": true,
|
|
"shadow": true,
|
|
"hiddenTitle": true,
|
|
"titleBarStyle": "Overlay",
|
|
"trafficLightPosition": { "x": 14, "y": 20 },
|
|
"visible": false,
|
|
"acceptFirstMouse": true
|
|
},
|
|
{
|
|
"label": "capsule",
|
|
"url": "index.html?window=capsule",
|
|
"title": "OpenLess Capsule",
|
|
"width": 220,
|
|
"height": 110,
|
|
"decorations": false,
|
|
"transparent": true,
|
|
"shadow": false,
|
|
"alwaysOnTop": true,
|
|
"skipTaskbar": true,
|
|
"resizable": false,
|
|
"focus": false,
|
|
"visible": false,
|
|
"center": false,
|
|
"acceptFirstMouse": true
|
|
},
|
|
{
|
|
"label": "qa",
|
|
"url": "index.html?window=qa",
|
|
"title": "OpenLess QA",
|
|
"width": 380,
|
|
"height": 440,
|
|
"decorations": false,
|
|
"transparent": true,
|
|
"shadow": true,
|
|
"alwaysOnTop": true,
|
|
"skipTaskbar": true,
|
|
"resizable": false,
|
|
"focus": false,
|
|
"visible": false,
|
|
"center": false,
|
|
"acceptFirstMouse": true
|
|
}
|
|
],
|
|
"security": {
|
|
"csp": {
|
|
"default-src": "'self' customprotocol: asset:",
|
|
"script-src": "'self'",
|
|
"style-src": "'self' 'unsafe-inline' https://fonts.googleapis.com",
|
|
"font-src": "'self' https://fonts.gstatic.com",
|
|
"img-src": "'self' asset: http://asset.localhost blob: data:",
|
|
"connect-src": "'self' ipc: http://ipc.localhost http://localhost:1420 ws://localhost:1420",
|
|
"object-src": "'none'",
|
|
"base-uri": "'none'",
|
|
"form-action": "'none'",
|
|
"frame-ancestors": "'none'"
|
|
}
|
|
}
|
|
},
|
|
"bundle": {
|
|
"active": true,
|
|
"targets": "all",
|
|
"icon": [
|
|
"icons/32x32.png",
|
|
"icons/128x128.png",
|
|
"icons/128x128@2x.png",
|
|
"icons/icon.icns",
|
|
"icons/icon.ico"
|
|
],
|
|
"macOS": {
|
|
"minimumSystemVersion": "12.0",
|
|
"infoPlist": "Info.plist",
|
|
"entitlements": "Entitlements.plist"
|
|
},
|
|
"windows": {
|
|
"nsis": {
|
|
"installMode": "perMachine",
|
|
"installerHooks": "nsis/openless-ime-hooks.nsh"
|
|
},
|
|
"wix": {
|
|
"fragmentPaths": [
|
|
"wix/openless-ime.wxs"
|
|
],
|
|
"componentRefs": [
|
|
"OpenLessImeDllX64Component",
|
|
"OpenLessImeDllX86Component"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"plugins": {
|
|
"updater": {
|
|
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDFERUFBODAzNTY0QzMyM0YKUldRL01reFdBNmpxSGE1K0JadlpONXNWTzhJcGZCRGxjUVdIWExNNFJpeUNsSGZwazdlQThhemkK",
|
|
"endpoints": [
|
|
"https://fastgit.cc/https://github.com/appergb/openless/releases/latest/download/latest-{{target}}-{{arch}}-mirror.json",
|
|
"https://github.com/appergb/openless/releases/latest/download/latest-{{target}}-{{arch}}.json"
|
|
]
|
|
}
|
|
}
|
|
}
|