handler

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: AGPL-3.0 Imports: 48 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAdmin

func GetAdmin(factoryManager *server.Factory) echo.HandlerFunc

GetAdmin handles GET requests

func GetAttachment

func GetAttachment(factoryManager *server.Factory) echo.HandlerFunc

func GetChangePassword added in v0.6.0

func GetChangePassword(serverFactory *server.Factory) echo.HandlerFunc

func GetFavicon

func GetFavicon(factoryManager *server.Factory) echo.HandlerFunc

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 GetGiphyWidget(serverFactory *server.Factory) echo.HandlerFunc

func GetHostMeta added in v0.6.0

func GetHostMeta(serverFactory *server.Factory) echo.HandlerFunc

func GetHostMetaJSON added in v0.6.0

func GetHostMetaJSON(serverFactory *server.Factory) echo.HandlerFunc

func GetInbox added in v0.6.0

func GetInbox(serverFactory *server.Factory) echo.HandlerFunc

GetInbox handles GET requests

func GetNodeInfo

func GetNodeInfo(serverFactory *server.Factory) echo.HandlerFunc

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

func GetNodeInfo20(serverFactory *server.Factory) echo.HandlerFunc

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

func GetNodeInfo21(serverFactory *server.Factory) echo.HandlerFunc

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 GetOAuth

func GetOAuth(fm *server.Factory) echo.HandlerFunc

GetOAuth looks up the OAuth provider and forwards to the appropriate endpoint

func GetOAuthAuthorization added in v0.6.0

func GetOAuthAuthorization(serverFactory *server.Factory) echo.HandlerFunc

func GetOAuthCallback

func GetOAuthCallback(fm *server.Factory) echo.HandlerFunc

func GetOEmbed

func GetOEmbed(factoryManager *server.Factory) echo.HandlerFunc

GetOEmbed will provide an OEmbed service to be used exclusively by websites on this domain.

func GetOutbox added in v0.6.0

func GetOutbox(serverFactory *server.Factory) echo.HandlerFunc

GetOutbox handles GET requests

func GetProfileAvatar

func GetProfileAvatar(serverFactory *server.Factory) echo.HandlerFunc

func GetQRCode

func GetQRCode(fm *server.Factory) echo.HandlerFunc

Get builds the Stream HTML to the context

func GetRegister

func GetRegister(factoryManager *server.Factory) echo.HandlerFunc

GetRegister generates an echo.HandlerFunc that handles GET /register requests

func GetResetCode

func GetResetCode(serverFactory *server.Factory) echo.HandlerFunc

GetResetCode displays a form (authenticated by the reset code) for resetting a user's password

func GetResetPassword

func GetResetPassword(serverFactory *server.Factory) echo.HandlerFunc

func GetSignIn

func GetSignIn(serverFactory *server.Factory) echo.HandlerFunc

GetSignIn generates an echo.HandlerFunc that handles GET /signin requests

func GetStartup added in v0.6.0

func GetStartup(serverFactory *server.Factory) echo.HandlerFunc

func GetStream

func GetStream(serverFactory *server.Factory) echo.HandlerFunc

GetStream handles GET requests with the default action. This handler also responds to JSON-LD requests

func GetStreamWithAction added in v0.6.0

func GetStreamWithAction(serverFactory *server.Factory) echo.HandlerFunc

GetStreamWithAction handles GET requests with a specified action

func GetTemplateBundle

func GetTemplateBundle(serverFactory *server.Factory) echo.HandlerFunc

func GetTemplateResource added in v0.6.0

func GetTemplateResource(serverFactory *server.Factory) echo.HandlerFunc

func GetThemeBundle

func GetThemeBundle(serverFactory *server.Factory) echo.HandlerFunc

func GetThemeResource added in v0.6.0

func GetThemeResource(serverFactory *server.Factory) echo.HandlerFunc

func GetWebSubClient

func GetWebSubClient(serverFactory *server.Factory) echo.HandlerFunc

GetWebSubClient is called by an external WebSub server to confirm a subscription request.

func GetWebfinger

func GetWebfinger(fm *server.Factory) echo.HandlerFunc

GetWebfinger returns public webfinger information for a designated user. WebFinger data based on https://docs.joinmastodon.org/spec/webfinger/

func GetWidgetBundle

func GetWidgetBundle(serverFactory *server.Factory) echo.HandlerFunc

func GetWidgetResource added in v0.6.0

func GetWidgetResource(serverFactory *server.Factory) echo.HandlerFunc

func Mastodon added in v0.6.0

