Documentation
¶
Index ¶
- Constants
- Variables
- func ExtractFolder(objs []Obj, extractFolder string)
- func GetProvider(obj Obj) (string, bool)
- func GetThumb(obj Obj) (thumb string, ok bool)
- func GetUrl(obj Obj) (url string, ok bool)
- func HashPwd(static string, salt string) string
- func SortFiles(objs []Obj, orderBy, orderDirection string)
- func StaticHash(password string) string
- func TwoHashPwd(password string, salt string) string
- func WrapObjsName(objs []Obj)
- type ArchiveArgs
- type ArchiveDecompressArgs
- type ArchiveInnerArgs
- type ArchiveListArgs
- type ArchiveMeta
- type ArchiveMetaArgs
- type ArchiveMetaInfo
- type ArchiveMetaProvider
- type File
- type FileCloser
- type FileRangeReader
- type FileStreamer
- type FsOtherArgs
- type IndexProgress
- type Link
- type LinkArgs
- type ListArgs
- type Meta
- type Obj
- type ObjMerge
- type ObjThumb
- type ObjThumbURL
- type ObjTree
- type ObjUnwrap
- type ObjWithProvider
- type ObjWrapName
- type Object
- func (o *Object) CreateTime() time.Time
- func (o *Object) GetHash() utils.HashInfo
- func (o *Object) GetID() string
- func (o *Object) GetName() string
- func (o *Object) GetPath() string
- func (o *Object) GetSize() int64
- func (o *Object) IsDir() bool
- func (o *Object) ModTime() time.Time
- func (o *Object) SetPath(path string)
- type ObjectProvider
- type ObjectTree
- type ObjectURL
- type OtherArgs
- type PageReq
- type Provider
- type Proxy
- type RangeReadCloser
- type RangeReadCloserIF
- type RangeReaderIF
- type SSHPublicKey
- type SearchNode
- type SearchReq
- type SetPath
- type SettingItem
- type Sharing
- type SharingArchiveListArgs
- type SharingArchiveMetaArgs
- type SharingDB
- type SharingLinkArgs
- type SharingListArgs
- type Sort
- type Storage
- type TaskItem
- type Thumb
- type Thumbnail
- type URL
- type UpdateProgress
- type Url
- type User
- func (u *User) CanAccessWithoutPassword() bool
- func (u *User) CanAddOfflineDownloadTasks() bool
- func (u *User) CanCopy() bool
- func (u *User) CanDecompress() bool
- func (u *User) CanFTPAccess() bool
- func (u *User) CanFTPManage() bool
- func (u *User) CanMove() bool
- func (u *User) CanReadArchives() bool
- func (u *User) CanRemove() bool
- func (u *User) CanRename() bool
- func (u *User) CanSeeHides() bool
- func (u *User) CanShare() bool
- func (u *User) CanWebdavManage() bool
- func (u *User) CanWebdavRead() bool
- func (u *User) CanWrite() bool
- func (u *User) IsAdmin() bool
- func (u *User) IsGuest() bool
- func (u *User) JoinPath(reqPath string) (string, error)
- func (u *User) SetPassword(pwd string) *User
- func (u *User) ValidatePwdStaticHash(pwdStaticHash string) error
- func (u *User) ValidateRawPassword(password string) error
- func (u *User) WebAuthnCredentials() []webauthn.Credential
- func (u *User) WebAuthnDisplayName() string
- func (u *User) WebAuthnID() []byte
- func (u *User) WebAuthnIcon() string
- func (u *User) WebAuthnName() string
Constants ¶
View Source
const ( SINGLE = iota SITE STYLE PREVIEW GLOBAL OFFLINE_DOWNLOAD INDEX SSO LDAP S3 FTP TRAFFIC )
View Source
const ( PUBLIC = iota PRIVATE READONLY DEPRECATED )
View Source
const ( GENERAL = iota GUEST // only one exists ADMIN )
View Source
const MaxInt = int(MaxUint >> 1)
View Source
const MaxUint = ^uint(0)
View Source
const MinInt = -MaxInt - 1
View Source
const MinUint = 0
View Source
const StaticHashSalt = "https://github.com/alist-org/alist"
Variables ¶
View Source
var ( DefaultLockDuration = time.Minute * 5 DefaultMaxAuthRetries = 5 )
View Source
var LoginCache = cache.NewMemCache[int]()
Functions ¶
func ExtractFolder ¶
func GetProvider ¶ added in v4.1.3
func StaticHash ¶
func TwoHashPwd ¶
func WrapObjsName ¶
func WrapObjsName(objs []Obj)
Types ¶
type ArchiveArgs ¶
type ArchiveDecompressArgs ¶
type ArchiveDecompressArgs struct {
ArchiveInnerArgs
CacheFull bool
PutIntoNewDir bool
}
type ArchiveInnerArgs ¶
type ArchiveInnerArgs struct {
ArchiveArgs
InnerPath string
}
type ArchiveListArgs ¶
type ArchiveListArgs struct {
ArchiveInnerArgs
Refresh bool
}
type ArchiveMeta ¶
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 ArchiveMetaArgs ¶
type ArchiveMetaArgs struct {
ArchiveArgs
Refresh bool
}
type ArchiveMetaInfo ¶
func (*ArchiveMetaInfo) GetComment ¶
func (m *ArchiveMetaInfo) GetComment() string
func (*ArchiveMetaInfo) GetTree ¶
func (m *ArchiveMetaInfo) GetTree() []ObjTree
func (*ArchiveMetaInfo) IsEncrypted ¶
func (m *ArchiveMetaInfo) IsEncrypted() bool
type ArchiveMetaProvider ¶
type ArchiveMetaProvider struct {
ArchiveMeta
*Sort
DriverProviding bool
Expiration *time.Duration
}
type FileCloser ¶ added in v4.0.9
func (*FileCloser) Close ¶ added in v4.0.9
func (f *FileCloser) Close() error
type FileRangeReader ¶ added in v4.0.9
type FileRangeReader struct {
RangeReaderIF
}
type FileStreamer ¶
type FileStreamer interface {
io.Reader
utils.ClosersIF
Obj
GetMimetype() string
NeedStore() bool
IsForceStreamUpload() bool
GetExist() Obj
SetExist(Obj)
// for a non-seekable Stream, RangeRead supports peeking some data, and CacheFullAndWriter still works
RangeRead(http_range.Range) (io.Reader, error)
// for a non-seekable Stream, if Read is called, this function won't work.
// caches the full Stream and writes it to writer (if provided, even if the stream is already cached).
CacheFullAndWriter(up *UpdateProgress, writer io.Writer) (File, error)
SetTmpFile(file File)
// if the Stream is not a File and is not cached, returns nil.
GetFile() File
}
FileStreamer ->check FileStream for more comments
type FsOtherArgs ¶
type IndexProgress ¶
type Link ¶
type Link struct {
URL string `json:"url"` // most common way
Header http.Header `json:"header"` // needed header (for url)
RangeReader RangeReaderIF `json:"-"` // recommended way if can't use URL
MFile File `json:"-"` // best for local,smb... file system, which exposes MFile
Expiration *time.Duration // local cache expire Duration
//for accelerating request, use multi-thread downloading
Concurrency int `json:"concurrency"`
PartSize int `json:"part_size"`
ContentLength int64 `json:"-"` // 转码视频、缩略图
utils.SyncClosers `json:"-"`
}
type Meta ¶
type Meta struct {
ID uint `json:"id" gorm:"primaryKey"`
Path string `json:"path" gorm:"unique" binding:"required"`
Password string `json:"password"`
PSub bool `json:"p_sub"`
Write bool `json:"write"`
WSub bool `json:"w_sub"`
Hide string `json:"hide"`
HSub bool `json:"h_sub"`
Readme string `json:"readme"`
RSub bool `json:"r_sub"`
Header string `json:"header"`
HeaderSub bool `json:"header_sub"`
}
type Obj ¶
type Obj interface {
GetSize() int64
GetName() string
ModTime() time.Time
CreateTime() time.Time
IsDir() bool
GetHash() utils.HashInfo
// The internal information of the driver.
// If you want to use it, please understand what it means
GetID() string
GetPath() string
}
func WrapObjName ¶
type ObjMerge ¶
type ObjMerge struct {
// contains filtered or unexported fields
}
func (*ObjMerge) InitHideReg ¶
type ObjThumbURL ¶
type ObjWithProvider ¶ added in v4.1.3
type ObjWithProvider interface {
GetProvider() string
}
type ObjWrapName ¶
func (*ObjWrapName) GetName ¶
func (o *ObjWrapName) GetName() string
func (*ObjWrapName) Unwrap ¶
func (o *ObjWrapName) Unwrap() Obj
type Object ¶
type Object struct {
ID string
Path string
Name string
Size int64
Modified time.Time
Ctime time.Time // file create time
IsFolder bool
HashInfo utils.HashInfo
}
func GetRawObject ¶
func (*Object) CreateTime ¶
type ObjectProvider ¶ added in v4.1.3
type ObjectTree ¶
func (*ObjectTree) GetChildren ¶
func (t *ObjectTree) GetChildren() []ObjTree
type PageReq ¶
type Provider ¶ added in v4.1.3
type Provider struct {
Provider string
}
func (Provider) GetProvider ¶ added in v4.1.3
type Proxy ¶
type Proxy struct {
WebProxy bool `json:"web_proxy"`
WebdavPolicy string `json:"webdav_policy"`
ProxyRange bool `json:"proxy_range"`
DownProxyURL string `json:"down_proxy_url"`
//Disable sign for DownProxyURL
DisableProxySign bool `json:"disable_proxy_sign"`
}
func (Proxy) WebdavProxyURL ¶ added in v4.0.9
type RangeReadCloser ¶
type RangeReadCloser struct {
RangeReader RangeReaderIF
utils.Closers
}
func (*RangeReadCloser) RangeRead ¶
func (r *RangeReadCloser) RangeRead(ctx context.Context, httpRange http_range.Range) (io.ReadCloser, error)
type RangeReadCloserIF ¶
type RangeReadCloserIF interface {
RangeReaderIF
utils.ClosersIF
}
type RangeReaderIF ¶ added in v4.0.9
type RangeReaderIF interface {
RangeRead(ctx context.Context, httpRange http_range.Range) (io.ReadCloser, error)
}
type SSHPublicKey ¶
type SSHPublicKey struct {
ID uint `json:"id" gorm:"primaryKey"`
UserId uint `json:"-"`
Title string `json:"title"`
Fingerprint string `json:"fingerprint"`
KeyStr string `gorm:"type:text" json:"-"`
AddedTime time.Time `json:"added_time"`
LastUsedTime time.Time `json:"last_used_time"`
}
func (*SSHPublicKey) UpdateLastUsedTime ¶
func (k *SSHPublicKey) UpdateLastUsedTime()
type SearchNode ¶
type SearchNode struct {
Parent string `json:"parent" gorm:"index"`
Name string `json:"name"`
IsDir bool `json:"is_dir"`
Size int64 `json:"size"`
}
func (*SearchNode) Type ¶
func (s *SearchNode) Type() string
type SearchReq ¶
type SettingItem ¶
type SettingItem struct {
Key string `json:"key" gorm:"primaryKey" binding:"required"` // unique key
Value string `json:"value"` // value
MigrationValue string `json:"-" gorm:"-:all"` // deprecated value
Help string `json:"help"` // help message
Type string `json:"type"` // string, number, bool, select
Options string `json:"options"` // values for select
Group int `json:"group"` // use to group setting in frontend
Flag int `json:"flag"` // 0 = public, 1 = private, 2 = readonly, 3 = deprecated, etc.
Index uint `json:"index"`
}
func (SettingItem) IsDeprecated ¶
func (s SettingItem) IsDeprecated() bool
type SharingArchiveListArgs ¶ added in v4.1.2
type SharingArchiveListArgs struct {
ArchiveListArgs
Pwd string
}
type SharingArchiveMetaArgs ¶ added in v4.1.2
type SharingArchiveMetaArgs struct {
ArchiveMetaArgs
Pwd string
}
type SharingDB ¶ added in v4.1.2
type SharingDB struct {
ID string `json:"id" gorm:"type:char(12);primaryKey"`
FilesRaw string `json:"-" gorm:"type:text"`
Expires *time.Time `json:"expires"`
Pwd string `json:"pwd"`
Accessed int `json:"accessed"`
MaxAccessed int `json:"max_accessed"`
CreatorId uint `json:"-"`
Disabled bool `json:"disabled"`
Remark string `json:"remark"`
Readme string `json:"readme" gorm:"type:text"`
Header string `json:"header" gorm:"type:text"`
Sort
}
type SharingLinkArgs ¶ added in v4.1.2
type SharingListArgs ¶ added in v4.1.2
type Storage ¶
type Storage struct {
ID uint `json:"id" gorm:"primaryKey"` // unique key
MountPath string `json:"mount_path" gorm:"unique" binding:"required"` // must be standardized
Order int `json:"order"` // use to sort
Driver string `json:"driver"` // driver used
CacheExpiration int `json:"cache_expiration"` // cache expire time
Status string `json:"status"`
Addition string `json:"addition" gorm:"type:text"` // Additional information, defined in the corresponding driver
Remark string `json:"remark"`
Modified time.Time `json:"modified"`
Disabled bool `json:"disabled"` // if disabled
DisableIndex bool `json:"disable_index"`
EnableSign bool `json:"enable_sign"`
Sort
Proxy
}
func (*Storage) GetStorage ¶
func (*Storage) SetStorage ¶
type UpdateProgress ¶
type UpdateProgress func(percentage float64)
func UpdateProgressWithRange ¶ added in v4.0.9
func UpdateProgressWithRange(inner UpdateProgress, start, end float64) UpdateProgress
type User ¶
type User struct {
ID uint `json:"id" gorm:"primaryKey"` // unique key
Username string `json:"username" gorm:"unique" binding:"required"` // username
PwdHash string `json:"-"` // password hash
PwdTS int64 `json:"-"` // password timestamp
Salt string `json:"-"` // unique salt
Password string `json:"password"` // password
BasePath string `json:"base_path"` // base path
Role int `json:"role"` // user's role
Disabled bool `json:"disabled"`
// Determine permissions by bit
// 0: can see hidden files
// 1: can access without password
// 2: can add offline download tasks
// 3: can mkdir and upload
// 4: can rename
// 5: can move
// 6: can copy
// 7: can remove
// 8: webdav read
// 9: webdav write
// 10: ftp/sftp login and read
// 11: ftp/sftp write
// 12: can read archives
// 13: can decompress archives
// 14: can share
Permission int32 `json:"permission"`
OtpSecret string `json:"-"`
SsoID string `json:"sso_id"` // unique by sso platform
Authn string `gorm:"type:text" json:"-"`
}
func (*User) CanAccessWithoutPassword ¶
func (*User) CanAddOfflineDownloadTasks ¶
func (*User) CanDecompress ¶
func (*User) CanFTPAccess ¶
func (*User) CanFTPManage ¶
func (*User) CanReadArchives ¶
func (*User) CanSeeHides ¶
func (*User) CanWebdavManage ¶
func (*User) CanWebdavRead ¶
func (*User) SetPassword ¶
func (*User) ValidatePwdStaticHash ¶
func (*User) ValidateRawPassword ¶
func (*User) WebAuthnCredentials ¶
func (u *User) WebAuthnCredentials() []webauthn.Credential
func (*User) WebAuthnDisplayName ¶
func (*User) WebAuthnID ¶
func (*User) WebAuthnIcon ¶
func (*User) WebAuthnName ¶
Click to show internal directories.
Click to hide internal directories.