alist/internal/model/archive.go
j2rong4cn 5c5d8378e5
fix(archive): unable to preview (#7843)
* fix(archive): unrecognition zip

* feat(archive): add tree for zip meta

* fix bug

* refactor(archive):  meta cache time use Link Expiration first

* feat(archive): return sort policy in meta (#2)

* refactor

* perf(archive): reduce new network requests

---------

Co-authored-by: KirCute_ECT <951206789@qq.com>
2025-01-27 20:08:56 +08:00

54 lines
1.1 KiB
Go

package model
import "time"
type ObjTree interface {
Obj
GetChildren() []ObjTree
}
type ObjectTree struct {
Object
Children []ObjTree
}
func (t *ObjectTree) GetChildren() []ObjTree {
return t.Children
}
type ArchiveMeta interface {
GetComment() string
// IsEncrypted means if the content of the archive requires a password to access
// GetArchiveMeta should return errs.WrongArchivePassword if the meta-info is also encrypted,
// and the provided password is empty.
IsEncrypted() bool
// GetTree directly returns the full folder structure
// returns nil if the folder structure should be acquired by calling driver.ArchiveReader.ListArchive
GetTree() []ObjTree
}
type ArchiveMetaInfo struct {
Comment string
Encrypted bool
Tree []ObjTree
}
func (m *ArchiveMetaInfo) GetComment() string {
return m.Comment
}
func (m *ArchiveMetaInfo) IsEncrypted() bool {
return m.Encrypted
}
func (m *ArchiveMetaInfo) GetTree() []ObjTree {
return m.Tree
}
type ArchiveMetaProvider struct {
ArchiveMeta
*Sort
DriverProviding bool
Expiration *time.Duration
}