framework

package
v0.0.0-...-46677ce Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LoginFormEmailKey    = "email"
	LoginFormPasswordKey = "password"
)

Variables

This section is empty.

Functions

func BuildHandler

func BuildHandler(r *Router,
	internalErrorHandler http.Handler,
	badRequestHandler http.Handler,
	getAuthWebHandler http.Handler,
	getLoginWebHandler http.Handler,
	scheme string,
	c *config.Config,
	a app.Application,
	fr app.Framework,
	actor pub.Actor,
	db RoutingDatabase,
	users *services.Users,
	cy *services.Crypto,
	ni *services.NodeInfo,
	following *services.Following,
	followers *services.Followers,
	liked *services.Liked,
	sqldb *sql.DB,
	oauth *oauth2.Server,
	sl *web.Sessions,
	fw *Framework,
	clock pub.Clock,
	sw, apcore app.Software,
	debug bool) (rt http.Handler, err error)

func ClarkeSays

func ClarkeSays(moo string) string

func LoadConfigFile

func LoadConfigFile(filename string, a app.Application, debug bool) (c *config.Config, err error)

func NewHTTPClient

func NewHTTPClient(c *config.Config) *http.Client

func PromptAdminUser

func PromptAdminUser() (username, email, password string, err error)

func PromptFileExistsContinue

func PromptFileExistsContinue(path string) (b bool, err error)

func PromptNewConfig

func PromptNewConfig(file string) (c *config.Config, err error)

func PromptOverwriteExistingFile

func PromptOverwriteExistingFile(path string) (b bool, err error)

func PromptServerProfile

func PromptServerProfile(scheme, host string) (sp services.ServerPreferences, err error)

func SaveConfigFile

func SaveConfigFile(filename string, c *config.Config, others ...interface{}) error

func Vars

func Vars(r *http.Request) map[string]string

Vars returns the route variables for the current request, if any.

Types

type Framework

type Framework struct {
	// contains filtered or unexported fields
}

func BuildFramework

func BuildFramework(scheme string,
	host string,
	rsaKeySize int,
	saltSize int,
	bCryptStrength int,
	fw *Framework,
	o *oauth2.Server,
	s *web.Sessions,
	data *services.Data,
	followers *services.Followers,
	users *services.Users,
	actor pub.Actor,
	a app.Application) *Framework

func (*Framework) Context

func (f *Framework) Context(r *http.Request) context.Context

func (*Framework) CreateUser

func (f *Framework) CreateUser(c context.Context, username, email, password string) (userID string, err error)

func (*Framework) GetByIRI

func (f *Framework) GetByIRI(c context.Context, id *url.URL) (vocab.Type, error)

func (*Framework) GetPrivileges

func (f *Framework) GetPrivileges(c context.Context, userID paths.UUID, appPrivileges interface{}) (admin bool, err error)

func (*Framework) IsNotUniqueEmail

func (f *Framework) IsNotUniqueEmail(err error) bool

func (*Framework) IsNotUniqueUsername

func (f *Framework) IsNotUniqueUsername(err error) bool

func (*Framework) OpenFollowRequests

func (f *Framework) OpenFollowRequests(c context.Context, userID paths.UUID) ([]vocab.ActivityStreamsFollow, error)

func (*Framework) Send

func (f *Framework) Send(c context.Context, userID paths.UUID, t vocab.Type) error

func (*Framework) SendAcceptFollow

func (f *Framework) SendAcceptFollow(ctx context.Context, userID paths.UUID, followIRI *url.URL) error

func (*Framework) SendRejectFollow

func (f *Framework) SendRejectFollow(ctx context.Context, userID paths.UUID, followIRI *url.URL) error

func (*Framework) Session

func (f *Framework) Session(r *http.Request) (app.Session, error)

func (*Framework) SetPrivileges

func (f *Framework) SetPrivileges(c context.Context, userID paths.UUID, admin bool, appPrivileges interface{}) error

func (*Framework) UserIRI

func (f *Framework) UserIRI(userUUID paths.UUID) *url.URL

func (*Framework) Validate

func (f *Framework) Validate(w http.ResponseWriter, r *http.Request) (userID paths.UUID, authenticated bool, err error)

type Route

type Route struct {
	// contains filtered or unexported fields
}

func (*Route) ActivityPubAndWebHandleFunc

func (r *Route) ActivityPubAndWebHandleFunc(path string, authFn app.AuthorizeFunc, f func(http.ResponseWriter, *http.Request)) app.Route

func (*Route) ActivityPubOnlyHandleFunc

func (r *Route) ActivityPubOnlyHandleFunc(path string, authFn app.AuthorizeFunc) app.Route

func (*Route) HandleAccessTokenRequest

func (r *Route) HandleAccessTokenRequest(path string) app.Route

func (*Route) HandleAuthorizationRequest

func (r *Route) HandleAuthorizationRequest(path string) app.Route

func (*Route) Handler

