Documentation
¶
Index ¶
- Constants
- func ArchivePathFound(archivePath string) []model.Gallery
- func ConstructColumn(columnName string) Column
- func ConstructExpressions(model interface{}) ([]Expression, ColumnList, error)
- func CountAllImages(skipWithPageThumbnails bool) (int, int, error)
- func DeleteGallery(galleryUUID string) bool
- func DeleteSession(id string, userUUID string) error
- func DeleteUser(userUUID string) error
- func EnsureLatestVersion()
- func GetCategories() ([]string, error)
- func GetFavoriteGroups(userUUID string) ([]string, error)
- func GetGalleryCount(filters Filters, hidden bool, userUUID *string) (uint64, error)
- func GetOnlyLibraries() ([]model.Library, error)
- func GetReference(galleryUUID string) (model.Reference, error)
- func GetSeries() ([]string, error)
- func GetSessions(userUUID string) ([]model.Session, error)
- func GetUser(name string) ([]model.User, error)
- func GetUsers() ([]model.User, error)
- func InitDB()
- func IsLTR(galleryUUID string) (bool, error)
- func Login(username string, password string, role Role) (*string, *int32, error)
- func Logout(sessionUUID string, userUUID string) error
- func MetaPathFound(metaPath string, libraryPath string) bool
- func MigratePassword(username string, password string) error
- func NeedsUpdate(archivePath string, updatedAt time.Time) (bool, string)
- func NewGallery(archivePath string, libraryID int32, title string, series string, size int64, ...) (string, error)
- func NewGalleryPref(galleryUUID string, userUUID string) error
- func NewSession(userUUID string, expiresIn *int64, sessionName *string) (string, error)
- func NewTags(tags []model.Tag) ([]int32, error)
- func PruneExpiredSessions()
- func Register(username string, password string, role Role) error
- func SanitizeString(content *string) *string
- func SetFavoriteGroup(favoriteGroup string, galleryUUID string, userUUID string) error
- func SetPageThumbnails(uuid string, pageThumbnails int32) error
- func SetThumbnail(uuid string, thumbnail string) error
- func StorePaths(givenLibraries []config.Library) error
- func TitleHashMatch(galleryUUID string) bool
- func UpdateGallery(gallery model.Gallery, tags []model.Tag, reference model.Reference, ...) error
- func UpdateProgress(progress int32, galleryUUID string, userUUID string) error
- func UpdateUser(userUUID string, userForm *UserForm) error
- func ValidateGallery(gallery model.Gallery, newGallery model.Gallery, now time.Time) (model.Gallery, ColumnList)
- func ValidateGalleryInternal(newGallery model.Gallery, now time.Time) (model.Gallery, ColumnList)
- func ValidateReference(reference model.Reference) model.Reference
- func ValidateReferenceInternal(reference model.Reference) model.Reference
- func VerifySession(id string, userUUID string) bool
- type Categories
- type CombinedLibrary
- type CombinedMetadata
- type FavoriteGroups
- type Filters
- type MappedTags
- type Order
- type Role
- type SortBy
- type UserForm
Constants ¶
const ( Title SortBy = "title" TitleNative = "native" UpdatedAt = "updated" Progress = "progress" )
Variables ¶
This section is empty.
Functions ¶
func ArchivePathFound ¶
ArchivePathFound returns true if the given archive path is already in the database.
func ConstructColumn ¶ added in v0.8.0
func ConstructColumn(columnName string) Column
func ConstructExpressions ¶ added in v0.8.0
func ConstructExpressions(model interface{}) ([]Expression, ColumnList, error)
ConstructExpressions constructs expressions from a reference model.
func CountAllImages ¶ added in v0.7.0
func DeleteGallery ¶
DeleteGallery removes a gallery from the database (never actually deletes the archive file).
func DeleteSession ¶
DeleteSession removes a session based on the session ID and user UUID.
func DeleteUser ¶
DeleteUser removes user. Super admin users cannot be deleted.
func EnsureLatestVersion ¶
func EnsureLatestVersion()
EnsureLatestVersion ensures that the database is at the latest version by running all migrations.
func GetCategories ¶
GetCategories returns all public categories.
func GetFavoriteGroups ¶
GetFavoriteGroups returns user's favorite groups.
func GetGalleryCount ¶ added in v0.4.2
GetGalleryCount returns the number of galleries that match the given filters.
func GetOnlyLibraries ¶
func GetSessions ¶
GetSessions returns all sessions of a user.
func MetaPathFound ¶
MetaPathFound returns true if a gallery with the given meta path exists.
func MigratePassword ¶ added in v0.7.2
MigratePassword migrates password from bcrypt to argon2id with salt.
func NeedsUpdate ¶
NeedsUpdate returns true if the gallery needs to be updated. Currently only the timestamp is checked.
func NewGallery ¶
func NewGallery(archivePath string, libraryID int32, title string, series string, size int64, imageCount uint64) (string, error)
NewGallery creates a new gallery
func NewGalleryPref ¶
NewGalleryPref creates initializes user preferences for a gallery.
func NewSession ¶
NewSession creates a new session for a user.
func PruneExpiredSessions ¶ added in v0.4.3
func PruneExpiredSessions()
PruneExpiredSessions removes all expired sessions.
func SanitizeString ¶ added in v0.3.0
SanitizeString returns the pointer of the string with all leading and trailing white space removed. If the string is empty, it returns nil.
func SetFavoriteGroup ¶
SetFavoriteGroup sets a favorite group for a gallery.
func SetPageThumbnails ¶ added in v0.7.0
func SetThumbnail ¶
SetThumbnail saves the filename of the thumbnail for the gallery.
func StorePaths ¶
func TitleHashMatch ¶ added in v0.8.0
TitleHashMatch returns true if the title hash of the gallery matches the stored hash.
func UpdateGallery ¶
func UpdateGallery(gallery model.Gallery, tags []model.Tag, reference model.Reference, internalScan bool) error
UpdateGallery updates a gallery. It also adds tags and references if any. If internalScan is true, the gallery is matched by its archive path, not UUID.
func UpdateProgress ¶
UpdateProgress sets the reading progress of a gallery for a user.
func UpdateUser ¶
UpdateUser can be used to update role, password or username of users.
func ValidateGallery ¶ added in v0.3.0
func ValidateGallery(gallery model.Gallery, newGallery model.Gallery, now time.Time) (model.Gallery, ColumnList)
ValidateGallery returns updated and sanitized gallery model. For external API use.
func ValidateGalleryInternal ¶ added in v0.8.0
ValidateGalleryInternal returns updated and sanitized gallery model and column list. Non-empty and non-negative values are preferred. For internal scanner use.
func ValidateReference ¶ added in v0.3.0
ValidateReference returns updated and sanitized gallery reference. For external API use.
func ValidateReferenceInternal ¶ added in v0.8.0
ValidateReferenceInternal returns updated and sanitized gallery reference. Non-empty values are preferred. For internal scanner use.
func VerifySession ¶
VerifySession verifies a session by checking if it exists based on the session ID and user UUID.
Types ¶
type Categories ¶
type Categories struct {
Data []string `json:"Data"`
}
type CombinedLibrary ¶
func GetLibraries ¶
func GetLibraries() ([]CombinedLibrary, error)
type CombinedMetadata ¶
type CombinedMetadata struct { model.Gallery Tags []model.Tag Reference struct { ExhToken *string ExhGid *int32 Urls *string } `alias:"reference.*"` GalleryPref *struct { FavoriteGroup *string Progress int32 UpdatedAt string } `alias:"gallery_pref.*"` Library model.Library `json:"-"` }
func GetGalleries ¶
func GetGalleries(filters Filters, hidden bool, userUUID *string) ([]CombinedMetadata, uint64, error)
GetGalleries returns galleries based on the given filters.
func GetGallery ¶
func GetGallery(galleryUUID *string, userUUID *string, archivePath *string) (CombinedMetadata, error)
GetGallery returns a gallery based on the given UUID. If no UUID is given, a random gallery is returned.
type FavoriteGroups ¶
type FavoriteGroups struct {
Data []string `json:"Data"`
}