From d72144d8c8cfe4f7c3bc9ff9f00e5e5c4f1f0d8e Mon Sep 17 00:00:00 2001 From: josc146 Date: Sun, 21 May 2023 10:55:23 +0800 Subject: [PATCH] realtime AddToDownloadList --- backend-golang/download.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/backend-golang/download.go b/backend-golang/download.go index f7f94a0..1307885 100644 --- a/backend-golang/download.go +++ b/backend-golang/download.go @@ -86,12 +86,8 @@ func (a *App) ContinueDownload(url string) { func (a *App) AddToDownloadList(path string, url string) { if !existsInDownloadList(url) { - client := grab.NewClient() - req, _ := grab.NewRequest(path, url) - resp := client.Do(req) - downloadList = append(downloadList, DownloadStatus{ - resp: resp, + resp: nil, Name: filepath.Base(path), Path: path, Url: url, @@ -102,6 +98,7 @@ func (a *App) AddToDownloadList(path string, url string) { Downloading: true, Done: false, }) + a.ContinueDownload(url) } else { a.ContinueDownload(url) }