Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                

api

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSRFMiddleware

func CSRFMiddleware(store sessions.Store) func(http.Handler) http.Handler

func MinifyCSS added in v1.3.0

func MinifyCSS(src string) string

func MinifyHTML added in v1.3.0

func MinifyHTML(src string) string

func MinifyJS added in v1.3.0

func MinifyJS(src string) string

func NewStaticServer added in v1.3.0

func NewStaticServer(staticFS fs.FS) (http.Handler, error)

func RateLimitMiddleware

func RateLimitMiddleware(valkeyClient *redis.Client, max int, duration time.Duration) func(http.Handler) http.Handler

func RequestIDMiddleware

func RequestIDMiddleware(next http.Handler) http.Handler

func RequestLoggerMiddleware

func RequestLoggerMiddleware(next http.Handler) http.Handler

func RequireAuth

func RequireAuth(store sessions.Store) func(http.Handler) http.Handler

func SecurityHeadersMiddleware

func SecurityHeadersMiddleware(env string) func(http.Handler) http.Handler

Types

type AdminHandlers

type AdminHandlers struct {
	Scheduler     *scheduler.Scheduler
	AdminPassword string
	DB            *pgxpool.Pool
	ReadDB        *pgxpool.Pool
	Valkey        *redis.Client
	Queue         *queue.Queue
}

func (*AdminHandlers) HealthCheck

func (h *AdminHandlers) HealthCheck(w http.ResponseWriter, r *http.Request)

func (*AdminHandlers) SyncAll

func (h *AdminHandlers) SyncAll(w http.ResponseWriter, r *http.Request)

func (*AdminHandlers) UpdateContests

func (h *AdminHandlers) UpdateContests(w http.ResponseWriter, r *http.Request)

type ContextKey

type ContextKey string
const (
	ContextKeyUserID    ContextKey = "user_id"
	ContextKeyRequestID ContextKey = "request_id"
)

type EarlyRateLimiter added in v1.4.9

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

func NewEarlyRateLimiter added in v1.4.9

func NewEarlyRateLimiter() *EarlyRateLimiter

func (*EarlyRateLimiter) Allow added in v1.4.9

func (el *EarlyRateLimiter) Allow(ip string, limit int64, duration time.Duration) bool

type Handlers

type Handlers struct {
	DB            *pgxpool.Pool
	ReadDB        *pgxpool.Pool
	SessionStore  sessions.Store
	AuthProvider  *auth.Provider
	EncryptionKey []byte
	Queue         *queue.Queue
	Valkey        *redis.Client
	Env           string
	CleanupWG     sync.WaitGroup
}

func (*Handlers) DeleteAccount

func (h *Handlers) DeleteAccount(w http.ResponseWriter, r *http.Request)

func (*Handlers) GetPlatforms

func (h *Handlers) GetPlatforms(w http.ResponseWriter, r *http.Request)

func (*Handlers) GoogleCallback

func (h *Handlers) GoogleCallback(w http.ResponseWriter, r *http.Request)

func (*Handlers) GoogleLogin

func (h *Handlers) GoogleLogin(w http.ResponseWriter, r *http.Request)

func (*Handlers) Logout added in v1.5.6

func (h *Handlers) Logout(w http.ResponseWriter, r *http.Request)

func (*Handlers) ManualSync

func (h *Handlers) ManualSync(w http.ResponseWriter, r *http.Request)

func (*Handlers) Me

func (h *Handlers) Me(w http.ResponseWriter, r *http.Request)

func (*Handlers) SavePreferences

func (h *Handlers) SavePreferences(w http.ResponseWriter, r *http.Request)

type MemoryFS added in v1.3.0

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

func (*MemoryFS) ServeHTTP added in v1.3.0

func (m *MemoryFS) ServeHTTP(w http.ResponseWriter, r *http.Request)

type StaticFile added in v1.3.0

type StaticFile struct {
	Content     []byte
	GzipContent []byte
	ContentType string
	ETag        string
}

type ValkeyStore

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

func NewValkeyStore

func NewValkeyStore(client *redis.Client, env string, keyPairs ...[]byte) *ValkeyStore

func (*ValkeyStore) Get

func (s *ValkeyStore) Get(r *http.Request, name string) (*sessions.Session, error)

func (*ValkeyStore) New

func (s *ValkeyStore) New(r *http.Request, name string) (*sessions.Session, error)

func (*ValkeyStore) Save

func (s *ValkeyStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error

type VelocityCounter added in v1.4.9

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

Jump to

Keyboard shortcuts

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