web

package
v0.14.4 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyMember = errors.New("you are already a member of this list")
View Source
var ErrNoList = errors.New("no list or list error") // generic error so we don't reveal whether a non-public list exists
View Source
var ErrNoMember = errors.New("you are not a member of this list")
View Source
var ErrUnauthorized = errors.New("unauthorized")

Functions

func ExtractIP

func ExtractIP(r *http.Request) string

extracts the client's IP address from a request

Types

type Context

type Context struct {
	User          *mailutil.Addr
	IsSuperadmin  bool
	Notifications []Notification
	Data          interface{} // for template
	// contains filtered or unexported fields
}

func (*Context) Alertf

func (ctx *Context) Alertf(format string, a ...interface{})

implement Alerter

func (*Context) Execute

func (ctx *Context) Execute(t *template.Template, data interface{}) error

func (*Context) LoggedIn

func (ctx *Context) LoggedIn() bool

sets the logged-in user unconditionally

func (*Context) Logout

func (ctx *Context) Logout()

func (*Context) Redirect

func (ctx *Context) Redirect(format string, a ...interface{})

func (*Context) ServeFile

func (ctx *Context) ServeFile(name string)

func (*Context) Successf

func (ctx *Context) Successf(format string, a ...interface{})

implement Alerter

type Notification

type Notification struct {
	Message string
	Style   string
}

type UserRepo

type UserRepo interface {
	Authenticate(userid, password string) (success bool, err error) // should not be called if Available() returns false
	Available() bool
	Name() string
}

type Web

type Web struct {
	Ulist     *ulist.Ulist
	Listen    string
	URL       string
	UserRepos []UserRepo // repos are queried in the given order
}

func (Web) AskLeaveUrl added in v0.13.8

func (web Web) AskLeaveUrl(list *ulist.List) string

func (Web) AuthenticationAvailable

func (web Web) AuthenticationAvailable() bool

func (Web) CheckbackJoinUrl added in v0.13.8

func (web Web) CheckbackJoinUrl(list *ulist.List, timestamp int64, hmac string, recipient *ulist.Addr) string

func (Web) CheckbackLeaveUrl added in v0.13.8

func (web Web) CheckbackLeaveUrl(list *ulist.List, timestamp int64, hmac string, recipient *ulist.Addr) string

func (Web) FooterHTML added in v0.13.8

func (web Web) FooterHTML(list *ulist.List) string

func (Web) FooterPlain added in v0.13.8

func (web Web) FooterPlain(list *ulist.List) string

func (Web) ListenAndServe added in v0.13.8

func (web Web) ListenAndServe() error

func (Web) ModUrl added in v0.13.8

func (web Web) ModUrl(list *ulist.List) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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