web

package
v0.0.0-...-39504b8 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2017 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AskLoginRoute

func AskLoginRoute(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

AskLoginRoute serves login.gohtml

func CallbackRoute

func CallbackRoute(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

CallbackRoute handles return from Discord login

func EditSoundPostRoute

func EditSoundPostRoute(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func EditSoundRoute

func EditSoundRoute(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func GetDiscordSession

func GetDiscordSession(token string) *discordgo.Session

GetDiscordSession connects to the API using a session token

func HomeRoute

func HomeRoute(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

HomeRoute serves home.gohtml

func InitSessions

func InitSessions(cfg service.Cfg)

func IsDiscordAdmin

func IsDiscordAdmin(session *discordgo.Session, guildID string) (bool, error)

func LoadTemplates

func LoadTemplates(templatesPath string)

LoadTemplates from the specified templatesPath

func LoginRoute

func LoginRoute(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

LoginRoute handles login to Discord

func ManageGuildRoute

func ManageGuildRoute(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

ManageGuildRoute serves manage.gohtml

func ManageRoute

func ManageRoute(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

ManageRoute serves manage.gohtml

Types

type TemplateContext

type TemplateContext struct {
	NoRedis      bool
	SiteURL      string
	StatsCounter service.CountUpdate
}

TemplateContext data is used in every templates

type TemplateData

type TemplateData struct {
	Context TemplateContext
	Data    interface{}
}

TemplateData is used to store data to use in a template

Jump to

Keyboard shortcuts

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