handlers

package
v0.0.0-...-51a7bb6 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func About

func About(env *Env, w http.ResponseWriter, r *http.Request) error

About gives some background information about the game (in fiction).

func AccessDenied

func AccessDenied(env *Env, w http.ResponseWriter, r *http.Request) error

AccessDenied is the page visitors see when they try to access they shouldn't

func Blog

func Blog(env *Env, w http.ResponseWriter, r *http.Request) error

Blog displays the most recent posts.

func BlogPost

func BlogPost(env *Env, w http.ResponseWriter, r *http.Request) error

BlogPost display a single post.

func Error404

func Error404(env *Env, w http.ResponseWriter, r *http.Request) error

Error404 is a directly accessible 404 page (via /404)

func Index

func Index(env *Env, w http.ResponseWriter, r *http.Request) error

Index is the homepage of the game. Prints a very simple page asking only for a team code.

func Leaderboard

func Leaderboard(env *Env, w http.ResponseWriter, r *http.Request) error

Leaderboard shows players who is currently in the lead. The leaderboard is with respect to the first game and the ARG. Alternatively, this could be a list of completed quests.

func Login

func Login(env *Env, w http.ResponseWriter, r *http.Request) error

Login handles user logins

func Logout

func Logout(env *Env, w http.ResponseWriter, r *http.Request) error

Logout destroys the user session

func Map

func Map(env *Env, w http.ResponseWriter, r *http.Request) error

Map shows locations of interest for the public and for players

func NotFound

func NotFound(w http.ResponseWriter, r *http.Request)

NotFound is the 404 handlers.

func Privacy

func Privacy(env *Env, w http.ResponseWriter, r *http.Request) error

Privacy shows the Privacy and Terms required to use the website.

func Register

func Register(env *Env, w http.ResponseWriter, r *http.Request) error

Register creates a new user

func RenderAdmin

func RenderAdmin(w http.ResponseWriter, data map[string]interface{}, patterns ...string) error

TODO: Abstract this out so it is automatic

func SuggestName

func SuggestName(env *Env, w http.ResponseWriter, r *http.Request) error

Suggestname suggests a new name

Types

type Env

type Env struct {
	Session sessions.Store
	DB      gorm.DB
	Data    map[string]interface{}
}

Env is the shared game manager for each request.

type Error

type Error interface {
	error
	Status() int
}

Error represents a handler error. It provides methods for a HTTP status code and embeds the built-in error interface.

type HandleAdmin

type HandleAdmin struct {
	Env *Env
	H   func(e *Env, w http.ResponseWriter, r *http.Request) error
}

HandleAdmin takes both a game manager and http function.

func (HandleAdmin) ServeHTTP

func (h HandleAdmin) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HandlePublic

type HandlePublic struct {
	Env *Env
	H   func(e *Env, w http.ResponseWriter, r *http.Request) error
}

HandlePublic takes both a game manager and http function.

func (HandlePublic) ServeHTTP

func (h HandlePublic) ServeHTTP(w http.ResponseWriter, r *http.Request)

type StatusError

type StatusError struct {
	Code int
	Err  error
}

StatusError represents an error with an associated HTTP status code.

func (StatusError) Error

func (se StatusError) Error() string

Allows StatusError to satisfy the error interface.

func (StatusError) Status

func (se StatusError) Status() int

Status returns our HTTP status code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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