Documentation ¶
Index ¶
- func CleanUp(periodic bool)
- func DeleteAllEncrypted()
- func DeleteFile(keyId string, deleteSource bool) bool
- func FileExists(file models.File, dataDir string) bool
- func GetFile(id string) (models.File, bool)
- func GetFileByHotlink(id string) (models.File, bool)
- func IsExpiredFile(file models.File, timeNow int64) bool
- func NewFile(fileContent io.Reader, fileHeader *multipart.FileHeader, ...) (models.File, error)
- func RequiresClientDecryption(file models.File) bool
- func ServeFile(file models.File, w http.ResponseWriter, r *http.Request, forceDownload bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanUp ¶
func CleanUp(periodic bool)
CleanUp removes expired files from the config and from the filesystem if they are not referenced by other files anymore Will be called periodically or after a file has been manually deleted in the admin view. If parameter periodic is true, this function is recursive and calls itself every hour.
func DeleteAllEncrypted ¶
func DeleteAllEncrypted()
DeleteAllEncrypted marks all encrypted files for deletion on next cleanup
func DeleteFile ¶
DeleteFile is called when an admin requests deletion of a file Returns true if file was deleted or false if ID did not exist
func FileExists ¶
FileExists checks if the file exists locally or in S3
func GetFile ¶
GetFile gets the file by id. Returns (empty File, false) if invalid / expired file or (file, true) if valid file
func GetFileByHotlink ¶
GetFileByHotlink gets the file by hotlink id. Returns (empty File, false) if invalid / expired file or (file, true) if valid file
func IsExpiredFile ¶
IsExpiredFile returns true if the file is expired, either due to download count or if the provided timestamp is after the expiry timestamp
func NewFile ¶
func NewFile(fileContent io.Reader, fileHeader *multipart.FileHeader, uploadRequest models.UploadRequest) (models.File, error)
NewFile creates a new file in the system. Called after an upload has been completed. If a file with the same sha256 hash already exists, it is deduplicated. This function gathers information about the file, creates an ID and saves it into the global configuration.
func RequiresClientDecryption ¶
RequiresClientDecryption checks if the file needs to be decrypted by the client (if remote storage or end-to-end encryption)
Types ¶
This section is empty.