webapp

package
v0.0.0-...-5767ed4 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: GPL-3.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// COAnonymous is an anonymous cross origin.
	COAnonymous = "anonymous"

	// DirStatic is the location of static assets.
	DirStatic = "static"
)
View Source
const SessionMaxAge = 30 * 24 * time.Hour // 30 days

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

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

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

func New

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

New returns a new webapp module.

func (*Module) AdminFediAccountsGetHandler

func (m *Module) AdminFediAccountsGetHandler(w nethttp.ResponseWriter, r *nethttp.Request)

AdminFediAccountsGetHandler serves the admin client page.

func (*Module) AdminFediGetHandler

func (m *Module) AdminFediGetHandler(w nethttp.ResponseWriter, r *nethttp.Request)

AdminFediGetHandler serves the admin fediverse page.

func (*Module) AdminFediInstancesGetHandler

func (m *Module) AdminFediInstancesGetHandler(w nethttp.ResponseWriter, r *nethttp.Request)

AdminFediInstancesGetHandler serves the admin client page.

func (*Module) CallbackOauthGetHandler

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

CallbackOauthGetHandler handles an oauth callback.

func (*Module) HomeGetHandler

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

HomeGetHandler serves the home page.

func (*Module) LoginGetHandler

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

LoginGetHandler serves the login page.

func (*Module) LoginPostHandler

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

LoginPostHandler attempts a login.

func (*Module) LogoutGetHandler

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

LogoutGetHandler logs a user out.

func (*Module) Middleware

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

Middleware runs on every http request.

func (*Module) MiddlewareRequireAdmin

func (m *Module) MiddlewareRequireAdmin(next nethttp.Handler) nethttp.Handler

MiddlewareRequireAdmin will redirect a user to login page if user not in context and will return unauthorized for a non admin user.

func (*Module) Name

func (*Module) Name() string

Name return the module name.

func (*Module) Route

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

Route attaches routes to the web server.

func (*Module) SetServer

func (m *Module) SetServer(s *http.Server)

SetServer adds a reference to the server to the module.

func (*Module) WrapInMiddlewares

func (m *Module) WrapInMiddlewares(h http.Handler) http.Handler

Jump to

Keyboard shortcuts

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