model

package
v3.22.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SINGLE = iota
	SITE
	STYLE
	PREVIEW
	GLOBAL
	ARIA2
	INDEX
	SSO
)
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

Variables

This section is empty.

Functions

func ExtractFolder

func ExtractFolder(objs []Obj, extractFolder string)

func GetThumb added in v3.7.1

func GetThumb(obj Obj) (thumb string, ok bool)

func GetUrl added in v3.7.1

func GetUrl(obj Obj) (url string, ok bool)

func SortFiles

func SortFiles(objs []Obj, orderBy, orderDirection string)

func WrapObjsName added in v3.7.1

func WrapObjsName(objs []Obj)

Types

type FileStream

type FileStream struct {
	Obj
	io.ReadCloser
	Mimetype     string
	WebPutAsTask bool
	Old          Obj
}

func (*FileStream) GetMimetype

func (f *FileStream) GetMimetype() string

func (*FileStream) GetOld added in v3.7.1

func (f *FileStream) GetOld() Obj

func (*FileStream) GetReadCloser

func (f *FileStream) GetReadCloser() io.ReadCloser

func (*FileStream) NeedStore

func (f *FileStream) NeedStore() bool

func (*FileStream) SetReadCloser

func (f *FileStream) SetReadCloser(rc io.ReadCloser)

type FileStreamer

type FileStreamer interface {
	io.ReadCloser
	Obj
	GetMimetype() string
	SetReadCloser(io.ReadCloser)
	NeedStore() bool
	GetReadCloser() io.ReadCloser
	GetOld() Obj
}

type FsOtherArgs

type FsOtherArgs struct {
	Path   string      `json:"path" form:"path"`
	Method string      `json:"method" form:"method"`
	Data   interface{} `json:"data" form:"data"`
}

type IndexProgress added in v3.6.0

type IndexProgress struct {
	ObjCount     uint64     `json:"obj_count"`
	IsDone       bool       `json:"is_done"`
	LastDoneTime *time.Time `json:"last_done_time"`
	Error        string     `json:"error"`
}
type Link struct {
	URL        string         `json:"url"`
	Header     http.Header    `json:"header"` // needed header (for url) or response header(for data or writer)
	Data       io.ReadCloser  // return file reader directly
	Status     int            // status maybe 200 or 206, etc
	FilePath   *string        // local file, return the filepath
	Expiration *time.Duration // url expiration time
	//Handle     func(w http.ResponseWriter, r *http.Request) error `json:"-"` // custom handler
	Writer WriterFunc `json:"-"` // custom writer
}

type LinkArgs

type LinkArgs struct {
	IP      string
	Header  http.Header
	Type    string
	HttpReq *http.Request
}

type ListArgs

type ListArgs struct {
	ReqPath           string
	S3ShowPlaceholder bool
}

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"`
}

type Obj

type Obj interface {
	GetSize() int64
	GetName() string
	ModTime() time.Time
	IsDir() bool

	// The internal information of the driver.
	// If you want to use it, please understand what it means
	GetID() string
	GetPath() string
}

func UnwrapObj added in v3.7.1

func UnwrapObj(obj Obj) Obj

func WrapObjName added in v3.7.1

func WrapObjName(objs Obj) Obj

type ObjMerge added in v3.7.1

type ObjMerge struct {
	// contains filtered or unexported fields
}

func NewObjMerge added in v3.7.1

func NewObjMerge() *ObjMerge

Merge

func (*ObjMerge) InitHideReg added in v3.7.1

func (om *ObjMerge) InitHideReg(hides string)

func (*ObjMerge) Merge added in v3.7.1

func (om *ObjMerge) Merge(objs []Obj, objs_ ...Obj) []Obj

func (*ObjMerge) Reset added in v3.7.1

func (om *ObjMerge) Reset()

type ObjThumb

type ObjThumb struct {
	Object
	Thumbnail
}

type ObjThumbURL

type ObjThumbURL struct {
	Object
	Thumbnail
	Url
}

type ObjUnwrap added in v3.9.0

type ObjUnwrap interface {
	Unwrap() Obj
}

type ObjWrapName added in v3.7.1

type ObjWrapName struct {
	Name string
	Obj
}

func (*ObjWrapName) GetName added in v3.7.1

func (o *ObjWrapName) GetName() string

func (*ObjWrapName) Unwrap added in v3.7.1

func (o *ObjWrapName) Unwrap() Obj

type Object

type Object struct {
	ID       string
	Path     string
	Name     string
	Size     int64
	Modified time.Time
	IsFolder bool
}

