webapp

package
v0.0.0-...-e647751 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: 48 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DirStatic is the location of static assets.
	DirStatic = "static"

	// FormClientID is the key for a client-id form field.
	FormClientID = "client-id"
	// FormDescription is the key for a description form field.
	FormDescription = "description"
	// FormRedirectURI is the key for a redirect uri form field.
	FormRedirectURI = "redirect-uri"
	// FormToken is the key for a token form field.
	FormToken = "token"

	// XOriginAnonymous is a an cross-origin value for anonymous.
	XOriginAnonymous = "anonymous"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorPageTemplate

type ErrorPageTemplate struct {
	template.Common

	Header      string
	Image       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 New

func New(ctx context.Context, d db.DB, r *redis.Client, f *fedi.Fedi, lMod *language.Module, oauthServer *oauth.Server, 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) AdminOauthClientAddGetHandler

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

AdminOauthClientAddGetHandler serves the admin add client page.

func (*Module) AdminOauthClientAddPostHandler

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

AdminOauthClientAddPostHandler handles the admin add client form.

func (*Module) AdminOauthClientsGetHandler

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

AdminOauthClientsGetHandler serves the admin client page.

func (*Module) AdminOauthGetHandler

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

AdminOauthGetHandler serves the admin oauth page.

func (*Module) AdminSystemApplicationTokenAddGetHandler

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

AdminSystemApplicationTokenAddGetHandler serves the admin add application token page.

func (*Module) AdminSystemApplicationTokenAddPostHandler

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

AdminSystemApplicationTokenAddPostHandler handles the admin add client form.

func (*Module) AdminSystemApplicationTokensGetHandler

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

AdminSystemApplicationTokensGetHandler serves the admin client page.

func (*Module) AdminSystemGetHandler

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

AdminSystemGetHandler serves the admin system page.

func (*Module) CallbackOauthGetHandler

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

CallbackOauthGetHandler handles an oauth callback.

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) OauthAuthorizeGetHandler

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

OauthAuthorizeGetHandler handles oauth authorization.

func (*Module) OauthTokenHandler

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

OauthTokenHandler handles oauth tokens.

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.

Jump to

Keyboard shortcuts

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