webapp

package
v0.0.0-...-89b6d9c Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2022 License: GPL-3.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, db db.DB, r *redis.Client, fMod *fedi.Fedi, lMod *language.Module, t *token.Tokenizer, mc metrics.Collector) (web.Module, error)

New returns a new webapp module

Types

type ErrorPageTemplate

type ErrorPageTemplate struct {
	template.Common

	BotImage    string
	Header      string
	SubHeader   string
	Paragraph   string
	ButtonHRef  string
	ButtonLabel string
}

ErrorPageTemplate contains the variables for the "error" template.

type Module

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

Module contains a webapp module for the web server. Implements web.Module

func (*Module) CallbackOauthGetHandler

func (m *Module) CallbackOauthGetHandler(w http.ResponseWriter, r *http.Request)

CallbackOauthGetHandler handles an oauth callback

func (*Module) HomeGetHandler

func (m *Module) HomeGetHandler(w http.ResponseWriter, r *http.Request)

HomeGetHandler serves the home page

func (*Module) LoginGetHandler

func (m *Module) LoginGetHandler(w http.ResponseWriter, r *http.Request)

LoginGetHandler serves the login page

func (*Module) LoginPostHandler

func (m *Module) LoginPostHandler(w http.ResponseWriter, r *http.Request)

LoginPostHandler attempts a login

func (*Module) LogoutGetHandler

func (m *Module) LogoutGetHandler(w http.ResponseWriter, r *http.Request)

LogoutGetHandler logs a account out

func (*Module) Middleware

func (m *Module) Middleware(next http.Handler) http.Handler

Middleware runs on every http request

func (*Module) MiddlewareRequireAuth

func (m *Module) MiddlewareRequireAuth(next http.Handler) http.Handler

MiddlewareRequireAuth will redirect a account to login page if account not in context

func (*Module) Name

func (m *Module) Name() string

Name return the module name

func (*Module) Route

func (m *Module) Route(s web.Server) error

Route attaches routes to the web server

type ResponseWriterX

type ResponseWriterX struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

ResponseWriterX is a ResponseWriter that keeps track of status and body size

func (*ResponseWriterX) Write

func (r *ResponseWriterX) Write(b []byte) (int, error)

Write to the response writer, also updating body length

func (*ResponseWriterX) WriteHeader

func (r *ResponseWriterX) WriteHeader(status int)

WriteHeader sets the status of the response

Jump to

Keyboard shortcuts

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