fileserver

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: AGPL-3.0 Imports: 11 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"
)

Variables

This section is empty.

Functions

func New

func New(config *config.Config, processor processing.Processor) api.ClientModule

New returns a new fileServer module

Types

type FileServer

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

FileServer implements the RESTAPIModule interface. The goal here is to serve requested media files if the gotosocial server is configured to use local storage.

func (*FileServer) Route

func (m *FileServer) Route(s router.Router) error

Route satisfies the RESTAPIModule interface

func (*FileServer) ServeFile

func (m *FileServer) 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