http

package
v0.0.0-...-6ab7fdd Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenExpirationTime = time.Hour * 2
)
View Source
const (
	WSWriteDeadline = 10 * time.Second
)

Variables

View Source
var (
	NonModifiableFieldsForNonAdmin = []string{"Username", "Scope", "LockPassword", "Perm", "Commands", "Rules"}
)

Functions

func NewHandler

func NewHandler(
	imgSvc ImgService,
	fileCache FileCache,
	store *storage.Storage,
	server *settings.Server,
	assetsFs fs.FS,
) (http.Handler, error)

func PreviewSizeNames

func PreviewSizeNames() []string

PreviewSizeNames returns a list of possible string values of PreviewSize.

Types

type DiskUsageResponse

type DiskUsageResponse struct {
	Total uint64 `json:"total"`
	Used  uint64 `json:"used"`
}

type FileCache

type FileCache interface {
	Store(ctx context.Context, key string, value []byte) error
	Load(ctx context.Context, key string) ([]byte, bool, error)
	Delete(ctx context.Context, key string) error
}

type ImgService

type ImgService interface {
	FormatFromExtension(ext string) (img.Format, error)
	Resize(ctx context.Context, in io.Reader, width, height int, out io.Writer, options ...img.Option) error
}

type PreviewSize

type PreviewSize int

ENUM( thumb big )

const (
	// PreviewSizeThumb is a PreviewSize of type Thumb
	PreviewSizeThumb PreviewSize = iota
	// PreviewSizeBig is a PreviewSize of type Big
	PreviewSizeBig
)

func ParsePreviewSize

func ParsePreviewSize(name string) (PreviewSize, error)

ParsePreviewSize attempts to convert a string to a PreviewSize

func (PreviewSize) MarshalText

func (x PreviewSize) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method

func (*PreviewSize) Scan

func (x *PreviewSize) Scan(value interface{}) error

Scan implements the Scanner interface.

func (PreviewSize) String

func (x PreviewSize) String() string

String implements the Stringer interface.

func (*PreviewSize) UnmarshalText

func (x *PreviewSize) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method

func (PreviewSize) Value

func (x PreviewSize) Value() (driver.Value, error)

Value implements the driver Valuer interface.

Jump to

Keyboard shortcuts

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