Documentation ¶
Index ¶
- Constants
- func CacheFolder(db *beepboop.DB, folder *Folder) error
- func DetectContentType(r io.ReadSeeker) (string, error)
- func FilenameToUUID(filename string) string
- func GetArchiveWalker(filename, mime string) (archiver.Walker, error)
- func Hash(s string) string
- func IsFolder(root, relPath string) bool
- func IsThumbnailSupported(mime string) bool
- func Salt() string
- func UncacheFolder(db *beepboop.DB, folderName string) error
- type ErrFileAlreadyExists
- type ErrFolderConfigNotFound
- type ErrFolderNotWritable
- type ErrInheritedConfigPasswordChange
- type ErrInvalidAccessType
- type ErrPasswordScoreTooLow
- type ErrReadWritePasswordMatch
- type ErrUnsupportedFileFormat
- type ErrWrongPassword
- type File
- func (f *File) Create(content io.Reader, overwrite bool) error
- func (f *File) Delete() error
- func (f *File) GetInternalFilename() string
- func (f *File) GetThumbnail(retryAfter time.Duration) (*Thumbnail, error)
- func (f *File) GetThumbnailBounds(retryAfter time.Duration) (*image.Rectangle, error)
- func (f *File) HasTag(tag string) bool
- func (f *File) Move(relPath string) error
- func (f *File) Open() (FileReader, error)
- func (f *File) Save() error
- type FileReader
- type Folder
- func (f *Folder) CacheFile(file *File)
- func (f *Folder) CacheSubfolder(subfolder string)
- func (f *Folder) EnsureAccess(accessType string, sess *beepboop.Session) error
- func (f *Folder) EnsureReadAccess(sess *beepboop.Session) error
- func (f *Folder) EnsureWriteAccess(sess *beepboop.Session) error
- func (f *Folder) GetAccessToken(accessType string) (beepboop.AccessMap, error)
- func (f *Folder) GetFile(basename string) (*File, error)
- func (f *Folder) GetFiles() []*File
- func (f *Folder) GetMaxUploadSizeMB() int64
- func (f *Folder) GetPasswordHash(accessType string) (string, error)
- func (f *Folder) GetSubfolders() []string
- func (f *Folder) Search(tag string) []*File
- func (f *Folder) SetPassword(accessType, pw string) error
- func (f *Folder) SetPasswords(readPw, writePw string) error
- func (f *Folder) SetReadPassword(readPw string) error
- func (f *Folder) SetWritePassword(writePw string) error
- func (f *Folder) TestPassword(accessType, pw string) bool
- func (f *Folder) TestReadPassword(readPw string) bool
- func (f *Folder) TestWritePassword(writePw string) bool
- func (f *Folder) UncacheFile(filename string)
- func (f *Folder) UncacheSubfolder(subfolder string)
- type FolderConfig
- type Thumbnail
Constants ¶
const MaxThumbnailWidth = 250
MaxThumbnailWidth ...
Variables ¶
This section is empty.
Functions ¶
func CacheFolder ¶
CacheFolder caches a Folder
func DetectContentType ¶
func DetectContentType(r io.ReadSeeker) (string, error)
DetectContentType determines the MIME type of a given file
func FilenameToUUID ¶
FilenameToUUID returns an UUID from a filename
func GetArchiveWalker ¶
GetArchiveWalker ...
func IsThumbnailSupported ¶
IsThumbnailSupported returns whether thumbnails can be created for the specified mime type
Types ¶
type ErrFileAlreadyExists ¶
type ErrFileAlreadyExists struct {
File string
}
ErrFileAlreadyExists ...
func (ErrFileAlreadyExists) Error ¶
func (err ErrFileAlreadyExists) Error() string
type ErrFolderConfigNotFound ¶
type ErrFolderConfigNotFound struct {
Folder string
}
ErrFolderConfigNotFound ...
func (ErrFolderConfigNotFound) Error ¶
func (err ErrFolderConfigNotFound) Error() string
type ErrFolderNotWritable ¶
type ErrFolderNotWritable struct{}
ErrFolderNotWritable ...
func (ErrFolderNotWritable) Error ¶
func (err ErrFolderNotWritable) Error() string
type ErrInheritedConfigPasswordChange ¶
type ErrInheritedConfigPasswordChange struct{}
ErrInheritedConfigPasswordChange ...
func (ErrInheritedConfigPasswordChange) Error ¶
func (err ErrInheritedConfigPasswordChange) Error() string
type ErrInvalidAccessType ¶
type ErrInvalidAccessType struct {
AccessType string
}
ErrInvalidAccessType ...
func (ErrInvalidAccessType) Error ¶
func (err ErrInvalidAccessType) Error() string
type ErrPasswordScoreTooLow ¶
type ErrPasswordScoreTooLow struct {
Score int
}
ErrPasswordScoreTooLow ...
func (ErrPasswordScoreTooLow) Error ¶
func (err ErrPasswordScoreTooLow) Error() string
type ErrReadWritePasswordMatch ¶
type ErrReadWritePasswordMatch struct{}
ErrReadWritePasswordMatch ...
func (ErrReadWritePasswordMatch) Error ¶
func (err ErrReadWritePasswordMatch) Error() string
type ErrUnsupportedFileFormat ¶
type ErrUnsupportedFileFormat struct {
MIME string
}
ErrUnsupportedFileFormat ...
func (ErrUnsupportedFileFormat) Error ¶
func (err ErrUnsupportedFileFormat) Error() string
type ErrWrongPassword ¶
type ErrWrongPassword struct{}
ErrWrongPassword ...
func (ErrWrongPassword) Error ¶
func (err ErrWrongPassword) Error() string
type File ¶
type File struct { Name string `json:"name"` Root string `json:"root"` RelPath string `json:"rel_path"` Tags []string `json:"tags"` MIME string `json:"mime"` Size int64 `json:"size"` Uploaded time.Time `json:"uploaded"` Public bool `json:"public"` Thumbnail *Thumbnail `json:"thumbnail,omitempty"` }
File ...
func (*File) GetInternalFilename ¶
GetInternalFilename ...
func (*File) GetThumbnail ¶
GetThumbnail ...
func (*File) GetThumbnailBounds ¶
GetThumbnailBounds ...
type FileReader ¶
FileReader ...
type Folder ¶
type Folder struct { Root string `json:"root"` RelPath string `json:"rel_path"` Config FolderConfig `json:"config"` ConfigInherited bool `json:"config_inherited"` ConfigRootFolder string `json:"config_root"` CachedSubfolders []string `json:"cached_subfolders"` CachedFiles []*File `json:"cached_files"` }
Folder ...
func GetCachedFolder ¶
GetCachedFolder returns a cached Folder
func (*Folder) CacheSubfolder ¶
CacheSubfolder adds a subfolder to the list of cached subfolders
func (*Folder) EnsureAccess ¶
EnsureAccess returns an error if the access token doesn't permit access for the given access type
func (*Folder) EnsureReadAccess ¶
EnsureReadAccess returns an error if the access token doesn't permit read access
func (*Folder) EnsureWriteAccess ¶
EnsureWriteAccess returns an error if the access token doesn't permit write access
func (*Folder) GetAccessToken ¶
GetAccessToken returns an access token that permits access of the given access type
func (*Folder) GetMaxUploadSizeMB ¶
GetMaxUploadSizeMB returns the maximum allowed upload size in MBs
func (*Folder) GetPasswordHash ¶
GetPasswordHash returns the password hash of the given access type
func (*Folder) GetSubfolders ¶
GetSubfolders returns the subfolders
func (*Folder) SetPassword ¶
SetPassword sets the password for the given access type
func (*Folder) SetPasswords ¶
SetPasswords generates a random salt and sets and read and write passwords
func (*Folder) SetReadPassword ¶
SetReadPassword sets the read password
func (*Folder) SetWritePassword ¶
SetWritePassword sets the write password
func (*Folder) TestPassword ¶
TestPassword returns true if the given password matches the password for the given access type
func (*Folder) TestReadPassword ¶
TestReadPassword returns true if the given password matches the read password
func (*Folder) TestWritePassword ¶
TestWritePassword returns true if the given password matches the write password
func (*Folder) UncacheFile ¶
UncacheFile removes a file from the list of cached files
func (*Folder) UncacheSubfolder ¶
UncacheSubfolder removes a subfolder from the list of cached subfolders
type FolderConfig ¶
type FolderConfig struct { Salt string `json:"salt"` ReadPassword string `json:"read_pw"` WritePassword string `json:"write_pw"` MaxFileSizeMB int64 `json:"max_file_size"` MaxFolderSizeMB int64 `json:"max_folder_size"` Subfolders bool `json:"subfolders"` }
FolderConfig stores the folder's passwords and other congfiguration