From d07881bc2984e805dd15baecfd03f3afce39af7c Mon Sep 17 00:00:00 2001 From: ayflying Date: Mon, 27 Oct 2025 16:12:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=A4=B1=E8=B4=A5=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E5=B0=9D=E8=AF=95=E4=BD=BF=E7=94=A8=E8=87=AA=E5=B7=B1?= =?UTF-8?q?=E7=9A=84=E4=BB=A3=E7=90=86=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/update.go | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/cmd/update.go b/cmd/update.go index 34d82b5..eaf3c65 100644 --- a/cmd/update.go +++ b/cmd/update.go @@ -112,9 +112,24 @@ var ( FileUrl: url[v.S3], }) if err != nil { - Proxy := g.Cfg().MustGet(ctx, "update_proxy", "http://192.168.50.170:10808").String() - g.Log().Debugf(ctx, "切换代理进行上传:err=%v", err) - get, err = client.Proxy(Proxy).Post(ctx, address+"/callback/update", &UpdateReq{ + // 读取HTTP代理环境变量(小写/大写通常都兼容,部分系统可能用大写) + httpProxy := os.Getenv("http_proxy") + if httpProxy == "" { + httpProxy = os.Getenv("HTTP_PROXY") + } + if httpProxy == "" { + // 读取HTTPS代理环境变量 + httpProxy = os.Getenv("https_proxy") + if httpProxy == "" { + httpProxy = os.Getenv("HTTPS_PROXY") + } + } + // 如果没有读取到本地的代理,使用配置上传 + if httpProxy == "" { + httpProxy = g.Cfg().MustGet(ctx, "update_proxy", "http://192.168.50.173:10808").String() + } + g.Log().Debugf(ctx, "切换代理进行上传:ip=%v,err=%v", httpProxy, err) + get, err = client.Proxy(httpProxy).Post(ctx, address+"/callback/update", &UpdateReq{ FileUrl: url[v.S3], }) }