Documentation
¶
Index ¶
- Constants
- 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) CallbackOauthGetHandler(w nethttp.ResponseWriter, r *nethttp.Request)
- func (m *Module) HomeGetHandler(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) Route(s *http.Server) error
- func (m *Module) SetServer(s *http.Server)
- func (m *Module) WrapInMiddlewares(h http.Handler) http.Handler
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 ¶
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.
Click to show internal directories.
Click to hide internal directories.