Documentation ¶
Overview ¶
Package handler contains all of the HTTP handlers for Emissary. This maps loosely to the "Controllers/Gateways/Presenters" concept in the "Clean Architecture" design pattern (https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html). Handlers are wired directly to routes by the main server process, and are the only entry points for web-based access to Emissary.
Each handler's first task is to determine which domain is being requested. This is done by calling the server.Factory and passing it the current request context.
Index ¶
- func ActorUsername(actor streams.Document) string
- func Blocked(ctx echo.Context) error
- func GetAdmin(factoryManager *server.Factory) echo.HandlerFunc
- func GetChangePassword(serverFactory *server.Factory) echo.HandlerFunc
- func GetCloseWindow(ctx echo.Context) error
- func GetCompleteRegistration(ctx *steranko.Context, factory *domain.Factory, domain *model.Domain, ...) error
- func GetDomainAttachment(factoryManager *server.Factory) echo.HandlerFunc
- func GetEmptyCollection(serverFactory *server.Factory) echo.HandlerFunc
- func GetFavicon(factoryManager *server.Factory) echo.HandlerFunc
- func GetFollowingTunnel(context echo.Context) error
- func GetGiphyWidget(serverFactory *server.Factory) echo.HandlerFunc
- func GetHostMeta(serverFactory *server.Factory) echo.HandlerFunc
- func GetHostMetaJSON(serverFactory *server.Factory) echo.HandlerFunc
- func GetInbox(serverFactory *server.Factory) echo.HandlerFunc
- func GetIntentInfo(ctx *steranko.Context, factory *domain.Factory) error
- func GetIntent_Create(ctx *steranko.Context, factory *domain.Factory, user *model.User) error
- func GetIntent_Dislike(ctx *steranko.Context, factory *domain.Factory, user *model.User) error
- func GetIntent_Follow(ctx *steranko.Context, factory *domain.Factory, user *model.User) error
- func GetIntent_Like(ctx *steranko.Context, factory *domain.Factory, user *model.User) error
- func GetNodeInfo(serverFactory *server.Factory) echo.HandlerFunc
- func GetNodeInfo20(serverFactory *server.Factory) echo.HandlerFunc
- func GetNodeInfo21(serverFactory *server.Factory) echo.HandlerFunc
- func GetOAuth(fm *server.Factory) echo.HandlerFunc
- func GetOAuthAuthorization(serverFactory *server.Factory) echo.HandlerFunc
- func GetOAuthCallback(fm *server.Factory) echo.HandlerFunc
- func GetOEmbed(ctx *steranko.Context, factory *domain.Factory) error
- func GetOutboundIntent(ctx *steranko.Context, factory *domain.Factory) error
- func GetOutbox(serverFactory *server.Factory) echo.HandlerFunc
- func GetProfileIcon(serverFactory *server.Factory) echo.HandlerFunc
- func GetProfileImage(serverFactory *server.Factory) echo.HandlerFunc
- func GetQRCode(fm *server.Factory) echo.HandlerFunc
- func GetRegister(ctx *steranko.Context, factory *domain.Factory, domain *model.Domain, ...) error
- func GetResetCode(serverFactory *server.Factory) echo.HandlerFunc
- func GetResetPassword(serverFactory *server.Factory) echo.HandlerFunc
- func GetSearchTagAttachment(ctx *steranko.Context, factory *domain.Factory) error
- func GetServiceActor(serverFactory *server.Factory) echo.HandlerFunc
- func GetSignIn(serverFactory *server.Factory) echo.HandlerFunc
- func GetSingleSignOn(ctx *steranko.Context, factory *domain.Factory, domain *model.Domain) error
- func GetStartup(serverFactory *server.Factory) echo.HandlerFunc
- func GetStream(serverFactory *server.Factory) echo.HandlerFunc
- func GetStreamAttachment(factoryManager *server.Factory) echo.HandlerFunc
- func GetStreamWithAction(serverFactory *server.Factory) echo.HandlerFunc
- func GetTemplateBundle(serverFactory *server.Factory) echo.HandlerFunc
- func GetTemplateResource(serverFactory *server.Factory) echo.HandlerFunc
- func GetThemeBundle(serverFactory *server.Factory) echo.HandlerFunc
- func GetThemeResource(serverFactory *server.Factory) echo.HandlerFunc
- func GetUserAttachment(factoryManager *server.Factory) echo.HandlerFunc
- func GetWebSubClient(serverFactory *server.Factory) echo.HandlerFunc
- func GetWebfinger(fm *server.Factory) echo.HandlerFunc
- func GetWidgetBundle(serverFactory *server.Factory) echo.HandlerFunc
- func GetWidgetResource(serverFactory *server.Factory) echo.HandlerFunc
- func IndexAllStreams(ctx *steranko.Context, factory *domain.Factory) error
- func IndexAllUsers(ctx *steranko.Context, factory *domain.Factory) error
- func Mastodon(serverFactory *server.Factory) toot.API[model.Authorization]
- func ModelService_Form(ctx echo.Context, modelService service.ModelService)
- func ModelService_RenderTemplate(serverFactory *server.Factory, ctx echo.Context, serviceName string, ...) (string, error)
- func NotFound(ctx echo.Context) error
- func OAuthRedirect(factory *server.Factory) echo.HandlerFunc
- func PostAdmin(factoryManager *server.Factory) echo.HandlerFunc
- func PostEmailFollower(serverFactory *server.Factory) echo.HandlerFunc
- func PostInbox(serverFactory *server.Factory) echo.HandlerFunc
- func PostIntent_Create(ctx *steranko.Context, factory *domain.Factory, user *model.User) error
- func PostIntent_Dislike(ctx *steranko.Context, factory *domain.Factory, user *model.User) error
- func PostIntent_Follow(ctx *steranko.Context, factory *domain.Factory, user *model.User) error
- func PostIntent_Like(ctx *steranko.Context, factory *domain.Factory, user *model.User) error
- func PostMasquerade(serverFactory *server.Factory) echo.HandlerFunc
- func PostOAuthAuthorization(serverFactory *server.Factory) echo.HandlerFunc
- func PostOAuthRevoke(serverFactory *server.Factory) echo.HandlerFunc
- func PostOAuthToken(serverFactory *server.Factory) echo.HandlerFunc
- func PostOStatusDiscover(serverFactory *server.Factory) echo.HandlerFunc
- func PostOutbox(serverFactory *server.Factory) echo.HandlerFunc
- func PostRegister(ctx *steranko.Context, factory *domain.Factory, domain *model.Domain, ...) error
- func PostResetCode(serverFactory *server.Factory) echo.HandlerFunc
- func PostResetPassword(serverFactory *server.Factory) echo.HandlerFunc
- func PostServiceActor_Inbox(serverFactory *server.Factory) echo.HandlerFunc
- func PostSignIn(serverFactory *server.Factory) echo.HandlerFunc
- func PostSignOut(serverFactory *server.Factory) echo.HandlerFunc
- func PostStartup(serverFactory *server.Factory) echo.HandlerFunc
- func PostStreamWithAction(serverFactory *server.Factory) echo.HandlerFunc
- func PostUpdateRegistration(ctx *steranko.Context, factory *domain.Factory, domain *model.Domain, ...) error
- func PostWebMention(serverFactory *server.Factory) echo.HandlerFunc
- func PostWebSubClient(serverFactory *server.Factory) echo.HandlerFunc
- func ServerSentEvent(factoryManager *server.Factory) echo.HandlerFunc
- func SetupDomainDelete(factory *server.Factory) echo.HandlerFunc
- func SetupDomainGet(factory *server.Factory) echo.HandlerFunc
- func SetupDomainPost(factory *server.Factory) echo.HandlerFunc
- func SetupDomainSigninPost(fm *server.Factory) echo.HandlerFunc
- func SetupDomainUserDelete(serverFactory *server.Factory, templates *template.Template) echo.HandlerFunc
- func SetupDomainUserInvite(serverFactory *server.Factory, templates *template.Template) echo.HandlerFunc
- func SetupDomainUserPost(serverFactory *server.Factory, templates *template.Template) echo.HandlerFunc
- func SetupDomainUsersGet(serverFactory *server.Factory, templates *template.Template) echo.HandlerFunc
- func SetupOAuthGet(factory *server.Factory, templates *template.Template) echo.HandlerFunc
- func SetupOAuthList(factory *server.Factory, templates *template.Template) echo.HandlerFunc
- func SetupOAuthPost(factory *server.Factory, templates *template.Template) echo.HandlerFunc
- func SetupPageGet(factory *server.Factory, templates *template.Template, templateID string) echo.HandlerFunc
- func SetupServerGet(factory *server.Factory) echo.HandlerFunc
- func SetupServerPost(factory *server.Factory) echo.HandlerFunc
- func TBD(ctx echo.Context) error
- func WithAuthenticatedUser(serverFactory *server.Factory, fn WithFunc1[model.User]) echo.HandlerFunc
- func WithDomain(serverFactory *server.Factory, fn WithFunc1[model.Domain]) echo.HandlerFunc
- func WithFactory(serverFactory *server.Factory, fn WithFunc0) echo.HandlerFunc
- func WithRegistration(serverFactory *server.Factory, fn WithFunc2[model.Domain, model.Registration]) echo.HandlerFunc
- func WithStream(serverFactory *server.Factory, fn WithFunc1[model.Stream]) echo.HandlerFunc
- func WithUser(serverFactory *server.Factory, fn WithFunc1[model.User]) echo.HandlerFunc
- type AsWriteCloser
- type WithFunc0
- type WithFunc1
- type WithFunc2
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActorUsername ¶ added in v0.7.0
ActorUsername returns a human-readable username for an Actor
func GetChangePassword ¶ added in v0.6.0
func GetCloseWindow ¶ added in v0.7.0
func GetCloseWindow(ctx echo.Context) error
GetCloseWindow is an HTTP handler that returns HTML to close the current window. It is used as a callback URL for outbound intents that use true pop-up windows.
func GetCompleteRegistration ¶ added in v0.7.0
func GetCompleteRegistration(ctx *steranko.Context, factory *domain.Factory, domain *model.Domain, registration *model.Registration) error
PostRegister generates an echo.HandlerFunc that handles POST /register requests
func GetDomainAttachment ¶ added in v0.7.0
func GetEmptyCollection ¶ added in v0.7.0
GetEmptyCollection returns an empty collection
func GetFavicon ¶
GetFavicon returns the default favicon for this server
func GetFollowingTunnel ¶
func GetFollowingTunnel(context echo.Context) error
GetFollowingTunnel is a hack to work around the restrictions from SameSite cookies. If the user is coming from another site, their Authentication cookies won't be sent because we use SameSite=Strict. But they WILL be sent from this redirect. So, it's another hop, but it's still better for users.
func GetGiphyWidget ¶
func GetHostMeta ¶ added in v0.6.0
func GetHostMetaJSON ¶ added in v0.6.0
func GetIntentInfo ¶ added in v0.7.0
func GetIntent_Create ¶ added in v0.7.0
func GetIntent_Dislike ¶ added in v0.7.0
func GetIntent_Follow ¶ added in v0.7.0
func GetIntent_Like ¶ added in v0.7.0
func GetNodeInfo ¶
GetNodeInfo returns the discovery links for nodeInfo endpoints http://nodeinfo.diaspora.software/protocol.html http://nodeinfo.diaspora.software/schema.html
func GetNodeInfo20 ¶ added in v0.6.0
GetNodeInfo20 returns the nodeInfo 2.0 document for this server http://nodeinfo.diaspora.software/ns/schema/2.0 http://nodeinfo.diaspora.software/docson/index.html#/ns/schema/2.0#$$expand
func GetNodeInfo21 ¶ added in v0.6.0
GetNodeInfo21 returns the nodeInfo 2.1 document for this server http://nodeinfo.diaspora.software/ns/schema/2.1 http://nodeinfo.diaspora.software/docson/index.html#/ns/schema/2.1#$$expand
func GetOAuthAuthorization ¶ added in v0.6.0
func GetOAuthCallback ¶
func GetOEmbed ¶
GetOEmbed will provide an OEmbed service to be used exclusively by websites on this domain.
func GetOutboundIntent ¶ added in v0.7.0
GetOutboundIntent translates an intent+account into a URL where we forward the user to complete the intent on their home server.
func GetProfileIcon ¶ added in v0.7.0
func GetProfileImage ¶ added in v0.7.0
func GetRegister ¶
func GetRegister(ctx *steranko.Context, factory *domain.Factory, domain *model.Domain, registration *model.Registration) error
GetRegister generates an echo.HandlerFunc that handles GET /register requests
func GetResetCode ¶
GetResetCode displays a form (authenticated by the reset code) for resetting a user's password
func GetResetPassword ¶
func GetSearchTagAttachment ¶ added in v0.7.0
func GetServiceActor ¶ added in v0.7.0
func GetSingleSignOn ¶ added in v0.7.0
func GetStartup ¶ added in v0.6.0
func GetStream ¶
GetStream handles GET requests with the default action. This handler also responds to JSON-LD requests
func GetStreamAttachment ¶ added in v0.7.0
func GetStreamWithAction ¶ added in v0.6.0
GetStreamWithAction handles GET requests with a specified action
func GetTemplateBundle ¶
func GetTemplateResource ¶ added in v0.6.0
func GetThemeBundle ¶
func GetThemeResource ¶ added in v0.6.0
func GetUserAttachment ¶ added in v0.7.0
func GetWebSubClient ¶
GetWebSubClient is called by an external WebSub server to confirm a subscription request.
func GetWebfinger ¶
GetWebfinger returns public webfinger information for a designated user. https://webfinger.net WebFinger data based on https://docs.joinmastodon.org/spec/webfinger/
func GetWidgetBundle ¶
func GetWidgetResource ¶ added in v0.6.0
func IndexAllStreams ¶ added in v0.7.0
IndexAllStreams is a handler function that triggers the IndexAllStreams queue task. It can only be called by an authenticated administrator.
func IndexAllUsers ¶ added in v0.7.0
IndexAllUsers is a handler function that triggers the IndexAllUsers queue task. It can only be called by an authenticated administrator.
func ModelService_Form ¶
func ModelService_Form(ctx echo.Context, modelService service.ModelService)
func ModelService_RenderTemplate ¶
func ModelService_RenderTemplate(serverFactory *server.Factory, ctx echo.Context, serviceName string, builder builder.Builder, templateName string) (string, error)
TODO: Remove?
func NotFound ¶ added in v0.7.0
func NotFound(ctx echo.Context) error
NotFound returns the default favicon for this server
func OAuthRedirect ¶
func PostEmailFollower ¶ added in v0.7.0
func PostIntent_Create ¶ added in v0.7.0
func PostIntent_Dislike ¶ added in v0.7.0
func PostIntent_Follow ¶ added in v0.7.0
func PostIntent_Like ¶ added in v0.7.0
func PostMasquerade ¶ added in v0.7.0
func PostOAuthAuthorization ¶ added in v0.6.0
func PostOAuthRevoke ¶ added in v0.6.0
func PostOAuthToken ¶ added in v0.6.0
func PostOStatusDiscover ¶
PostOStatusDiscover looks up a user's profile using oStatus discovery. If successful, it returns a redirect to the user's follow-request page. If unsuccessful, it returns a 200 with an English-language error message.
func PostOutbox ¶ added in v0.6.0
PostOutbox handles POST/DELETE requests
func PostRegister ¶
func PostResetCode ¶
func PostResetPassword ¶
func PostServiceActor_Inbox ¶ added in v0.7.0
PostServiceActor_Inbox does not take any actions, but only logs the request IF logger is in Debug or Trace mode.
func PostSignIn ¶
PostSignIn generates an echo.HandlerFunc that handles POST /signin requests
func PostSignOut ¶
PostSignOut generates an echo.HandlerFunc that handles POST /signout requests
func PostStartup ¶ added in v0.6.0
func PostStreamWithAction ¶ added in v0.6.0
PostStreamWithAction handles POST requests with a specified action
func PostUpdateRegistration ¶ added in v0.7.0
func PostUpdateRegistration(ctx *steranko.Context, factory *domain.Factory, domain *model.Domain, registration *model.Registration) error
PostUpdateRegistration generates an echo.HandlerFunc that handles POST /register requests
func PostWebMention ¶
func PostWebSubClient ¶
PostWebSubClient is called by an external WebSub server to notify us of a change.
func ServerSentEvent ¶
ServerSentEvent generates an echo.HandlerFunc that listens for requests for SSE following.
func SetupDomainDelete ¶
SetupDomainDelete deletes a domain from the configuration
func SetupDomainGet ¶
SetupDomainGet displays the form for creating/editing a domain.
func SetupDomainPost ¶
SetupDomainPost updates/creates a domain
func SetupDomainSigninPost ¶
SetupDomainSigninPost signs you in to the requested domain as an administrator
func SetupDomainUserDelete ¶
func SetupDomainUserInvite ¶
func SetupDomainUserPost ¶
func SetupDomainUsersGet ¶
func SetupOAuthGet ¶
func SetupOAuthList ¶
func SetupOAuthPost ¶
func SetupPageGet ¶
func SetupPageGet(factory *server.Factory, templates *template.Template, templateID string) echo.HandlerFunc
SetupPageGet generates simple template pages for the setup server, based on the Templates and ID provided.
func SetupServerGet ¶
SetupServerGet generates a form for the setup app.
func SetupServerPost ¶
SetupServerPost saves the form data to the config file.
func TBD ¶
func TBD(ctx echo.Context) error
TBD represents a placeholder handler that will be removed before release.
func WithAuthenticatedUser ¶ added in v0.7.0
func WithAuthenticatedUser(serverFactory *server.Factory, fn WithFunc1[model.User]) echo.HandlerFunc
WithAuthenticatedUser handles boilerplate code for requests that require a signed-in user
func WithDomain ¶ added in v0.7.0
WithDomain handles boilerplate code for requests that load a domain object
func WithFactory ¶ added in v0.7.0
WithFactory handles boilerplate code for requests that require only the domain Factory
func WithRegistration ¶ added in v0.7.0
func WithRegistration(serverFactory *server.Factory, fn WithFunc2[model.Domain, model.Registration]) echo.HandlerFunc
WithRegistration handles boilerplate code for requests that use a Registration object
func WithStream ¶ added in v0.7.0
WithStream handles boilerplate code for requests that load a stream
Types ¶
type AsWriteCloser ¶
AsWriteCloser is a hacky kludge that lets us use an io.Writer as an io.WriteCloser
func (AsWriteCloser) Close ¶
func (writeCloser AsWriteCloser) Close() error
type WithFunc0 ¶ added in v0.7.0
WithFunc0 is a function signature for a continuation function that requires only the domain Factory
Source Files ¶
- admin.go
- attachment.go
- blocked.go
- bundles.go
- close_window.go
- favicon.go
- follow_email.go
- following.go
- giphy.go
- handler.go
- host.go
- inbox.go
- intent_create.go
- intent_discovery.go
- intent_dislike.go
- intent_follow.go
- intent_header.go
- intent_like.go
- intent_outbound.go
- jsonld.go
- mastodon.go
- modelService.go
- nodeInfo.go
- oauth-client.go
- oauth-server.go
- oembed.go
- ostatus.go
- outbox.go
- qrcode.go
- registration.go
- resources.go
- search.go
- service_actor.go
- setup_domain.go
- setup_oauth.go
- setup_server.go
- setup_users.go
- signin.go
- signin_masquerade.go
- single-signon.go
- sse.go
- startup.go
- stream.go
- tbd.go
- template.go
- utilities.go
- webfinger.go
- webmention.go
- websub.go
- wrappers.go
- writeCloser.go