发布:v0.3.3 版本历史模块 + 域名迁移 + 站点版本信息修正
- 版本号更新至 0.3.3(version.go/wails.json/README.md) - 更新检查域名迁移 img.1216.top → c.1216.top - 新增 views/version 版本历史 Tab 页面(时间线 UI) - 设置面板新增版本历史入口按钮 - CHANGELOG 补全 0.3.3 全部 17 个提交记录 - 站点 HTML 修正(删除错误 v0.4.0,v0.3.3 为最新) - 生成 last-version.json / versions.json 发布数据
This commit is contained in:
@@ -43,7 +43,7 @@ func LoadUpdateConfig() (*UpdateConfig, error) {
|
||||
LastCheckTime: time.Time{}, // 启动时会立即检查
|
||||
AutoCheckEnabled: true,
|
||||
CheckIntervalMinutes: 5, // 5分钟检查一次
|
||||
CheckURL: "https://img.1216.top/u-desk/last-version.json",
|
||||
CheckURL: "https://c.1216.top/last-version.json",
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ func LoadUpdateConfig() (*UpdateConfig, error) {
|
||||
|
||||
// 使用默认检查地址
|
||||
if config.CheckURL == "" {
|
||||
config.CheckURL = "https://img.1216.top/u-desk/last-version.json"
|
||||
config.CheckURL = "https://c.1216.top/last-version.json"
|
||||
}
|
||||
|
||||
// 确保版本号不为空(使用缓存的版本号)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"cmp"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
@@ -69,27 +70,16 @@ func ParseVersion(versionStr string) (*Version, error) {
|
||||
func (v *Version) Compare(other *Version) int {
|
||||
switch {
|
||||
case v.Major != other.Major:
|
||||
return compareInt(v.Major, other.Major)
|
||||
return cmp.Compare(v.Major, other.Major)
|
||||
case v.Minor != other.Minor:
|
||||
return compareInt(v.Minor, other.Minor)
|
||||
return cmp.Compare(v.Minor, other.Minor)
|
||||
case v.Patch != other.Patch:
|
||||
return compareInt(v.Patch, other.Patch)
|
||||
return cmp.Compare(v.Patch, other.Patch)
|
||||
default:
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
// compareInt 比较两个整数
|
||||
func compareInt(a, b int) int {
|
||||
if a < b {
|
||||
return -1
|
||||
}
|
||||
if a > b {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// IsNewerThan 判断是否比目标版本新
|
||||
func (v *Version) IsNewerThan(other *Version) bool {
|
||||
return v.Compare(other) > 0
|
||||
|
||||
Reference in New Issue
Block a user