func (r *Route) Handler(handler http.Handler) app.Route

func (*Route) HandlerFunc

func (r *Route) HandlerFunc(f func(http.ResponseWriter, *http.Request)) app.Route

func (*Route) Headers

func (r *Route) Headers(pairs ...string) app.Route

func (*Route) Host

func (r *Route) Host(tpl string) app.Route

func (*Route) Methods

func (r *Route) Methods(methods ...string) app.Route

func (*Route) Name

func (r *Route) Name(name string) app.Route

func (*Route) Path

func (r *Route) Path(tpl string) app.Route

func (*Route) PathPrefix

func (r *Route) PathPrefix(tpl string) app.Route

func (*Route) Queries

func (r *Route) Queries(pairs ...string) app.Route

func (*Route) Schemes

func (r *Route) Schemes(schemes ...string) app.Route

func (*Route) Subrouter

func (r *Route) Subrouter() app.Router

func (*Route) WebOnlyHandler

func (r *Route) WebOnlyHandler(path string, handler http.Handler) app.Route

func (*Route) WebOnlyHandlerFunc

func (r *Route) WebOnlyHandlerFunc(path string, f func(http.ResponseWriter, *http.Request)) app.Route

type Router

type Router struct {
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter(router *mux.Router,
	oauth *oauth2.Server,
	userActor pub.Actor,
	actorMap map[paths.Actor]pub.Actor,
	clock pub.Clock,
	db RoutingDatabase,
	host string,
	scheme string,
	errorHandler http.Handler,
	badRequestHandler http.Handler) *Router

func (*Router) ActivityPubAndWebHandleFunc

func (r *Router) ActivityPubAndWebHandleFunc(path string, authFn app.AuthorizeFunc, f func(http.ResponseWriter, *http.Request)) app.Route

func (*Router) ActivityPubOnlyHandleFunc

func (r *Router) ActivityPubOnlyHandleFunc(path string, authFn app.AuthorizeFunc) app.Route

func (*Router) Get

func (r *Router) Get(name string) app.Route

func (*Router) Handle

func (r *Router) Handle(path string, handler http.Handler) app.Route

func (*Router) HandleAccessTokenRequest

func (r *Router) HandleAccessTokenRequest(path string) app.Route

func (*Router) HandleAuthorizationRequest

func (r *Router) HandleAuthorizationRequest(path string) app.Route

func (*Router) HandleFunc

func (r *Router) HandleFunc(path string, f func(http.ResponseWriter, *http.Request)) app.Route

func (*Router) Headers

func (r *Router) Headers(pairs ...string) app.Route

func (*Router) Host

func (r *Router) Host(tpl string) app.Route

func (*Router) Methods

func (r *Router) Methods(methods ...string) app.Route

func (*Router) Name

func (r *Router) Name(name string) app.Route

func (*Router) NewRoute

func (r *Router) NewRoute() app.Route

func (*Router) Path

func (r *Router) Path(tpl string) app.Route

func (*Router) PathPrefix

func (r *Router) PathPrefix(tpl string) app.Route

func (*Router) Queries

func (r *Router) Queries(pairs ...string) app.Route

func (*Router) Schemes

func (r *Router) Schemes(schemes ...string) app.Route

func (*Router) Use

func (r *Router) Use(mwf ...mux.MiddlewareFunc)

func (*Router) Walk

func (r *Router) Walk(walkFn mux.WalkFunc) error

func (*Router) WebOnlyHandle

func (r *Router) WebOnlyHandle(path string, handler http.Handler) app.Route

func (*Router) WebOnlyHandleFunc

func (r *Router) WebOnlyHandleFunc(path string, f func(http.ResponseWriter, *http.Request)) app.Route

type RoutingDatabase

type RoutingDatabase interface {
	app.Database
	pub.Database
	GetPublicInbox(c context.Context, inboxIRI *url.URL) (inbox vocab.ActivityStreamsOrderedCollectionPage, err error)
	GetPublicOutbox(c context.Context, outboxIRI *url.URL) (outbox vocab.ActivityStreamsOrderedCollectionPage, err error)
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewHTTPSServer

func NewHTTPSServer(c *config.Config, h http.Handler, a app.Application, sqldb *sql.DB, d models.SqlDialect, models []models.Model, ss []StartStopper) (s *Server, err error)

func NewInsecureServer

func NewInsecureServer(c *config.Config, h http.Handler, a app.Application, sqldb *sql.DB, d models.SqlDialect, models []models.Model, ss []StartStopper) (s *Server, err error)

func (*Server) Start

func (s *Server) Start() error

func (*Server) Stop

func (s *Server) Stop()

type StartStopper

type StartStopper interface {
	Start()
	Stop()
}

Directories

Path Synopsis
There are two competing standards: NodeInfo and NodeInfo2.
There are two competing standards: NodeInfo and NodeInfo2.

Jump to

Keyboard shortcuts

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