controller

package
v3.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2023 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cover

func Cover(c *fiber.Ctx, homeDir, libraryPath string, metadataReaders map[string]metadata.Reader, coverMaxWidth int, idx IdxReader) error

func Delete added in v3.3.0

func Delete(c *fiber.Ctx, libraryPath string, writer IdxWriter, appFs afero.Fs) error

func DocReader

func DocReader(c *fiber.Ctx, libraryPath string, idx IdxReader) error

func Document added in v3.4.0

func Document(c *fiber.Ctx, libraryPath string, sender Sender, idx IdxReader, wordsPerMinute float64) error

func Download

func Download(c *fiber.Ctx, homeDir, libraryPath string, idx IdxReader) error

func Root

func Root(c *fiber.Ctx) error
func Search(c *fiber.Ctx, idx IdxReader, sender Sender, wordsPerMinute float64) error

func Send

func Send(c *fiber.Ctx, libraryPath string, sender Sender, idx IdxReader) error

Types

type Auth

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

func NewAuth

func NewAuth(repository authRepository, sender recoveryEmail, cfg AuthConfig, printers map[string]*message.Printer) *Auth

func (*Auth) EditPassword

func (a *Auth) EditPassword(c *fiber.Ctx) error

func (*Auth) Login

func (a *Auth) Login(c *fiber.Ctx) error

func (*Auth) Recover

func (a *Auth) Recover(c *fiber.Ctx) error

func (*Auth) Request

func (a *Auth) Request(c *fiber.Ctx) error

func (*Auth) SignIn

func (a *Auth) SignIn(c *fiber.Ctx) error

Signs in a user and gives them a JWT.

func (*Auth) SignOut

func (a *Auth) SignOut(c *fiber.Ctx) error

Logs out user and removes their JWT.

func (*Auth) UpdatePassword

func (a *Auth) UpdatePassword(c *fiber.Ctx) error

type AuthConfig

type AuthConfig struct {
	Secret            []byte
	MinPasswordLength int
	Hostname          string
	Port              int
	SessionTimeout    time.Duration
}

type IdxReader added in v3.3.0

type IdxReader interface {
	Search(keywords string, page, resultsPerPage int) (*index.PaginatedResult, error)
	Count() (uint64, error)
	Close() error
	Document(ID string) (index.Document, error)
	SameSubjects(slug string, quantity int) ([]index.Document, error)
	SameAuthors(slug string, quantity int) ([]index.Document, error)
	SameSeries(slug string, quantity int) ([]index.Document, error)
}

IdxReader defines a set of reading operations over an index

type IdxWriter added in v3.3.0

type IdxWriter interface {
	Document(ID string) (index.Document, error)
	RemoveFile(file string) error
}

type Page

type Page struct {
	Link      string
	IsCurrent bool
}

Page holds the URL of a results page, and if that page is the current one being shown

type PagesNavigator

type PagesNavigator struct {
	Pages        map[int]Page
	PreviousLink string
	NextLink     string
}

PagesNavigator contains all pages links, as well as links to the previous and next pages from the current one

type Sender

type Sender interface {
	SendDocument(address string, libraryPath string, fileName string) error
	From() string
}

type Users

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

func NewUsers

func NewUsers(repository usersRepository, usersCfg UsersConfig) *Users

NewUsers returns a new instance of the users controller

func (*Users) Create

func (u *Users) Create(c *fiber.Ctx) error

Create gathers information coming from the new user form and creates a new user

func (*Users) Delete

func (u *Users) Delete(c *fiber.Ctx) error

Delete soft-removes a user from the database

func (*Users) Edit

func (u *Users) Edit(c *fiber.Ctx) error

Edit renders the edit user form

func (*Users) List

func (u *Users) List(c *fiber.Ctx) error

List list all users registered in the database

func (*Users) New

func (u *Users) New(c *fiber.Ctx) error

New renders the new user form

func (*Users) Update

func (u *Users) Update(c *fiber.Ctx) error

Update gathers information from the edit user form and updates user data

type UsersConfig added in v3.1.1

type UsersConfig struct {
	MinPasswordLength int
	WordsPerMinute    float64
}

Jump to

Keyboard shortcuts

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