api

package
v1.5.8 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 35 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 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 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 StaticServer added in v1.5.8

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

func (*StaticServer) ServeHTTP added in v1.5.8

func (s *StaticServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

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

Jump to

Keyboard shortcuts

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