mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[chore] shuffle middleware to split rate limitting into client/s2s/fileserver, share gzip middleware globally (#1290)
Signed-off-by: kim <grufwub@gmail.com> Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
@ -19,6 +19,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/api/fileserver"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/middleware"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/processing"
|
||||
@ -29,12 +30,12 @@ type Fileserver struct {
|
||||
fileserver *fileserver.Module
|
||||
}
|
||||
|
||||
func (f *Fileserver) Route(r router.Router) {
|
||||
func (f *Fileserver) Route(r router.Router, m ...gin.HandlerFunc) {
|
||||
fileserverGroup := r.AttachGroup("fileserver")
|
||||
|
||||
// attach middlewares appropriate for this group
|
||||
fileserverGroup.Use(m...)
|
||||
fileserverGroup.Use(
|
||||
middleware.RateLimit(),
|
||||
// Since we'll never host different files at the same
|
||||
// URL (bc the ULIDs are generated per piece of media),
|
||||
// it's sensible and safe to use a long cache here, so
|
||||
|
Reference in New Issue
Block a user