Documentation ¶
Index ¶
- Constants
- type ErrorPageTemplate
- type Module
- func (m *Module) AdminFediAccountsGetHandler(w nethttp.ResponseWriter, r *nethttp.Request)
- func (m *Module) AdminFediGetHandler(w nethttp.ResponseWriter, r *nethttp.Request)
- func (m *Module) AdminFediInstancesGetHandler(w nethttp.ResponseWriter, r *nethttp.Request)
- func (m *Module) AdminOauthClientAddGetHandler(w nethttp.ResponseWriter, r *nethttp.Request)
- func (m *Module) AdminOauthClientAddPostHandler(w nethttp.ResponseWriter, r *nethttp.Request)
- func (m *Module) AdminOauthClientsGetHandler(w nethttp.ResponseWriter, r *nethttp.Request)
- func (m *Module) AdminOauthGetHandler(w nethttp.ResponseWriter, r *nethttp.Request)
- func (m *Module) AdminSystemApplicationTokenAddGetHandler(w nethttp.ResponseWriter, r *nethttp.Request)
- func (m *Module) AdminSystemApplicationTokenAddPostHandler(w nethttp.ResponseWriter, r *nethttp.Request)
- func (m *Module) AdminSystemApplicationTokensGetHandler(w nethttp.ResponseWriter, r *nethttp.Request)
- func (m *Module) AdminSystemGetHandler(w nethttp.ResponseWriter, r *nethttp.Request)
- func (m *Module) CallbackOauthGetHandler(w nethttp.ResponseWriter, r *nethttp.Request)
- func (m *Module) LoginGetHandler(w nethttp.ResponseWriter, r *nethttp.Request)
- func (m *Module) LoginPostHandler(w nethttp.ResponseWriter, r *nethttp.Request)
- func (m *Module) LogoutGetHandler(w nethttp.ResponseWriter, r *nethttp.Request)
- func (m *Module) Middleware(next nethttp.Handler) nethttp.Handler
- func (m *Module) MiddlewareRequireAdmin(next nethttp.Handler) nethttp.Handler
- func (*Module) Name() string
- func (m *Module) OauthAuthorizeGetHandler(w nethttp.ResponseWriter, r *nethttp.Request)
- func (m *Module) OauthTokenHandler(w nethttp.ResponseWriter, r *nethttp.Request)
- func (m *Module) Route(s *http.Server) error
- func (m *Module) SetServer(s *http.Server)
Constants ¶
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 ¶
Middleware runs on every http request.
func (*Module) MiddlewareRequireAdmin ¶
MiddlewareRequireAdmin will redirect a user to login page if user not in context and will return unauthorized for a non admin user.
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.