Repository navigation
fix: 修复 nightly 通道无法获取更新 - #299
Merged
Merged
Conversation
imsyy
approved these changes
Sep 21, 2026
imsyy
left a comment
Member
There was a problem hiding this comment.
LGTM, 经排查验证该问题真实存在,PR 修复方案严谨有效。
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.
改动类型
是否包含破坏性变更
改动说明
修复 nightly 通道完全无法获取更新的问题,共两个独立缺陷。
1.
config:set拒绝写入 nightly 通道electron/main/ipc/config.ts中update.channel的校验白名单只有stable/beta/alpha,漏了nightly,导致任何用户都无法把通道切换到 nightly:UI 能选、能弹确认,但保存时主进程抛无效的更新通道: nightly,settings.json保持原值。同时
shared/types/settings.ts、src/settings/categories/general.ts(UI 选项)都包含 nightly,三处名单各写一份是这次漏洞的直接原因。改为共享同一份运行时常量:校验与 UI 选项均由它派生,类型与运行时名单不会再分叉。
2. nightly 走到检查阶段后必然失败
nightly 发布在固定滚动 tag
nightly上,而 electron-updater 的GitHubProvider.getLatestVersion()要求 release tag 是合法 semver:循环结束后
tag == null,抛出ERR_UPDATER_NO_PUBLISHED_VERSIONS;该错误被runCheck()的.catch(() => {})吞掉,界面上表现为「点了检查更新毫无反应」。改法是让 nightly 通道使用 generic provider 直达固定资源目录,其余通道不变:
GenericProvider.getLatestVersion()只请求<channel>.yml,不遍历 release tag;平台后缀(-mac/-linux/-linux-arm64)由getChannelName()自动拼接,nightly release 中这四个清单均已存在。发布流程与工作流无需改动。顺带修正
openDownloadPage():nightly 发布在固定 tag 上,无法用版本号拼出/tag/v<version>形式的链接。验证
类型与测试:
pnpm typecheck通过;pnpm test:node35/35 通过;改动文件 prettier 无差异。四通道实测(Windows 11 / x64 / dev 模式,dev 实例走
.bashrc注入,逐一切换通道):latest version: 1.1.0latest version: 1.1.0(beta.yml是 stable 的别名)latest version: 1.2.0-alpha.1Found version 1.2.0-nightly.872全程无 error 级日志;通道切换前 nightly 稳定复现
No published versions on GitHub,修复后消失。下载全流程实测:
path指向 x64,本机 x64,实际下载的即 x64 包未覆盖:安装全流程(
quitAndInstall())未实测以避免覆盖本机环境;macOS / Linux 与打包版本未实测。已覆盖的验证边界:通道识别、清单获取、URL 解析、架构选择、差分回退、下载完成。
关联
修复 #298