feat(thunder): add offline download tool (#7673)

* feat(thunder): add offline download tool

* fix(thunder): improve error handling and parse file size in status response

---------

Co-authored-by: Andy Hsu <i@nn.ci>
This commit is contained in:
Jealous
2024-12-25 21:23:58 +08:00
committed by GitHub
parent 48916cdedf
commit 42243b1517
8 changed files with 288 additions and 0 deletions

View File

@ -77,6 +77,10 @@ func AddURL(ctx context.Context, args *AddURLArgs) (task.TaskExtensionInfo, erro
tempDir = args.DstDirPath
// 防止将下载好的文件删除
deletePolicy = DeleteNever
case "thunder":
tempDir = args.DstDirPath
// 防止将下载好的文件删除
deletePolicy = DeleteNever
}
taskCreator, _ := ctx.Value("user").(*model.User) // taskCreator is nil when convert failed

View File

@ -83,6 +83,9 @@ outer:
if t.tool.Name() == "pikpak" {
return nil
}
if t.tool.Name() == "thunder" {
return nil
}
if t.tool.Name() == "115 Cloud" {
// hack for 115
<-time.After(time.Second * 1)
@ -161,6 +164,9 @@ func (t *DownloadTask) Complete() error {
if t.tool.Name() == "pikpak" {
return nil
}
if t.tool.Name() == "thunder" {
return nil
}
if t.tool.Name() == "115 Cloud" {
return nil
}