From 0b7abbe43e93c6ca73fb8c4f8af5bf0c6f214c4b Mon Sep 17 00:00:00 2001 From: arm64v8a <48624112+arm64v8a@users.noreply.github.com> Date: Mon, 8 Aug 2022 11:25:40 +0800 Subject: [PATCH] fix check update --- go/grpc.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/go/grpc.go b/go/grpc.go index f7f691f..e343315 100644 --- a/go/grpc.go +++ b/go/grpc.go @@ -122,7 +122,7 @@ func getProxyHttpClient(_instance *libcore.V2RayInstance) *http.Client { // UPDATE -var update_download_url, update_download_as string +var update_download_url string func (s *server) Update(ctx context.Context, in *gen.UpdateReq) (*gen.UpdateResp, error) { ret := &gen.UpdateResp{} @@ -161,10 +161,8 @@ func (s *server) Update(ctx context.Context, in *gen.UpdateReq) (*gen.UpdateResp var search string if runtime.GOOS == "windows" && runtime.GOARCH == "amd64" { search = "windows64" - update_download_as = "nekoray.zip" } else if runtime.GOOS == "linux" && runtime.GOARCH == "amd64" { search = "linux64" - update_download_as = "nekoray.tar.gz" } else { ret.Error = "Not official support platform" return ret, nil @@ -191,7 +189,7 @@ func (s *server) Update(ctx context.Context, in *gen.UpdateReq) (*gen.UpdateResp } } } else { // Download update - if update_download_url == "" || update_download_as == "" { + if update_download_url == "" { ret.Error = "?" return ret, nil } @@ -204,7 +202,7 @@ func (s *server) Update(ctx context.Context, in *gen.UpdateReq) (*gen.UpdateResp } defer resp.Body.Close() - f, err := os.OpenFile("../"+update_download_as, os.O_TRUNC|os.O_CREATE|os.O_RDWR, 0644) + f, err := os.OpenFile("../nekoray.zip", os.O_TRUNC|os.O_CREATE|os.O_RDWR, 0644) if err != nil { ret.Error = err.Error() return ret, nil