fileserver

package
v0.8.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AccountIDKey is the url key for account id (an account ulid)
	AccountIDKey = "account_id"
	// MediaTypeKey is the url key for media type (usually something like attachment or header etc)
	MediaTypeKey = "media_type"
	// MediaSizeKey is the url key for the desired media size--original/small/static
	MediaSizeKey = "media_size"
	// FileNameKey is the actual filename being sought. Will usually be a UUID then something like .jpeg
	FileNameKey = "file_name"
	// FileServePath is the fileserve path minus the 'fileserver' prefix.
	FileServePath = "/:" + AccountIDKey + "/:" + MediaTypeKey + "/:" + MediaSizeKey + "/:" + FileNameKey
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

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

func New

func New(processor *processing.Processor) *Module

func (*Module) Route

func (m *Module) Route(attachHandler func(method string, path string, f ...gin.HandlerFunc) gin.IRoutes)

func (*Module) ServeFile

func (m *Module) ServeFile(c *gin.Context)

ServeFile is for serving attachments, headers, and avatars to the requester from instance storage.

Note: to mitigate scraping attempts, no information should be given out on a bad request except "404 page not found". Don't give away account ids or media ids or anything like that; callers shouldn't be able to infer anything.

Jump to

Keyboard shortcuts

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