Documentation
¶
Index ¶
- Constants
- Variables
- func CanAccessWithoutPassword(permission int32) bool
- func CanAddOfflineDownloadTasks(permission int32) bool
- func CanCopy(permission int32) bool
- func CanCustomizeShareID(permission int32) bool
- func CanDecompress(permission int32) bool
- func CanFTPAccess(permission int32) bool
- func CanFTPManage(permission int32) bool
- func CanMove(permission int32) bool
- func CanReadArchives(permission int32) bool
- func CanRemove(permission int32) bool
- func CanRename(permission int32) bool
- func CanSeeHides(permission int32) bool
- func CanShare(permission int32) bool
- func CanWebdavManage(permission int32) bool
- func CanWebdavRead(permission int32) bool
- func CanWriteContent(permission int32) bool
- 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 HashWebDAVPropertyKey(path, namespace, name string) string
- func ObjHasMask(obj Obj, mask ObjMask) bool
- 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 DiskUsage
- type EmbyDevice
- type EpisodeInfo
- type File
- type FileCloser
- type FileRangeReader
- type FileStreamer
- type FileWriter
- type FsOtherArgs
- type HttpDirectUploadInfo
- type IndexProgress
- type Link
- type LinkArgs
- type ListArgs
- type MediaAnnotation
- type MediaAppKey
- type MediaConfig
- type MediaItem
- type MediaPlaylist
- type MediaPlaylistItem
- type MediaScanPath
- type MediaScanProgress
- type MediaType
- type MediaUserData
- type Meta
- type Obj
- type ObjDisplayName
- type ObjMask
- type ObjMerge
- type ObjStorageDetails
- type ObjThumb
- type ObjThumbURL
- type ObjTree
- type ObjUnwrap
- type ObjWithProvider
- type ObjWithStorageDetails
- type ObjWrapMask
- 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) GetObjMask() ObjMask
- 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 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 StorageDetails
- 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) CanCustomizeShareID() 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) CanWriteContent() 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
- type WebDAVProperty
Constants ¶
const ( Locked = NoRename | NoRemove | NoMove ReadOnly = Locked | NoWrite // NoRename | NoDelete | NoMove | NoWrite )
const ( SINGLE = iota SITE STYLE PREVIEW GLOBAL OFFLINE_DOWNLOAD INDEX SSO LDAP S3 FTP TRAFFIC MEDIA TRANSCODE )
const ( PUBLIC = iota PRIVATE READONLY DEPRECATED )
const ( GENERAL = iota GUEST // only one exists ADMIN )
const ( StaticHashSalt = "https://github.com/alist-org/alist" InvalidUsernameOrPassword = "Invalid username or password" Invalid2FACode = "Invalid 2FA code" TooManyAttempts = "Too many unsuccessful sign-in attempts have been made using an incorrect username or password, Try again later." GuestCannotUpdateProfile = "Guest user can not update profile" GuestCannotGenerate2FA = "Guest user can not generate 2FA code" )
const MaxInt = int(MaxUint >> 1)
const MaxUint = ^uint(0)
const MediaIndexColumnMax = 191
MediaIndexColumnMax 复合唯一索引列(folder_path / file_name / album_name)的最大字符数
const MinInt = -MaxInt - 1
const MinUint = 0
Variables ¶
var ( DefaultLockDuration = time.Minute * 5 DefaultMaxAuthRetries = 5 )
var LoginCache = cache.NewMemCache[int]()
Functions ¶
func CanAccessWithoutPassword ¶ added in v4.1.9
func CanAddOfflineDownloadTasks ¶ added in v4.1.9
func CanCustomizeShareID ¶ added in v4.2.2
func CanDecompress ¶ added in v4.1.9
func CanFTPAccess ¶ added in v4.1.9
func CanFTPManage ¶ added in v4.1.9
func CanReadArchives ¶ added in v4.1.9
func CanSeeHides ¶ added in v4.1.9
func CanWebdavManage ¶ added in v4.1.9
func CanWebdavRead ¶ added in v4.1.9
func CanWriteContent ¶ added in v4.2.0
func ExtractFolder ¶
func GetProvider ¶ added in v4.1.3
func HashWebDAVPropertyKey ¶ added in v4.2.9
HashWebDAVPropertyKey returns a stable hash for the complete property key.
func ObjHasMask ¶ added in v4.1.9
func StaticHash ¶
func TwoHashPwd ¶
func WrapObjsName ¶
func WrapObjsName(objs []Obj)
Types ¶
type ArchiveArgs ¶
type ArchiveDecompressArgs ¶
type ArchiveDecompressArgs struct {
ArchiveInnerArgs
CacheFull bool
PutIntoNewDir bool
Overwrite 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 DiskUsage ¶ added in v4.1.4
func (DiskUsage) MarshalJSON ¶ added in v4.1.10
type EmbyDevice ¶ added in v4.2.8
type EmbyDevice struct {
ID uint `gorm:"primarykey" json:"id"`
CreatedAt time.Time `json:"created_at"`
UserID uint `gorm:"index;not null" json:"user_id"`
DeviceID string `json:"device_id"` // 客户端上报的 DeviceId
DeviceName string `json:"device_name"`
Client string `json:"client"`
Version string `json:"version"`
// HashToken 始终返回 SHA-256 的 64 个十六进制字符,长度固定且适合唯一索引。
TokenHash string `gorm:"size:64;uniqueIndex;not null" json:"-"`
AppKeyID uint `json:"app_key_id"` // 通过应用密钥认证时为对应 key,否则为 0
LastSeenAt time.Time `json:"last_seen_at"`
}
EmbyDevice Emby 客户端会话(由 AuthenticateByName 签发)
type EpisodeInfo ¶ added in v4.2.8
type EpisodeInfo struct {
FileName string `json:"file_name"` // 原始文件名(含扩展名)
Index int `json:"index"` // 序号,默认0,文件名开头有数字则取该数字
Title string `json:"title"` // 选集标题(去掉序号后的文件名,不含扩展名)
}
EpisodeInfo 选集信息(文件夹型媒体的单集描述)
type File ¶
type File interface {
io.ReaderAt
io.ReadSeeker
}
File is basic file level accessing interface
type FileCloser ¶ added in v4.0.9
func (*FileCloser) Close ¶ added in v4.0.9
func (f *FileCloser) Close() (err error)
type FileRangeReader ¶ added in v4.0.9
type FileRangeReader struct {
RangeReaderIF
}
FileRangeReader 是对 RangeReaderIF 的轻量包装,表明由 RangeReaderIF.RangeRead 返回的 io.ReadCloser 同时实现了 model.File(即支持 Read/ReadAt/Seek)。 只有满足这些才需要使用 FileRangeReader,否则直接使用 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)
// if the Stream is not a File and is not cached, returns nil.
GetFile() File
}
FileStreamer ->check FileStream for more comments
type FileWriter ¶ added in v4.2.2
type FileWriter interface {
io.WriterAt
io.WriteSeeker
}
type FsOtherArgs ¶
type HttpDirectUploadInfo ¶ added in v4.1.7
type HttpDirectUploadInfo struct {
UploadURL string `json:"upload_url"` // The URL to upload the file
ChunkSize int64 `json:"chunk_size"` // The chunk size for uploading, 0 means no chunking required
Headers map[string]string `json:"headers,omitempty"` // Optional headers to include in the upload request
Method string `json:"method,omitempty"` // HTTP method, default is PUT
}
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
Expiration *time.Duration // local cache expiration; not transferred by Clone
//for accelerating request, use multi-thread downloading
Concurrency int `json:"concurrency"`
PartSize int `json:"part_size"`
ContentLength int64 `json:"content_length"` // 转码视频、缩略图
utils.SyncClosers `json:"-"`
// 如果SyncClosers中的资源被关闭后Link将不可用,则此值应为 true
RequireReference bool `json:"-"`
}
type MediaAnnotation ¶ added in v4.2.8
type MediaAnnotation struct {
ID uint `gorm:"primarykey" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
UserID uint `gorm:"uniqueIndex:idx_media_annotation_key;not null" json:"-"`
ItemID uint `gorm:"uniqueIndex:idx_media_annotation_key;not null;index" json:"item_id"`
// RemoteID 是查看器分配的批注 id:多设备打开同一份 PDF 时靠它做去重与更新
RemoteID string `gorm:"uniqueIndex:idx_media_annotation_key;size:128;not null" json:"remote_id"`
Anchor string `gorm:"type:text;not null" json:"anchor"`
}
MediaAnnotation 用户在 PDF 阅读器里添加的批注。
只存查看器原生的批注对象(Anchor,JSON):页码、rect/quadPoints、颜色、 文字、绘制点集都在里面,拆成独立列会出现两份可能不一致的数据。 重新打开时原样回灌给 PDF 引擎,因此这里不重复建模。
type MediaAppKey ¶ added in v4.2.8
type MediaAppKey struct {
ID uint `gorm:"primarykey" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
UserID uint `gorm:"index;not null" json:"user_id"`
Name string `json:"name"` // 备注名,例如 "Symfonium"、"MoviePilot"
// 前缀由 AppKeyPrefix 固定为最多 8 个 ASCII 字符;显式长度使 MySQL
// 将索引列建为 varchar,而不是无法建立索引的 longtext。
Prefix string `gorm:"size:32;index" json:"prefix"` // 明文前缀(便于识别/排查)
Secret string `gorm:"not null" json:"-"` // AES-GCM 密文(base64)
LastUsedAt *time.Time `json:"last_used_at"`
}
MediaAppKey 媒体应用密钥。 用于无法走交互式登录的客户端(Subsonic 的 token 认证、Emby 的 api_key、 MoviePilot 对接等)。密钥本身以 AES-GCM 加密存储,数据库中不保留明文。
type MediaConfig ¶ added in v4.2.8
type MediaConfig struct {
ID uint `gorm:"primarykey" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
// 媒体类型只允许使用 MediaType 定义的短枚举值;显式长度使 MySQL 生成
// varchar 而不是无法建立索引的 longtext,满足该字段的唯一约束。
MediaType MediaType `gorm:"size:32;uniqueIndex;not null" json:"media_type"`
Enabled bool `gorm:"default:false" json:"enabled"`
LastScanAt *time.Time `json:"last_scan_at"`
LastScrapeAt *time.Time `json:"last_scrape_at"`
// ScraperConfig 该媒体类型独立的刮削配置(JSON):
// store_thumbnail / thumbnail_mode / thumbnail_path,未设置时回落到全局设置
ScraperConfig string `gorm:"type:text" json:"scraper_config"`
}
MediaConfig 媒体库配置(每种类型一条记录)
type MediaItem ¶ added in v4.2.8
type MediaItem struct {
// 显式声明基础字段,避免同时嵌入 gorm.Model 后重复生成 deleted_at 索引列;
// JSON 标签继续保持媒体 API 的字段命名约定。
ID uint `gorm:"primarykey" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
// 基础信息
MediaType MediaType `gorm:"size:32;index;not null" json:"media_type"`
ScanPathID uint `gorm:"index" json:"scan_path_id"` // 关联的扫描路径ID
// 三个字段共同组成复合唯一索引。MySQL 对「有索引且未指定长度」的 string 会生成 longtext,
// 而 TEXT 列不能直接建索引(AutoMigrate 会失败);因此必须显式限定 size。
// utf8mb4 下 InnoDB 索引总长上限 3072 字节:191*3*4 = 2292,留足余量。
FileName string `gorm:"size:191;uniqueIndex:idx_media_folder_file_album" json:"file_name"`
FileSize int64 `json:"file_size"`
MimeType string `json:"mime_type"`
Hidden bool `gorm:"default:false" json:"hidden"`
// 刮削/编辑信息
ScrapedName string `json:"scraped_name"`
Description string `gorm:"type:text" json:"description"`
Cover string `json:"cover"` // 封面URL或本地路径
ReleaseDate string `json:"release_date"` // 发布时间,格式 YYYY-MM-DD
Rating float32 `json:"rating"` // 评分 0-10
Genre string `json:"genre"` // 类型,逗号分隔,如 "动作,科幻"
Authors string `gorm:"type:text" json:"authors"` // 作者/演员,JSON数组字符串
Plot string `gorm:"type:text" json:"plot"` // 剧情/内容介绍
Reviews string `gorm:"type:text" json:"reviews"` // 用户评价,JSON数组字符串
// 外部ID(用于刮削关联)
ExternalID string `json:"external_id"` // TMDB ID / Discogs ID / 豆瓣ID
// 音乐专属字段
AlbumName string `gorm:"size:191;uniqueIndex:idx_media_folder_file_album" json:"album_name"` // 所属专辑名
AlbumArtist string `json:"album_artist"` // 专辑艺术家
TrackNumber int `json:"track_number"` // 曲目编号
Duration int `json:"duration"` // 时长(秒)
Lyrics string `gorm:"type:text" json:"lyrics"` // LRC格式歌词
// 视频专属字段
VideoType string `json:"video_type"` // "movie" 或 "tv"
Season int `json:"season"` // 季(电视剧)
Episode int `json:"episode"` // 集(电视剧)
// 书籍专属字段
Publisher string `json:"publisher"` // 出版社
ISBN string `json:"isbn"` // ISBN
// 目录合并模式
IsFolder bool `gorm:"default:false" json:"is_folder"` // 是否为文件夹模式条目
FolderPath string `gorm:"size:191;index;uniqueIndex:idx_media_folder_file_album" json:"folder_path"` // 扫描根路径(恒定为扫描路径,与file_name+album_name组合唯一)
Episodes string `gorm:"type:text" json:"episodes"` // 选集信息,JSON数组,格式:[{file_name,index,title},...]
ScrapedAt *time.Time `json:"scraped_at"`
}
MediaItem 媒体条目(统一表,通过 media_type 区分类型,便于后期扩展新类型)
type MediaPlaylist ¶ added in v4.2.8
type MediaPlaylist struct {
ID uint `gorm:"primarykey" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
UserID uint `gorm:"index;not null" json:"user_id"`
Name string `json:"name"`
Comment string `json:"comment"`
Public bool `json:"public"`
ItemCount int `json:"item_count"`
}
MediaPlaylist 用户播放列表(Subsonic 需要,Emby 的 Playlist 复用同一份数据)
type MediaPlaylistItem ¶ added in v4.2.8
type MediaPlaylistItem struct {
ID uint `gorm:"primarykey" json:"id"`
PlaylistID uint `gorm:"index;not null" json:"playlist_id"`
ItemID uint `gorm:"index;not null" json:"item_id"`
EpisodeIndex int `json:"episode_index"`
Order int `gorm:"column:sort_order" json:"order"`
}
MediaPlaylistItem 播放列表条目(按 Order 排序)
type MediaScanPath ¶ added in v4.2.8
type MediaScanPath struct {
ID uint `gorm:"primarykey" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
MediaType MediaType `gorm:"size:32;index;not null" json:"media_type"` // 所属媒体类型
Name string `json:"name"` // 路径名称(用于前端筛选显示)
Path string `gorm:"not null" json:"path"` // VFS 扫描路径
PathMerge bool `gorm:"default:false" json:"path_merge"` // 路径合并模式(子文件夹作为一个条目)
TypeTag string `json:"type_tag"` // 类型标签:电影、电视剧等
ContentTags string `json:"content_tags"` // 内容标签:喜剧、惊悚等(逗号分隔)
EnableScrape bool `gorm:"default:true" json:"enable_scrape"` // 是否启用刮削
LastScanAt *time.Time `json:"last_scan_at"` // 最后扫描时间
}
MediaScanPath 媒体库扫描路径(每个媒体库可配置多个扫描路径)
type MediaScanProgress ¶ added in v4.2.8
type MediaScanProgress struct {
MediaType MediaType `json:"media_type"`
ScanPathID uint `json:"scan_path_id,omitempty"` // 0 表示全部路径
Running bool `json:"running"`
Total int `json:"total"`
Done int `json:"done"`
Message string `json:"message"`
Error string `json:"error,omitempty"`
}
MediaScanProgress 扫描进度(内存中维护,不持久化)
type MediaUserData ¶ added in v4.2.8
type MediaUserData struct {
ID uint `gorm:"primarykey" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
UserID uint `gorm:"uniqueIndex:idx_media_user_item_ep;not null" json:"user_id"`
ItemID uint `gorm:"uniqueIndex:idx_media_user_item_ep;not null" json:"item_id"`
EpisodeIndex int `gorm:"uniqueIndex:idx_media_user_item_ep;not null" json:"episode_index"` // 0 表示条目本身,>0 表示选集序号
Played bool `json:"played"`
PlayCount int `json:"play_count"`
IsFavorite bool `gorm:"index" json:"is_favorite"`
Rating int `json:"rating"` // 0-5,Subsonic 语义
PositionTicks int64 `json:"position_ticks"` // 100ns tick,与 Emby 一致
LastPlayedAt *time.Time `json:"last_played_at"`
}
MediaUserData 用户对媒体条目的播放状态,Emby 与 Subsonic 共用。
type Meta ¶
type Meta struct {
ID uint `json:"id" gorm:"primaryKey"`
Path string `json:"path" gorm:"unique" binding:"required"`
ReadUsers []uint `json:"read_users" gorm:"serializer:json"`
ReadUsersSub bool `json:"read_users_sub"`
WriteUsers []uint `json:"write_users" gorm:"serializer:json"`
WriteUsersSub bool `json:"write_users_sub"`
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 UnwrapObjName ¶ added in v4.1.9
func WrapObjName ¶
type ObjDisplayName ¶ added in v4.2.6
type ObjDisplayName interface {
GetDisplayName() string
}
type ObjMask ¶ added in v4.1.9
type ObjMask uint8
func GetObjMask ¶ added in v4.1.9
func (ObjMask) GetObjMask ¶ added in v4.1.9
type ObjMerge ¶
type ObjMerge struct {
// contains filtered or unexported fields
}
func (*ObjMerge) InitHideReg ¶
type ObjStorageDetails ¶ added in v4.1.4
type ObjStorageDetails struct {
Obj
*StorageDetails
}
func (*ObjStorageDetails) GetStorageDetails ¶ added in v4.1.4
func (o *ObjStorageDetails) GetStorageDetails() *StorageDetails
func (*ObjStorageDetails) Unwrap ¶ added in v4.1.9
func (o *ObjStorageDetails) Unwrap() Obj
type ObjThumbURL ¶
type ObjWithProvider ¶ added in v4.1.3
type ObjWithProvider interface {
GetProvider() string
}
type ObjWithStorageDetails ¶ added in v4.1.4
type ObjWithStorageDetails interface {
GetStorageDetails() *StorageDetails
}
type ObjWrapMask ¶ added in v4.1.9
func (*ObjWrapMask) GetObjMask ¶ added in v4.1.9
func (m *ObjWrapMask) GetObjMask() ObjMask
func (*ObjWrapMask) Unwrap ¶ added in v4.1.9
func (m *ObjWrapMask) Unwrap() Obj
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
Mask ObjMask
}
func (*Object) CreateTime ¶
func (*Object) GetObjMask ¶ added in v4.1.9
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 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:varchar(64);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
CustomCachePolicies string `json:"custom_cache_policies" gorm:"type:text"`
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"`
SeedPolicy string `json:"seed_policy" gorm:"default:inherit"`
Sort
Proxy
}
func (*Storage) GetStorage ¶
func (*Storage) SetStorage ¶
type StorageDetails ¶ added in v4.1.4
type StorageDetails struct {
DiskUsage
}
func GetStorageDetails ¶ added in v4.1.4
func GetStorageDetails(obj Obj) (*StorageDetails, bool)
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
// 15: can customize share id
Permission int32 `json:"permission"`
OtpSecret string `json:"-"`
SsoID string `json:"sso_id"` // unique by sso platform
Authn string `gorm:"type:text" json:"-"`
AllowLdap bool `json:"allow_ldap" gorm:"default:true"`
}
func (*User) CanAccessWithoutPassword ¶
func (*User) CanAddOfflineDownloadTasks ¶
func (*User) CanCustomizeShareID ¶ added in v4.2.2
func (*User) CanDecompress ¶
func (*User) CanFTPAccess ¶
func (*User) CanFTPManage ¶
func (*User) CanReadArchives ¶
func (*User) CanSeeHides ¶
func (*User) CanWebdavManage ¶
func (*User) CanWebdavRead ¶
func (*User) CanWriteContent ¶ added in v4.2.0
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 ¶
type WebDAVProperty ¶ added in v4.2.8
type WebDAVProperty struct {
ID uint `json:"id" gorm:"primaryKey"`
Path string `json:"path" gorm:"type:text"`
Namespace string `json:"namespace" gorm:"type:text"`
Name string `json:"name" gorm:"type:text"`
KeyHash string `json:"-" gorm:"size:64;uniqueIndex:idx_webdav_property"`
Lang string `json:"lang"`
InnerXML []byte `json:"inner_xml"`
}
WebDAVProperty stores a dead WebDAV property for a resource.
Path, Namespace and Name are TEXT columns so that long WebDAV paths are never truncated or rejected. MySQL cannot index TEXT columns without a key prefix length, so the unique index uses a SHA-256 hash of the complete property key instead.
func (*WebDAVProperty) BeforeSave ¶ added in v4.2.9
func (p *WebDAVProperty) BeforeSave(*gorm.DB) error