From 1ea7c515aef1257d91a403f36153cf02feac4887 Mon Sep 17 00:00:00 2001 From: Toby Date: Tue, 29 Aug 2023 22:16:38 -0700 Subject: [PATCH] feat: add side to update checker --- app/internal/utils/update.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/internal/utils/update.go b/app/internal/utils/update.go index 5377eeb..8887cb4 100644 --- a/app/internal/utils/update.go +++ b/app/internal/utils/update.go @@ -21,6 +21,7 @@ type UpdateChecker struct { Platform string Architecture string Channel string + Side string Client *http.Client } @@ -30,6 +31,7 @@ func NewServerUpdateChecker(currentVersion, platform, architecture, channel stri Platform: platform, Architecture: architecture, Channel: channel, + Side: "server", Client: &http.Client{ Timeout: updateCheckTimeout, }, @@ -47,6 +49,7 @@ func NewClientUpdateChecker(currentVersion, platform, architecture, channel stri Platform: platform, Architecture: architecture, Channel: channel, + Side: "client", Client: &http.Client{ Timeout: updateCheckTimeout, Transport: &http.Transport{ @@ -67,12 +70,13 @@ type UpdateResponse struct { } func (uc *UpdateChecker) Check() (*UpdateResponse, error) { - url := fmt.Sprintf("%s?cver=%s&plat=%s&arch=%s&chan=%s", + url := fmt.Sprintf("%s?cver=%s&plat=%s&arch=%s&chan=%s&side=%s", updateCheckEndpoint, uc.CurrentVersion, uc.Platform, uc.Architecture, uc.Channel, + uc.Side, ) resp, err := uc.Client.Get(url) if err != nil {