func (*Object) GetID

func (o *Object) GetID() string

func (*Object) GetName

func (o *Object) GetName() string

func (*Object) GetPath

func (o *Object) GetPath() string

func (*Object) GetSize

func (o *Object) GetSize() int64

func (*Object) IsDir

func (o *Object) IsDir() bool

func (*Object) ModTime

func (o *Object) ModTime() time.Time

func (*Object) SetPath

func (o *Object) SetPath(id string)

type ObjectURL

type ObjectURL struct {
	Object
	Url
}

type OtherArgs

type OtherArgs struct {
	Obj    Obj
	Method string
	Data   interface{}
}

type PageReq added in v3.6.0

type PageReq struct {
	Page    int `json:"page" form:"page"`
	PerPage int `json:"per_page" form:"per_page"`
}

func (*PageReq) Validate added in v3.6.0

func (p *PageReq) Validate()

type Proxy

type Proxy struct {
	WebProxy     bool   `json:"web_proxy"`
	WebdavPolicy string `json:"webdav_policy"`
	DownProxyUrl string `json:"down_proxy_url"`
}

func (Proxy) Webdav302

func (p Proxy) Webdav302() bool

func (Proxy) WebdavNative

func (p Proxy) WebdavNative() bool

func (Proxy) WebdavProxy

func (p Proxy) WebdavProxy() bool

type SearchNode added in v3.6.0

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 added in v3.6.0

func (s *SearchNode) Type() string

type SearchReq added in v3.6.0

type SearchReq struct {
	Parent   string `json:"parent"`
	Keywords string `json:"keywords"`
	PageReq
}

func (*SearchReq) Validate added in v3.6.0

func (p *SearchReq) Validate() error

type SetPath

type SetPath interface {
	SetPath(path string)
}

type SettingItem

type SettingItem struct {
	Key     string `json:"key" gorm:"primaryKey" binding:"required"` // unique key
	Value   string `json:"value"`                                    // 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.
}

func (SettingItem) IsDeprecated

func (s SettingItem) IsDeprecated() bool

type Sort

type Sort struct {
	OrderBy        string `json:"order_by"`
	OrderDirection string `json:"order_direction"`
	ExtractFolder  string `json:"extract_folder"`
}

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
	EnableSign      bool      `json:"enable_sign"`
	Sort
	Proxy
}

func (*Storage) GetStorage

func (s *Storage) GetStorage() *Storage

func (*Storage) SetStatus

func (s *Storage) SetStatus(status string)

func (*Storage) SetStorage added in v3.7.1

func (s *Storage) SetStorage(storage Storage)

type Thumb

type Thumb interface {
	Thumb() string
}

type Thumbnail

type Thumbnail struct {
	Thumbnail string
}

func (Thumbnail) Thumb

func (t Thumbnail) Thumb() string

type URL

type URL interface {
	URL() string
}

type Url

type Url struct {
	Url string
}

func (Url) URL

func (w Url) URL() string

type User

type User struct {
	ID       uint   `json:"id" gorm:"primaryKey"`                      // unique key
	Username string `json:"username" gorm:"unique" binding:"required"` // username
	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 aria2 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: can add qbittorrent tasks
	Permission int32  `json:"permission"`
	OtpSecret  string `json:"-"`
	SsoID      string `json:"sso_id"`
}

func (User) CanAccessWithoutPassword

func (u User) CanAccessWithoutPassword() bool

func (User) CanAddAria2Tasks

func (u User) CanAddAria2Tasks() bool

func (User) CanAddQbittorrentTasks added in v3.11.0

func (u User) CanAddQbittorrentTasks() bool

func (User) CanCopy

func (u User) CanCopy() bool

func (User) CanMove

func (u User) CanMove() bool

func (User) CanRemove

func (u User) CanRemove() bool

func (User) CanRename

func (u User) CanRename() bool

func (User) CanSeeHides

func (u User) CanSeeHides() bool

func (User) CanWebdavManage

func (u User) CanWebdavManage() bool

func (User) CanWebdavRead

func (u User) CanWebdavRead() bool

func (User) CanWrite

func (u User) CanWrite() bool

func (User) IsAdmin

func (u User) IsAdmin() bool

func (User) IsGuest

func (u User) IsGuest() bool

func (User) JoinPath added in v3.6.0

func (u User) JoinPath(reqPath string) (string, error)

func (User) ValidatePassword

func (u User) ValidatePassword(password string) error

type WriterFunc added in v3.18.0

type WriterFunc func(w io.Writer) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL