From cd6464972e3c568196ff3a9913822a136fd5dbf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Mon, 26 Jan 2026 16:40:41 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BD=BF=E7=94=A8aria2c=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/service/installer.go | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/internal/service/installer.go b/internal/service/installer.go index 6f23f33..a1fcc96 100644 --- a/internal/service/installer.go +++ b/internal/service/installer.go @@ -9,7 +9,9 @@ import ( "fmt" "io" "os" + "path/filepath" "strings" + "time" "github.com/go-resty/resty/v2" @@ -385,6 +387,8 @@ func (i *installer) downloadPanel(ctx context.Context, cfg *types.InstallConfig) // 获取最新版本信息 client := resty.New() + client.SetRetryCount(3) + client.SetTimeout(10 * time.Second) resp, err := client.R(). SetContext(ctx). Get("https://api.acepanel.net/version/latest") @@ -428,10 +432,23 @@ func (i *installer) downloadPanel(ctx context.Context, cfg *types.InstallConfig) // 下载面板 zipPath := cfg.SetupPath + "/panel/panel.zip" - _, err = client.R(). - SetContext(ctx). - SetOutput(zipPath). - Get("https://dl.acepanel.net" + downloadURL) + fullURL := "https://dl.acepanel.net" + downloadURL + _, err = i.executor.Run(ctx, "aria2c", + "-c", + "--file-allocation=falloc", + "--allow-overwrite=true", + "--auto-file-renaming=false", + "--console-log-level=notice", + "--summary-interval=2", + "--retry-wait=5", + "--max-tries=5", + "-x", "16", + "-s", "16", + "-k", "1M", + "-d", filepath.Dir(zipPath), + "-o", filepath.Base(zipPath), + fullURL, + ) if err != nil { return fmt.Errorf("%s: %w", i18n.T.Get("Failed to download panel"), err) }