feat(updater): Beta 渠道接通 auto-update(Builder.endpoints runtime 切换)#465
Merged
Conversation
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。
PR Reviewer Guide 🔍(Review updated until commit 7cdb623)Here are some key observations to aid the review process:
|
之前 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。
|
Persistent review updated to latest commit 789aed0 |
`-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。
|
Persistent review updated to latest commit 7cdb623 |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Summary
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 覆盖。本 PR 用这个新 API 接通 Beta 渠道的自动更新 —— 不 fork plugin、不写自定义下载/签名校验,复用 plugin 全部 plumbing。
What changed
Rust
commands.rs::app_check_update_with_channel:webview.updater_builder().build()?.check()(默认 endpoints 从 tauri.conf)fetch_latest_beta_release()拿最新 prerelease tag → 拼镜像 + 直连两份-betamanifest URL →builder.endpoints(urls)?.build()?.check()AppUpdateMetadata字段形状对齐 plugin 的UpdateMetadata(rid + currentVersion + version + body + rawJson),前端new Update(metadata)即可复用 plugin 的download / install / close。lib.rs注册新 command。前端
AutoUpdate.tsx::checkForUpdates从import('@tauri-apps/plugin-updater').check改为invoke('app_check_update_with_channel');其余download / install / close全走 plugin 原生 JS API。SettingsModal::BetaChannelControl删掉「打开 GitHub 下载」按钮 —— auto-update 接管了,手动下载路径冗余;保留「最新 Beta 版本号 + 刷新」做信息透明。betaChannelDesc文案:「需要手动下载安装」→「自动接收最新 Beta 版本」。物理隔离仍生效
Beta tag 的 manifest 文件名带
-beta后缀(latest-{tgt}-{arch}-beta.json),跟 Stable 的latest-{tgt}-{arch}.json在 GitHub Release assets 里是分开的两份。即使代码逻辑错把 Beta URL 传给 Stable 用户也是 HTTP 404,不会拿到错档。Test plan
cargo test --lib -- --test-threads=1: 270 / 0 / 0npx tsc --noEmitexit 0npm run buildcleanPR Type
Enhancement
Description
Add channel-aware update checking
Reuse plugin update workflow
new Update(metadata)for installUpdate Beta channel UI
Refresh copy and versioning
Diagram Walkthrough
File Walkthrough
4 files
Add channel-aware updater commandRegister the new update commandSwitch checks to backend metadataAdd Beta update action to settings5 files
Update English Beta channel copyUpdate Japanese Beta channel copyUpdate Korean Beta channel copyUpdate Simplified Chinese Beta copyUpdate Traditional Chinese Beta copy3 files
Bump application version numberBump Rust package version numberBump Tauri app version number