api

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: AGPL-3.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FilterUserAgent = config.GenFlag[bool]("behavior.user_agent_filter", true, "Filter user agent in API (block python requests from non-admins)")

Functions

This section is empty.

Types

type API

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

API is the base struct for the project's API

func New

func New(base *sudoapi.BaseAPI) *API

New declares a new API instance

func (*API) Handler

func (s *API) Handler() http.Handler

Handler is the magic behind the API

func (*API) MustBeAdmin

func (s *API) MustBeAdmin(next http.Handler) http.Handler

MustBeAdmin is middleware to make sure the user creating the request is an admin

func (*API) MustBeAuthed

func (s *API) MustBeAuthed(next http.Handler) http.Handler

MustBeAuthed is middleware to make sure the user creating the request is authenticated

func (*API) MustBeProposer

func (s *API) MustBeProposer(next http.Handler) http.Handler

MustBeProposer is middleware to make sure the user creating the request is a proposer

func (*API) MustBeVisitor

func (s *API) MustBeVisitor(next http.Handler) http.Handler

MustBeVisitor is middleware to make sure the user creating the request is not authenticated

func (*API) SetupSession

func (s *API) SetupSession(next http.Handler) http.Handler

SetupSession adds the user with the specified user ID to context

type Assets

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

func NewAssets

func NewAssets(base *sudoapi.BaseAPI) *Assets

func (*Assets) AssetsRouter

func (s *Assets) AssetsRouter() http.Handler

func (*Assets) ServeAttachment

func (s *Assets) ServeAttachment(w http.ResponseWriter, r *http.Request)

func (*Assets) ServeContestLeaderboard

func (s *Assets) ServeContestLeaderboard(w http.ResponseWriter, r *http.Request)

func (*Assets) ServeProblemArchive

func (s *Assets) ServeProblemArchive() http.HandlerFunc

func (*Assets) ServeSubtest

func (s *Assets) ServeSubtest(w http.ResponseWriter, r *http.Request)

func (*Assets) ServeTestInput

func (s *Assets) ServeTestInput(w http.ResponseWriter, r *http.Request)

func (*Assets) ServeTestOutput

func (s *Assets) ServeTestOutput(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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