From e7dd05e433a1d3953b5d0c2885333b06d53ccd80 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Sun, 12 Mar 2023 21:24:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E6=9F=A5=E7=89=88=E6=9C=AC=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=97=B6=E5=A2=9E=E5=8A=A0=E5=BD=93=E5=89=8D=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/const/const.go | 2 +- internal/tasks/task_check_updates.go | 1 + internal/utils/upgrade_manager.go | 1 + internal/web/actions/default/settings/updates/index.go | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) 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{