diff --git a/internal/const/const.go b/internal/const/const.go index f2b06f77..3a852049 100644 --- a/internal/const/const.go +++ b/internal/const/const.go @@ -18,5 +18,5 @@ const ( CookieSID = "edgesid" SystemdServiceName = "edge-admin" - UpdatesURL = "https://goedge.cn/api/boot/versions?os=${os}&arch=${arch}" + UpdatesURL = "https://goedge.cn/api/boot/versions?os=${os}&arch=${arch}&version=${version}" ) diff --git a/internal/tasks/task_check_updates.go b/internal/tasks/task_check_updates.go index dea5f353..078e4efd 100644 --- a/internal/tasks/task_check_updates.go +++ b/internal/tasks/task_check_updates.go @@ -87,6 +87,7 @@ func (this *CheckUpdatesTask) Loop() error { var apiURL = teaconst.UpdatesURL apiURL = strings.ReplaceAll(apiURL, "${os}", runtime.GOOS) apiURL = strings.ReplaceAll(apiURL, "${arch}", runtime.GOARCH) + apiURL = strings.ReplaceAll(apiURL, "${version}", teaconst.Version) resp, err := http.Get(apiURL) if err != nil { return errors.New("read api failed: " + err.Error()) diff --git a/internal/utils/upgrade_manager.go b/internal/utils/upgrade_manager.go index 96432366..5e78a951 100644 --- a/internal/utils/upgrade_manager.go +++ b/internal/utils/upgrade_manager.go @@ -108,6 +108,7 @@ func (this *UpgradeManager) Start() error { } url = strings.ReplaceAll(url, "${os}", osName) url = strings.ReplaceAll(url, "${arch}", runtime.GOARCH) + url = strings.ReplaceAll(url, "${version}", teaconst.Version) req, err := http.NewRequest(http.MethodGet, url, nil) if err != nil { return errors.New("create url request failed: " + err.Error()) diff --git a/internal/web/actions/default/settings/updates/index.go b/internal/web/actions/default/settings/updates/index.go index 303e1f23..8ec6dcbd 100644 --- a/internal/web/actions/default/settings/updates/index.go +++ b/internal/web/actions/default/settings/updates/index.go @@ -58,6 +58,7 @@ func (this *IndexAction) RunPost(params struct { var apiURL = teaconst.UpdatesURL apiURL = strings.ReplaceAll(apiURL, "${os}", runtime.GOOS) apiURL = strings.ReplaceAll(apiURL, "${arch}", runtime.GOARCH) + apiURL = strings.ReplaceAll(apiURL, "${version}", teaconst.Version) resp, err := http.Get(apiURL) if err != nil { this.Data["result"] = maps.Map{