webapp

package
v0.0.0-...-0f594a8 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: AGPL-3.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	COAnonymous = "anonymous"

	ActionAdd = "add"

	FormAction           = "action"
	FormDescription      = "desc"
	FormDomain           = "domain"
	FormForce            = "force"
	FormName             = "name"
	FormObfuscatedDomain = "obfuscated-domain"
)
View Source
const (
	// FormInstance is the key for a domain form field.
	FormInstance = "instance"
)
View Source
const SessionMaxAge = 30 * 24 * time.Hour // 30 days

Variables

This section is empty.

Functions

func JSOpenModal

func JSOpenModal(selector string) string

func JSTooltip

func JSTooltip() 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
}

func New

func New(
	ctx context.Context,
	lMod *language.Module,
	logicMod logic.Logic,
	redisClient redis.UniversalClient,
	tokz *token.Tokenizer,
	domain string,
) (*Module, error)

func (*Module) Middleware

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

Middleware runs on every http request.

func (*Module) MiddlewareRequireAdmin

func (m *Module) MiddlewareRequireAdmin(next http.Handler) http.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

func (*Module) Route

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

Route attaches routes to the web server.

func (*Module) SetServer

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

SetServer adds a reference to the server to the module.

func (*Module) WrapInMiddlewares

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

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
)

Jump to

Keyboard shortcuts

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