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 GetAdmin(factoryManager *server.Factory) echo.HandlerFunc
- func GetAttachment(factoryManager *server.Factory) echo.HandlerFunc
- func GetChangePassword(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 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(factoryManager *server.Factory) echo.HandlerFunc
- func GetOutbox(serverFactory *server.Factory) echo.HandlerFunc
- func GetProfileAvatar(serverFactory *server.Factory) echo.HandlerFunc
- func GetQRCode(fm *server.Factory) echo.HandlerFunc
- func GetRegister(factoryManager *server.Factory) echo.HandlerFunc
- func GetResetCode(serverFactory *server.Factory) echo.HandlerFunc
- func GetResetPassword(serverFactory *server.Factory) echo.HandlerFunc
- func GetSignIn(serverFactory *server.Factory) echo.HandlerFunc
- func GetStartup(serverFactory *server.Factory) echo.HandlerFunc
- func GetStream(serverFactory *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 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 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 OAuthRedirect(factory *server.Factory) echo.HandlerFunc
- func PostAdmin(factoryManager *server.Factory) echo.HandlerFunc
- func PostInbox(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(factoryManager *server.Factory) echo.HandlerFunc
- func PostResetCode(serverFactory *server.Factory) echo.HandlerFunc
- func PostResetPassword(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 PostWebMention(fm *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
- type AsWriteCloser
- type StepQRCode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAttachment ¶
func GetChangePassword ¶ added in v0.6.0
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 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 GetProfileAvatar ¶
func GetRegister ¶
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 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 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 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. WebFinger data based on https://docs.joinmastodon.org/spec/webfinger/
func GetWidgetBundle ¶
func GetWidgetResource ¶ added in v0.6.0
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 OAuthRedirect ¶
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 ¶
PostRegister generates an echo.HandlerFunc that handles POST /register requests
func PostResetCode ¶
func PostResetPassword ¶
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 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.
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 StepQRCode ¶
type StepQRCode struct { }
StepQRCode represents an action-step that returns a QR Code for the current stream URL.
Source Files ¶
- admin.go
- attachment.go
- bundles.go
- favicon.go
- following.go
- giphy.go
- handler.go
- host.go
- html.go
- inbox.go
- jsonld.go
- mastodon.go
- modelService.go
- nodeInfo.go
- oauth-client.go
- oauth-server.go
- oembed.go
- ostatus.go
- outbox.go
- qrcode.go
- register.go
- resources.go
- setup_domain.go
- setup_oauth.go
- setup_server.go
- setup_users.go
- signin.go
- sse.go
- startup.go
- stream.go
- tbd.go
- template.go
- utilities.go
- webfinger.go
- webmention.go
- websub.go
- writeCloser.go