Versions in this module Expand all Collapse all v1 v1.3.5 Dec 6, 2024 v1.3.4 Mar 15, 2024 v1.3.3 Jan 26, 2024 v1.3.2 Oct 13, 2023 v1.3.1 Oct 13, 2023 v1.3.0 Feb 21, 2023 Changes in this version type Service + func (s Service) DeleteHash(ctx context.Context, namespace, hash string) (bool, error) v1.2.1 Jan 31, 2023 v1.2.0 Feb 18, 2022 Changes in this version + var ErrInvalidMimeType = errors.New("invalid mime type") type Config + MimeTypes []string type VFS + func (v VFS) IsValidMimeType(mType string) bool v1.1.0 Aug 3, 2021 Changes in this version + const AtomTime + const DefaultHashExtension + const DefaultNamespace + const NamespacePublic + var ErrInternal = httpAsRpcError(http.StatusInternalServerError) + var ErrInvalidExtension = errors.New("invalid extension") + var ErrInvalidInput = zenrpc.NewStringError(http.StatusBadRequest, "invalid user input") + var ErrInvalidNamespace = errors.New("invalid namespace") + var ErrInvalidSort = zenrpc.NewStringError(http.StatusBadRequest, "invalid sort field") + var ErrNotFound = httpAsRpcError(http.StatusNotFound) + var RPC = struct{ ... } + func InternalError(err error) *zenrpc.Error + type Config struct + Database *pg.Options + Extensions []string + MaxFileSize int64 + Namespaces []string + Path string + PreviewPath string + SaltedFilenames bool + SkipFolderVerify bool + UploadFormName string + WebPath string + type File struct + Date string + Extension string + Height *int + ID int + Name string + Params FileParams + Path string + PreviewPath string + RelPath string + Shortpath string + Size int + SizeH []string + Type string + Width *int + func NewFile(in *db.VfsFile, webpath, previewpath string) *File + type FileHash struct + Ext string + Hash string + func NewFileHash(hash, ext string) FileHash + func (h FileHash) Dir() string + func (h FileHash) File() string + type FileParams struct + Height int + Width int + type Folder struct + Folders []Folder + ID int + Name string + ParentID *int + func NewFolder(in *db.VfsFolder) *Folder + func NewFullFolder(in *db.VfsFolder, childFolders []db.VfsFolder) *Folder + type HashIndexer struct + func NewHashIndexer(dbc db.DB, repo *db.VfsRepo, vfs VFS, totalWorkers int) *HashIndexer + func (hi HashIndexer) IndexFile(ns, relFilepath string) (HashInfo, error) + func (hi HashIndexer) Preview() http.HandlerFunc + func (hi HashIndexer) ProcessQueue(ctx context.Context) error + func (hi HashIndexer) ScanFiles(ctx context.Context) (r ScanResults, err error) + func (hi HashIndexer) ScanFilesHandler(w http.ResponseWriter, _ *http.Request) + func (hi HashIndexer) Start() + func (hi HashIndexer) Stop() + type HashInfo struct + BlurHash string + Extension string + FileSize int64 + Hash string + Height int + Width int + type HelpUploadItem struct + Params []string + URL string + type HelpUploadResponse struct + Queue HelpUploadItem + Temp HelpUploadItem + type ScanFilesResponse struct + Error string + type ScanResults struct + Added uint64 + Duration time.Duration + Scanned uint64 + type Service struct + func NewService(repo db.VfsRepo, vfs VFS, dbc *pg.DB) Service + func (Service) SMD() smd.ServiceInfo + func (s Service) CountFiles(ctx context.Context, folderId int, query *string) (int, error) + func (s Service) CreateFolder(ctx context.Context, rootFolderId int, name string) (bool, error) + func (s Service) DeleteFiles(ctx context.Context, fileIds []int64) (bool, error) + func (s Service) DeleteFolder(ctx context.Context, folderId int) (bool, error) + func (s Service) GetFavorites(ctx context.Context) ([]Folder, error) + func (s Service) GetFiles(ctx context.Context, folderId int, query *string, sortField string, ...) ([]File, error) + func (s Service) GetFolder(ctx context.Context, rootFolderId int) (*Folder, error) + func (s Service) GetFolderBranch(ctx context.Context, folderId int) ([]Folder, error) + func (s Service) HelpUpload() HelpUploadResponse + func (s Service) Invoke(ctx context.Context, method string, params json.RawMessage) zenrpc.Response + func (s Service) ManageFavorites(ctx context.Context, folderId int, isInFavorites bool) (bool, error) + func (s Service) MoveFiles(ctx context.Context, fileIds []int64, destinationFolderId int) (bool, error) + func (s Service) MoveFolder(ctx context.Context, folderId, destinationFolderId int) (bool, error) + func (s Service) RenameFolder(ctx context.Context, folderId int, name string) (bool, error) + func (s Service) SearchFolderByFile(ctx context.Context, filename string) (*Folder, error) + func (s Service) SearchFolderByFileId(ctx context.Context, fileId int) (*Folder, error) + func (s Service) SetFilePhysicalName(ctx context.Context, fileId int, name string) (bool, error) + func (s Service) UrlByHash(ctx context.Context, hash, namespace, mediaType string) (string, error) + func (s Service) UrlByHashList(ctx context.Context, hashList []string, namespace, mediaType string) ([]UrlByHashListResponse, error) + type UploadResponse struct + Code int + Error string + Extension string + FileID int + Hash string + Name string + Size int64 + WebPath string + type UrlByHashListResponse struct + Hash string + WebPath string + type VFS struct + func New(cfg Config) (VFS, error) + func (v VFS) FullDir(ns string, h FileHash) string + func (v VFS) FullFile(ns string, h FileHash) string + func (v VFS) HashUpload(r io.Reader, ns, ext string) (*FileHash, error) + func (v VFS) HashUploadHandler(repo *db.VfsRepo) http.HandlerFunc + func (v VFS) IsValidExtension(ext string) bool + func (v VFS) IsValidNamespace(ns string) bool + func (v VFS) Move(ns, currentPath, newPath string) error + func (v VFS) Path(ns, path string) string + func (v VFS) PreviewPath(ns string) string + func (v VFS) Upload(r io.Reader, relFilename, ns string) error + func (v VFS) UploadHandler(repo db.VfsRepo) http.HandlerFunc + func (v VFS) WebHashPath(ns string, h FileHash) string + func (v VFS) WebHashPathWithType(ns, fType string, h FileHash) string + func (v VFS) WebPath(ns string) string