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,12 +19,18 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
ginGzip "github.com/gin-contrib/gzip"
|
||||
"github.com/gin-contrib/gzip"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// Gzip returns a gzip gin middleware using default compression.
|
||||
func Gzip() gin.HandlerFunc {
|
||||
// todo: make this configurable
|
||||
return ginGzip.Gzip(ginGzip.DefaultCompression)
|
||||
const enabled = true
|
||||
|
||||
if !enabled {
|
||||
// use noop middleware if gzip is disabled
|
||||
return func(ctx *gin.Context) {}
|
||||
}
|
||||
|
||||
return gzip.Gzip(gzip.DefaultCompression)
|
||||
}
|
||||
|
Reference in New Issue
Block a user