feat(offline_download): add simple http tool (close #4002)
This commit is contained in:
@ -35,6 +35,9 @@ type Tool interface {
|
||||
Remove(task *DownloadTask) error
|
||||
// Status return the status of the download task, if an error occurred, return the error in Status.Err
|
||||
Status(task *DownloadTask) (*Status, error)
|
||||
|
||||
// Run for simple http download
|
||||
Run(task *DownloadTask) error
|
||||
}
|
||||
|
||||
type GetFileser interface {
|
||||
|
@ -2,6 +2,7 @@ package tool
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/alist-org/alist/v3/internal/errs"
|
||||
"github.com/pkg/errors"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/xhofe/tache"
|
||||
@ -25,6 +26,12 @@ type DownloadTask struct {
|
||||
}
|
||||
|
||||
func (t *DownloadTask) Run() error {
|
||||
if err := t.tool.Run(t); !errs.IsNotSupportError(err) {
|
||||
if err == nil {
|
||||
return t.Complete()
|
||||
}
|
||||
return err
|
||||
}
|
||||
t.Signal = make(chan int)
|
||||
t.finish = make(chan struct{})
|
||||
defer func() {
|
||||
|
Reference in New Issue
Block a user