mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2025-09-20 04:36:09 +08:00
feat(lenovonas_share): add thumb (#986)
This commit is contained in:
@ -3,6 +3,7 @@ package LenovoNasShare
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -71,7 +72,23 @@ func (d *LenovoNasShare) List(ctx context.Context, dir model.Obj, args model.Lis
|
|||||||
files = append(files, resp.Data.List...)
|
files = append(files, resp.Data.List...)
|
||||||
|
|
||||||
return utils.SliceConvert(files, func(src File) (model.Obj, error) {
|
return utils.SliceConvert(files, func(src File) (model.Obj, error) {
|
||||||
|
if src.IsDir() {
|
||||||
return src, nil
|
return src, nil
|
||||||
|
}
|
||||||
|
return &model.ObjThumb{
|
||||||
|
Object: model.Object{
|
||||||
|
Name: src.GetName(),
|
||||||
|
Size: src.GetSize(),
|
||||||
|
Modified: src.ModTime(),
|
||||||
|
IsFolder: src.IsDir(),
|
||||||
|
},
|
||||||
|
Thumbnail: model.Thumbnail{
|
||||||
|
Thumbnail: func() string {
|
||||||
|
thumbUrl := d.Host + "/oneproxy/api/share/v1/file/thumb?code=" + d.ShareId + "&stoken=" + d.stoken + "&path=" + url.QueryEscape(src.GetPath())
|
||||||
|
return thumbUrl
|
||||||
|
}(),
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user