webserver

package
v3.13.4 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowIfNotLoggedIn added in v3.12.0

func AllowIfNotLoggedIn(jwtSecret []byte) func(*fiber.Ctx) error

AllowIfNotLoggedIn only allows processing the request if there is no session

func AlwaysRequireAuthentication added in v3.12.0

func AlwaysRequireAuthentication(jwtSecret []byte, sender Sender) func(*fiber.Ctx) error

AlwaysRequireAuthentication returns forbidden and renders the login page if the user trying to access has not logged in

func ConfigurableAuthentication added in v3.12.0

func ConfigurableAuthentication(jwtSecret []byte, sender Sender, requireAuth bool) func(*fiber.Ctx) error

ConfigurableAuthentication allows to enable or disable authentication on routes which may or may not require it

func New

func New(cfg Config, controllers Controllers, sender Sender, progress ProgressInfo) *fiber.App

New builds a new Fiber application and set up the required routes

func RequireAdmin added in v3.12.0

func RequireAdmin(c *fiber.Ctx) error

RequireAdmin returns HTTP forbidden if the user requesting access is not an admin

func SetFQDN added in v3.12.0

func SetFQDN(cfg Config) func(*fiber.Ctx) error

SetFQDN composes the Fully Qualified Domain Name of the host running the app and sets it as a local variable of the request

func SetProgress added in v3.12.0

func SetProgress(progress ProgressInfo) func(*fiber.Ctx) error

SetProgress retrieves indexing progress information from the index and sets it as a local variable of the request

Types

type Config

type Config struct {
	Version               string
	SessionTimeout        time.Duration
	MinPasswordLength     int
	WordsPerMinute        float64
	JwtSecret             []byte
	Hostname              string
	Port                  int
	HomeDir               string
	LibraryPath           string
	CoverMaxWidth         int
	RequireAuth           bool
	UploadDocumentMaxSize int
}

type Controllers added in v3.1.1

type Controllers struct {
	Auth       *auth.Controller
	Users      *user.Controller
	Highlights *highlight.Controller
	Documents  *document.Controller
}

func SetupControllers added in v3.1.1

func SetupControllers(cfg Config, db *gorm.DB, metadataReaders map[string]metadata.Reader, idx *index.BleveIndexer, sender Sender, appFs afero.Fs) Controllers

type ProgressInfo added in v3.12.0

type ProgressInfo interface {
	IndexingProgress() (index.Progress, error)
}

type Sender

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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