feat: misc improvements about upload/copy/hash (#5045)

general: add createTime/updateTime support in webdav and some drivers
general: add hash support in some drivers
general: cross-storage rapid-upload support
general: enhance upload to avoid local temp file if possible
general: replace readseekcloser with File interface to speed upstream operations
feat(aliyun_open): same as above
feat(crypt): add hack for 139cloud

Close #4934 
Close #4819 

baidu_netdisk needs to improve the upload code to support rapid-upload
This commit is contained in:
Sean
2023-08-27 21:14:23 +08:00
committed by GitHub
parent 9b765ef696
commit a3748af772
77 changed files with 1731 additions and 615 deletions

View File

@ -2,7 +2,7 @@ package qbittorrent
import (
"fmt"
"io"
"github.com/alist-org/alist/v3/internal/stream"
"os"
"path/filepath"
"sync"
@ -157,17 +157,22 @@ func (m *Monitor) complete() error {
if err != nil {
return errors.Wrapf(err, "failed to open file %s", tempPath)
}
stream := &model.FileStream{
s := stream.FileStream{
Obj: &model.Object{
Name: fileName,
Size: size,
Modified: time.Now(),
IsFolder: false,
},
ReadCloser: struct{ io.ReadSeekCloser }{f},
Mimetype: mimetype,
Reader: f,
Closers: utils.NewClosers(f),
Mimetype: mimetype,
}
return op.Put(tsk.Ctx, storage, dstDir, stream, tsk.SetProgress)
ss, err := stream.NewSeekableStream(s, nil)
if err != nil {
return err
}
return op.Put(tsk.Ctx, storage, dstDir, ss, tsk.SetProgress)
},
}))
}