middleware

package
v0.0.0-...-df62f9d Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminOnly

func AdminOnly(ctx *gin.Context)

func AuthenticateCookie

func AuthenticateCookie(ctx *gin.Context)

func AuthenticateGuild

func AuthenticateGuild(requiredPermissionLevel permission.PermissionLevel) gin.HandlerFunc

requires AuthenticateCookie middleware to be run before

func AuthenticateToken

func AuthenticateToken(ctx *gin.Context)

func Cors

func Cors(config config.Config) func(*gin.Context)

func CreateRateLimiter

func CreateRateLimiter(rlType RateLimitType, max int, period time.Duration) gin.HandlerFunc

func ErrorHandler

func ErrorHandler(c *gin.Context)

func Logging

func Logging(logger *zap.Logger) gin.HandlerFunc

func MultiReadBody

func MultiReadBody(ctx *gin.Context)

func ParseGuildId

func ParseGuildId(ctx *gin.Context)

func ReadResponse

func ReadResponse(ctx *gin.Context)

func UpdateLastSeen

func UpdateLastSeen(req *gin.Context)

UpdateLastSeen We store the last time a user was seen in the dashboard so that we can delete their data if they haven't logged in for 30 days.

func VerifyWhitelabel

func VerifyWhitelabel(isApi bool) func(ctx *gin.Context)

func VerifyXTicketsHeader

func VerifyXTicketsHeader(ctx *gin.Context)

Types

type CustomWriter

type CustomWriter struct {
	gin.ResponseWriter
	// contains filtered or unexported fields
}

func NewCustomWriter

func NewCustomWriter(ctx *gin.Context) *CustomWriter

func (*CustomWriter) Read

func (w *CustomWriter) Read() []byte

func (CustomWriter) Write

func (w CustomWriter) Write(b []byte) (int, error)

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

type RateLimitType

type RateLimitType uint8
const (
	RateLimitTypeIp RateLimitType = iota
	RateLimitTypeUser
	RateLimitTypeGuild
)

Jump to

Keyboard shortcuts

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