feat(update):支持macOS系统更新

- 修改了更新检查逻辑,排除 macOS 系统
- 为 macOS 系统添加了专门的下载链接
- 优化了版本更新提示信息的显示
This commit is contained in:
ArvinLovegood 2025-07-09 10:13:25 +08:00
parent 7ea974f1a6
commit 76a44fae32

5
app.go
View File

@ -130,7 +130,7 @@ func (a *App) CheckUpdate() {
releaseVersion.Commit = *commit
}
if !IsWindows() {
if !(IsWindows() || IsMacOS()) {
go runtime.EventsEmit(a.ctx, "updateVersion", releaseVersion)
return
}
@ -142,6 +142,9 @@ func (a *App) CheckUpdate() {
"content": fmt.Sprintf("当前版本:%s, 最新版本:%s,开始下载...", Version, releaseVersion.TagName),
})
downloadUrl := fmt.Sprintf("https://github.com/ArvinLovegood/go-stock/releases/download/%s/go-stock-windows-amd64.exe", releaseVersion.TagName)
if IsMacOS() {
downloadUrl = fmt.Sprintf("https://github.com/ArvinLovegood/go-stock/releases/download/%s/go-stock-darwin-universal", releaseVersion.TagName)
}
resp, err := resty.New().R().Get(downloadUrl)
if err != nil {
go runtime.EventsEmit(a.ctx, "newsPush", map[string]any{