Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Download ¶
func Download( w http.ResponseWriter, req *http.Request, origin spec.ServerName, mediaID types.MediaID, cfg *config.MediaAPI, db storage.Database, client *fclient.Client, activeRemoteRequests *types.ActiveRemoteRequests, activeThumbnailGeneration *types.ActiveThumbnailGeneration, isThumbnailRequest bool, customFilename string, )
Download implements GET /download and GET /thumbnail Files from this server (i.e. origin == cfg.ServerName) are served directly Files from remote servers (i.e. origin != cfg.ServerName) are cached locally. If they are present in the cache, they are served directly. If they are not present in the cache, they are obtained from the remote server and simultaneously served back to the client and written into the cache.
func Setup ¶
func Setup( publicAPIMux *mux.Router, cfg *config.Dendrite, db storage.Database, userAPI userapi.MediaUserAPI, client *fclient.Client, )
Setup registers the media API HTTP handlers
Due to Setup being used to call many other functions, a gocyclo nolint is applied: nolint: gocyclo
func Upload ¶
func Upload(req *http.Request, cfg *config.MediaAPI, dev *userapi.Device, db storage.Database, activeThumbnailGeneration *types.ActiveThumbnailGeneration) util.JSONResponse
Upload implements POST /upload This endpoint involves uploading potentially significant amounts of data to the homeserver. This implementation supports a configurable maximum file size limit in bytes. If a user tries to upload more than this, they will receive an error that their upload is too large. Uploaded files are processed piece-wise to avoid DoS attacks which would starve the server of memory. TODO: We should time out requests if they have not received any data within a configured timeout period.
Types ¶
This section is empty.