Documentation ¶
Index ¶
- Constants
- func ForwardTo(f string) func(w http.ResponseWriter, r *http.Request)
- func JSAdminInstanceView(...) string
- type ContextKey
- type Module
- func (m *Module) AdminAccountGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) AdminAutocompleteAccountGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) AdminHomeGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) AdminInstanceGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) AdminInstanceViewGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) AdminInstanceViewPostHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) CallbackOauthGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) HomeGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) LoginGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) LoginPostHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) LogoutGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) Middleware(next http.Handler) http.Handler
- func (m *Module) MiddlewareRequireAdmin(next http.Handler) http.Handler
- func (*Module) Name() string
- func (m *Module) Route(s *ihttp.Server) error
- func (m *Module) SetServer(s *ihttp.Server)
- func (m *Module) SettingsGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) WrapInMiddlewares(h http.Handler) http.Handler
- type SessionKey
Constants ¶
const ( // COAnonymous is an anonymous cross origin. COAnonymous = "anonymous" // ActionAddTeamMember is the value for an add team member action. ActionAddTeamMember = "add-team-member" // ActionDeleteTeamMember is the value for a delete team member action. ActionDeleteTeamMember = "delete-team-member" // ActionDisableS3CDN is the value for a disable s3 cdn team member action. ActionDisableS3CDN = "disable-s3-cdn" // ActionEnableS3CDN is the value for an enable s3 cdn team member action. ActionEnableS3CDN = "enable-s3-cdn" // ActionTransferOwnership is the value for a delete team member action. ActionTransferOwnership = "transfer-ownership" // FormAccount is the key for am account form field. FormAccount = "account" // FormAction is the key for an action form field. FormAction = "action" // FormToken is the key for a token form field. FormToken = "token" )
const SessionMaxAge = 30 * 24 * time.Hour // 30 days
Variables ¶
This section is empty.
Functions ¶
func ForwardTo ¶
func ForwardTo(f string) func(w http.ResponseWriter, r *http.Request)
ForwardTo creates a forwarder.
func JSAdminInstanceView ¶
func JSAdminInstanceView(deleteTitleText, deleteConfirmText, transferOwnershipTitleText, transferOwnershipConfirmText *language.LocalizedString) string
Types ¶
type ContextKey ¶
type ContextKey int
ContextKey is a key used in http request contexts.
const ( // ContextKeySession is the persistent session. ContextKeySession ContextKey = iota // ContextKeyLocalizer is the language localizer. ContextKeyLocalizer // ContextKeyLanguage is the language. ContextKeyLanguage // ContextKeyAccount is the logged in user's account. ContextKeyAccount // ContextKeyOauthNonce is the oauth nonce. ContextKeyOauthNonce )
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, lMod *language.Module, logicMod *logic.Logic, r redis.UniversalClient, tokz *token.Tokenizer, ) (*Module, error)
New returns a new webapp module.
func (*Module) AdminAccountGetHandler ¶
func (m *Module) AdminAccountGetHandler(w http.ResponseWriter, r *http.Request)
AdminAccountGetHandler serves the home page.
func (*Module) AdminAutocompleteAccountGetHandler ¶
func (m *Module) AdminAutocompleteAccountGetHandler(w http.ResponseWriter, r *http.Request)
AdminAutocompleteAccountGetHandler serves the home page.
func (*Module) AdminHomeGetHandler ¶
func (m *Module) AdminHomeGetHandler(w http.ResponseWriter, r *http.Request)
AdminHomeGetHandler serves the admin home page.
func (*Module) AdminInstanceGetHandler ¶
func (m *Module) AdminInstanceGetHandler(w http.ResponseWriter, r *http.Request)
AdminInstanceGetHandler serves the home page.
func (*Module) AdminInstanceViewGetHandler ¶
func (m *Module) AdminInstanceViewGetHandler(w http.ResponseWriter, r *http.Request)
AdminInstanceViewGetHandler serves the instance info page.
func (*Module) AdminInstanceViewPostHandler ¶
func (m *Module) AdminInstanceViewPostHandler(w http.ResponseWriter, r *http.Request)
AdminInstanceViewPostHandler serves the home page.
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 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) SettingsGetHandler ¶
func (m *Module) SettingsGetHandler(w http.ResponseWriter, r *http.Request)
SettingsGetHandler serves the home page.
type SessionKey ¶
type SessionKey int
SessionKey is a key used for storing data in a web session.
const ( // SessionKeyAccountID contains the id of the currently logged-in user. SessionKeyAccountID SessionKey = iota // SessionKeyLoginRedirect contains the url to be redirected too after logging in. SessionKeyLoginRedirect )
Source Files ¶
- admin_account.go
- admin_autocomplete_account.go
- admin_home.go
- admin_instance.go
- admin_instance_view.go
- admin_instance_view_add_team_member.go
- admin_instance_view_delete_team_member.go
- admin_instance_view_s3_cdn.go
- admin_instance_view_transfer_owndership.go
- callback.go
- const.go
- context_key.go
- error.go
- forward.go
- home.go
- logger.go
- login.go
- logout.go
- middleware.go
- module.go
- re.go
- route.go
- session_key.go
- settings.go
- template.go
- util.go