Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
ListenAddr, URL, TOTP, FilesPath string
LeaderboardLimit int
Log *log.Log
Debug bool
DB *database.DB
}
Config contains all the necessary config options to start and serve a web UI.
type Handlers ¶
type Handlers struct {
// contains filtered or unexported fields
}
Handlers contains all the http.HandlerFuncs that serve the web UI's routes.
func (*Handlers) Home ¶
func (h *Handlers) Home(w http.ResponseWriter, r *http.Request)
Home redirects to the leaderboard view.
func (*Handlers) Leaderboard ¶
func (h *Handlers) Leaderboard(w http.ResponseWriter, r *http.Request)
Leaderboard serves the leaderboard view.
func (*Handlers) MustAuth ¶
func (h *Handlers) MustAuth(next http.HandlerFunc) http.HandlerFunc
MustAuth wraps an http.HandlerFunc and ensures that the user is authenticated before the said HandlerFunc is executed. The user is redirected to a "session expired" page if they are not authenticated.
type Provider ¶
type Provider struct { Config *Config // contains filtered or unexported fields }
A Provider provides a UI service that can be attached to karmabot.
func New ¶
New returns a new instance the web UI provider. It also generates a TOTP token and quits if one is not passed.
Click to show internal directories.
Click to hide internal directories.