func Mastodon(serverFactory *server.Factory) toot.API[model.Authorization]

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 OAuthRedirect(factory *server.Factory) echo.HandlerFunc

func PostAdmin

func PostAdmin(factoryManager *server.Factory) echo.HandlerFunc

PostAdmin handles POST/DELETE requests

func PostInbox added in v0.6.0

func PostInbox(serverFactory *server.Factory) echo.HandlerFunc

PostInbox handles POST/DELETE requests

func PostOAuthAuthorization added in v0.6.0

func PostOAuthAuthorization(serverFactory *server.Factory) echo.HandlerFunc

func PostOAuthRevoke added in v0.6.0

func PostOAuthRevoke(serverFactory *server.Factory) echo.HandlerFunc

func PostOAuthToken added in v0.6.0

func PostOAuthToken(serverFactory *server.Factory) echo.HandlerFunc

func PostOStatusDiscover

func PostOStatusDiscover(serverFactory *server.Factory) echo.HandlerFunc

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

func PostOutbox(serverFactory *server.Factory) echo.HandlerFunc

PostOutbox handles POST/DELETE requests

func PostRegister

func PostRegister(factoryManager *server.Factory) echo.HandlerFunc

PostRegister generates an echo.HandlerFunc that handles POST /register requests

func PostResetCode

func PostResetCode(serverFactory *server.Factory) echo.HandlerFunc

func PostResetPassword

func PostResetPassword(serverFactory *server.Factory) echo.HandlerFunc

func PostSignIn

func PostSignIn(serverFactory *server.Factory) echo.HandlerFunc

PostSignIn generates an echo.HandlerFunc that handles POST /signin requests

func PostSignOut

func PostSignOut(serverFactory *server.Factory) echo.HandlerFunc

PostSignOut generates an echo.HandlerFunc that handles POST /signout requests

func PostStartup added in v0.6.0

func PostStartup(serverFactory *server.Factory) echo.HandlerFunc

func PostStreamWithAction added in v0.6.0

func PostStreamWithAction(serverFactory *server.Factory) echo.HandlerFunc

PostStreamWithAction handles POST requests with a specified action

func PostWebMention

func PostWebMention(fm *server.Factory) echo.HandlerFunc

func PostWebSubClient

func PostWebSubClient(serverFactory *server.Factory) echo.HandlerFunc

PostWebSubClient is called by an external WebSub server to notify us of a change.

func ServerSentEvent

func ServerSentEvent(factoryManager *server.Factory) echo.HandlerFunc

ServerSentEvent generates an echo.HandlerFunc that listens for requests for SSE following.

func SetupDomainDelete

func SetupDomainDelete(factory *server.Factory) echo.HandlerFunc

SetupDomainDelete deletes a domain from the configuration

func SetupDomainGet

func SetupDomainGet(factory *server.Factory) echo.HandlerFunc

SetupDomainGet displays the form for creating/editing a domain.

func SetupDomainPost

func SetupDomainPost(factory *server.Factory) echo.HandlerFunc

SetupDomainPost updates/creates a domain

func SetupDomainSigninPost

func SetupDomainSigninPost(fm *server.Factory) echo.HandlerFunc

SetupDomainSigninPost signs you in to the requested domain as an administrator

func SetupDomainUserDelete

func SetupDomainUserDelete(serverFactory *server.Factory, templates *template.Template) echo.HandlerFunc

func SetupDomainUserInvite

func SetupDomainUserInvite(serverFactory *server.Factory, templates *template.Template) echo.HandlerFunc

func SetupDomainUserPost

func SetupDomainUserPost(serverFactory *server.Factory, templates *template.Template) echo.HandlerFunc

func SetupDomainUsersGet

func SetupDomainUsersGet(serverFactory *server.Factory, templates *template.Template) echo.HandlerFunc

func SetupOAuthGet

func SetupOAuthGet(factory *server.Factory, templates *template.Template) echo.HandlerFunc

func SetupOAuthList

func SetupOAuthList(factory *server.Factory, templates *template.Template) echo.HandlerFunc

func SetupOAuthPost

func SetupOAuthPost(factory *server.Factory, templates *template.Template) echo.HandlerFunc

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

func SetupServerGet(factory *server.Factory) echo.HandlerFunc

SetupServerGet generates a form for the setup app.

func SetupServerPost

func SetupServerPost(factory *server.Factory) echo.HandlerFunc

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.

Types

type AsWriteCloser

type AsWriteCloser struct {
	io.Writer
}

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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