perf(123):file thumbnail

pull/1090/head
foxxorcat 2022-05-12 22:10:24 +08:00
parent 3b59bb5c09
commit aeb2297f1f
3 changed files with 14 additions and 11 deletions

View File

@ -47,6 +47,7 @@ func (driver Pan123) FormatFile(file *File) *model.File {
Size: file.Size,
Driver: driver.Config().Name,
UpdatedAt: file.UpdateAt,
Thumbnail: file.DownloadUrl,
}
f.Type = file.GetType()
return f
@ -66,7 +67,7 @@ func (driver Pan123) GetFiles(parentId string, account *model.Account) ([]File,
"parentFileId": parentId,
"trashed": "false",
}
_, err := driver.Request("https://www.123pan.com/api/file/list",
_, err := driver.Request("https://www.123pan.com/api/file/list/new",
base.Get, nil, query, nil, &resp, false, account)
if err != nil {
return nil, err

View File

@ -126,7 +126,7 @@ func (driver Pan123) Files(path string, account *model.Account) ([]model.File, e
_ = base.SetCache(path, rawFiles, account)
}
}
files := make([]model.File, 0)
files := make([]model.File, 0, len(rawFiles))
for _, file := range rawFiles {
files = append(files, *driver.FormatFile(&file))
}

View File

@ -1,10 +1,11 @@
package _23
import (
"github.com/Xhofe/alist/conf"
"github.com/Xhofe/alist/utils"
"path"
"time"
"github.com/Xhofe/alist/conf"
"github.com/Xhofe/alist/utils"
)
type File struct {
@ -15,6 +16,7 @@ type File struct {
Type int `json:"Type"`
Etag string `json:"Etag"`
S3KeyFlag string `json:"S3KeyFlag"`
DownloadUrl string `json:"DownloadUrl"`
}
func (f File) GetSize() uint64 {