Documentation
¶
Overview ¶
Package handlers contains chainable handlers/middleware for routing.
Index ¶
- Variables
- func About() http.HandlerFunc
- func AddFeedSubscription() http.HandlerFunc
- func AddFeedset(static embed.FS) http.HandlerFunc
- func AddGroupSubscription() http.HandlerFunc
- func AddSearchSubscription() http.HandlerFunc
- func AddSubscriptionFilter() http.HandlerFunc
- func AdjustSubscriptionCategories() http.HandlerFunc
- func ChangePassword() http.HandlerFunc
- func DocumentationHandler() http.HandlerFunc
- func EditSubscription() http.HandlerFunc
- func ExportSubscriptions() http.HandlerFunc
- func FavoriteArticle() http.HandlerFunc
- func FavoriteSubscription() http.HandlerFunc
- func FindSimilarArticles() http.HandlerFunc
- func GenerateSubscriptionEmail() http.HandlerFunc
- func GetObjectIssues() http.HandlerFunc
- func GetPageIssues() http.HandlerFunc
- func GetSearchResults() http.HandlerFunc
- func GetSearchSuggestions() http.HandlerFunc
- func GetSubscriptionFilterSuggestions() http.HandlerFunc
- func HandleExternalError(err error) http.HandlerFunc
- func HandleInternalError(err error) http.HandlerFunc
- func HandleLandingPage() http.HandlerFunc
- func HandleListSubscriptions() http.HandlerFunc
- func HandleLogin(res http.ResponseWriter, req *http.Request)
- func HandleLoginCallback(res http.ResponseWriter, req *http.Request)
- func HandleLoginError(res http.ResponseWriter, req *http.Request)
- func HandleNotFound() http.HandlerFunc
- func HandleViewer() http.HandlerFunc
- func Home() http.HandlerFunc
- func ImageProxy(proxyURLBase string) http.HandlerFunc
- func ImportSubscriptions() http.HandlerFunc
- func Landing() http.HandlerFunc
- func ListArticles() http.HandlerFunc
- func ListCategories() http.HandlerFunc
- func ListFavorites() http.HandlerFunc
- func LoadCachedImage(res http.ResponseWriter, req *http.Request)
- func Logout(res http.ResponseWriter, req *http.Request)
- func MarkArticle() http.HandlerFunc
- func MarkArticles() http.HandlerFunc
- func MarkSubscription() http.HandlerFunc
- func MarkSubscriptions() http.HandlerFunc
- func NotFound() http.HandlerFunc
- func PaginateArticles() http.HandlerFunc
- func PolicyDocsHandler() http.HandlerFunc
- func PostsHandler() http.HandlerFunc
- func RemoveSubscription() http.HandlerFunc
- func RenderPage(content FullResponseHandler) http.HandlerFunc
- func RenderPartial(content PartialResponseHandler) http.HandlerFunc
- func RobotsHandler() http.Handler
- func SaveAccountSettings() http.HandlerFunc
- func SaveDisplaySettings() http.HandlerFunc
- func SaveSubscription() http.HandlerFunc
- func SetTheme() http.HandlerFunc
- func ShareArticle() http.HandlerFunc
- func ShowAccountSettings() http.HandlerFunc
- func ShowDisplaySettings() http.HandlerFunc
- func ShowSettings() http.HandlerFunc
- func StaticFileHandler(fs http.FileSystem) http.Handler
- func SubmitObjectIssues() http.HandlerFunc
- func SubmitPageIssues() http.HandlerFunc
- func UserAccountCancel() http.HandlerFunc
- func UserAccountIssue() http.HandlerFunc
- func UserAccountSuccess() http.HandlerFunc
- func UserCancelDeactivation() http.HandlerFunc
- func UserChooseSubscriptionPlan() http.HandlerFunc
- func UserDeactivateAccount() http.HandlerFunc
- func UserManageAccountSubscription() http.HandlerFunc
- func UserSubscriptionPlanCheckout() http.HandlerFunc
- func ViewArticle() http.HandlerFunc
- func WatchHome() http.HandlerFunc
- func WatchList() http.HandlerFunc
- func WatchSearchResults() http.HandlerFunc
- type ExternalError
- type FullResponseHandler
- type InternalError
- type LandingPage
- type ListSubscriptions
- type Login
- type NotFoundPage
- type PartialResponseHandler
- type Viewer
- type ViewerError
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidContent indicates that the content for rendering is invalid. ErrInvalidContent = errors.New("invalid content") // ErrInvalidRequestParams indicates that the request parameters received were invalid. ErrInvalidRequestParams = errors.New("invalid request parameters") )
Functions ¶
func About ¶ added in v0.21.0
func About() http.HandlerFunc
func AddFeedSubscription ¶
func AddFeedSubscription() http.HandlerFunc
AddFeedSubscription handles adding a new subscription to a feed.
func AddFeedset ¶
func AddFeedset(static embed.FS) http.HandlerFunc
AddFeedset handles adding a feedset as subscriptions.
func AddGroupSubscription ¶
func AddGroupSubscription() http.HandlerFunc
AddGroupSubscription handles adding a new group subscription.
func AddSearchSubscription ¶
func AddSearchSubscription() http.HandlerFunc
AddSearchSubscription handles adding a new search subscription.
func AddSubscriptionFilter ¶
func AddSubscriptionFilter() http.HandlerFunc
AddSubscriptionFilter handles adding a subscription as a search filter.
func AdjustSubscriptionCategories ¶
func AdjustSubscriptionCategories() http.HandlerFunc
AdjustSubscriptionCategories handles adding and removing categories from a subscription, either when editing or adding.
func ChangePassword ¶
func ChangePassword() http.HandlerFunc
ChangePassword handles a change password request from the user.
func DocumentationHandler ¶
func DocumentationHandler() http.HandlerFunc
DocumentationHandler handles serving Markdown documents for help/documentation from directory in the embedded fs.
func EditSubscription ¶
func EditSubscription() http.HandlerFunc
EditSubscription handles presenting the user with a form for editing a subscription.
func ExportSubscriptions ¶
func ExportSubscriptions() http.HandlerFunc
ExportSubscriptions handles configuring and performing an export of user subscriptions.
func FavoriteArticle ¶ added in v0.31.0
func FavoriteArticle() http.HandlerFunc
FavoriteArticle handles adding an article favorite.
func FavoriteSubscription ¶ added in v0.31.0
func FavoriteSubscription() http.HandlerFunc
FavoriteSubscription handles managing a favorite subscription for a user.
func FindSimilarArticles ¶
func FindSimilarArticles() http.HandlerFunc
FindSimilarArticles handles finding articles similar to the given article and showing the results.
func GenerateSubscriptionEmail ¶ added in v0.26.0
func GenerateSubscriptionEmail() http.HandlerFunc
func GetObjectIssues ¶
func GetObjectIssues() http.HandlerFunc
GetObjectIssues presents a form for entering issues about a particular object (subscription/article).
func GetPageIssues ¶
func GetPageIssues() http.HandlerFunc
GetPageIssues handles presenting a form for the user to submit issues about the app.
func GetSearchResults ¶
func GetSearchResults() http.HandlerFunc
GetSearchResults performs a search with the user input and renders a page with the search results.
func GetSearchSuggestions ¶
func GetSearchSuggestions() http.HandlerFunc
GetSearchSuggestions performs a search with the user input and presents suggestions back to the user.
func GetSubscriptionFilterSuggestions ¶
func GetSubscriptionFilterSuggestions() http.HandlerFunc
GetSubscriptionFilterSuggestions handles showing a list of subscriptions as suggestions when building a search query.
func HandleExternalError ¶ added in v0.36.0
func HandleExternalError(err error) http.HandlerFunc
HandleExternalError handles display errors on external pages.
func HandleInternalError ¶ added in v0.36.0
func HandleInternalError(err error) http.HandlerFunc
HandleInternalError handles display errors on internal pages (pages accessible to logged in users).
func HandleLandingPage ¶ added in v0.36.0
func HandleLandingPage() http.HandlerFunc
func HandleListSubscriptions ¶ added in v0.36.0
func HandleListSubscriptions() http.HandlerFunc
HandleListSubscriptions handles displaying a list of subscriptions.
func HandleLogin ¶ added in v0.36.0
func HandleLogin(res http.ResponseWriter, req *http.Request)
Login handles login requests.
func HandleLoginCallback ¶ added in v0.36.0
func HandleLoginCallback(res http.ResponseWriter, req *http.Request)
HandleLoginCallback handles processing the response from a login provider.
func HandleLoginError ¶ added in v0.36.0
func HandleLoginError(res http.ResponseWriter, req *http.Request)
HandleLoginError handles login errors, including invalid login callback URL, missing parameters, expired password reset links.
func HandleNotFound ¶ added in v0.36.0
func HandleNotFound() http.HandlerFunc
NotFound handles showing a page for a 404 response.
func HandleViewer ¶ added in v0.36.0
func HandleViewer() http.HandlerFunc
HandlViewer handles powering the feed viewer page.
func ImageProxy ¶
func ImageProxy(proxyURLBase string) http.HandlerFunc
func ImportSubscriptions ¶
func ImportSubscriptions() http.HandlerFunc
ImportSubscriptions handles assisting the user with importing subscriptions from an external source.
func ListArticles ¶
func ListArticles() http.HandlerFunc
ListArticles handles fetching articles based on the given page filters and displaying them.
func ListCategories ¶ added in v0.27.0
func ListCategories() http.HandlerFunc
ListCategories handles returning a list of categories that can be used for filtering subscriptions or articles.
func ListFavorites ¶
func ListFavorites() http.HandlerFunc
ListFavorites handles fetching the favorite subscriptions and articles of a user and showing them in a grid layout.
func LoadCachedImage ¶
func LoadCachedImage(res http.ResponseWriter, req *http.Request)
LoadCachedImage handles fetching and displaying an image from one of the image caches.
func Logout ¶
func Logout(res http.ResponseWriter, req *http.Request)
Logout handles logout requests.
func MarkArticle ¶
func MarkArticle() http.HandlerFunc
MarkArticle handles marking an article as read/unread and updates the UI accordingly.
func MarkArticles ¶
func MarkArticles() http.HandlerFunc
MarkArticles handles marking multiple articles as read/unread and updating the UI appropriately.
func MarkSubscription ¶
func MarkSubscription() http.HandlerFunc
MarkSubscription handles marking a subscription as read/unread and updates the UI accordingly.
func MarkSubscriptions ¶
func MarkSubscriptions() http.HandlerFunc
MarkSubscriptions handles marking a list of subscriptions.
func NotFound ¶
func NotFound() http.HandlerFunc
NotFound handles showing a page for a 404 response.
func PaginateArticles ¶
func PaginateArticles() http.HandlerFunc
PaginateArticles handles a request to list more articles.
func PolicyDocsHandler ¶
func PolicyDocsHandler() http.HandlerFunc
PolicyDocsHandler handles serving policy Markdown documents from directory in the embedded fs.
func PostsHandler ¶ added in v0.36.0
func PostsHandler() http.HandlerFunc
PostsHandler handles showing posts.
func RemoveSubscription ¶
func RemoveSubscription() http.HandlerFunc
RemoveSubscription handles removing (unsubscribing) from a subscription.
func RenderPage ¶ added in v0.36.0
func RenderPage(content FullResponseHandler) http.HandlerFunc
func RenderPartial ¶ added in v0.36.0
func RenderPartial(content PartialResponseHandler) http.HandlerFunc
func RobotsHandler ¶
RobotsHandler handles requests for robots.txt. In the future, it may handle more requests from non natural human clients...
func SaveAccountSettings ¶
func SaveAccountSettings() http.HandlerFunc
SaveAccountSettings handles processing and saving new account settings.
func SaveDisplaySettings ¶
func SaveDisplaySettings() http.HandlerFunc
SaveDisplaySettings handles saving user settings after user submitted changes.
func SaveSubscription ¶
func SaveSubscription() http.HandlerFunc
SaveSubscription handles saving the edits made by a user to a subscription.
func SetTheme ¶
func SetTheme() http.HandlerFunc
SetTheme handles setting a theme selected by the user.
func ShareArticle ¶ added in v0.34.1
func ShareArticle() http.HandlerFunc
ShareArticle handles sharing an article.
func ShowAccountSettings ¶
func ShowAccountSettings() http.HandlerFunc
ShowAccountSettings handles showing the settings related to user accounts.
func ShowDisplaySettings ¶
func ShowDisplaySettings() http.HandlerFunc
ShowDisplaySettings handles showing the settings related to the application display.
func ShowSettings ¶
func ShowSettings() http.HandlerFunc
ShowSettings handles retrieving and rendering the user settings page.
func StaticFileHandler ¶
func StaticFileHandler(fs http.FileSystem) http.Handler
StaticFileHandler handles serving content from the embedded filesystem containing static assets (i.e., images, etc.).
func SubmitObjectIssues ¶
func SubmitObjectIssues() http.HandlerFunc
SubmitObjectIssues handles processing the issue form and creating a github issue with the details.
func SubmitPageIssues ¶
func SubmitPageIssues() http.HandlerFunc
SubmitPageIssues handles processing the user submitted subscription issues form.
func UserAccountCancel ¶
func UserAccountCancel() http.HandlerFunc
func UserAccountIssue ¶
func UserAccountIssue() http.HandlerFunc
UserAccountIssue handles showing a page with a message indicating the user needs to contact support, as there is a critical issue with their account blocking access to the service.
func UserAccountSuccess ¶
func UserAccountSuccess() http.HandlerFunc
func UserCancelDeactivation ¶
func UserCancelDeactivation() http.HandlerFunc
UserCancelDeactivation handles a user request to stop the pending deactivation of their account. The cancellation will be reversed in Stripe and full account functionality restored.
func UserChooseSubscriptionPlan ¶
func UserChooseSubscriptionPlan() http.HandlerFunc
UserChooseSubscriptionPlan handles displaying a page on which the user can choose a subscription plan for purchase.
func UserDeactivateAccount ¶
func UserDeactivateAccount() http.HandlerFunc
UserDeactivateAccount handles a user request to deactivate their account. Their subscription in Stripe will be cancelled at the end of the current billing period. They can continue to log in and use the service during the current billing period, after which a scheduled job will delete their account.
func UserManageAccountSubscription ¶
func UserManageAccountSubscription() http.HandlerFunc
func UserSubscriptionPlanCheckout ¶
func UserSubscriptionPlanCheckout() http.HandlerFunc
UserSubscriptionPlanCheckout handles processing the user's choice of subscription plan and redirecting to the payment processor.
func ViewArticle ¶
func ViewArticle() http.HandlerFunc
ViewArticle handles showing an article's content.
func WatchHome ¶
func WatchHome() http.HandlerFunc
WatchHome handles watching the home page content (namely, latest articles) for updates.
func WatchList ¶
func WatchList() http.HandlerFunc
WatchList handles watching a list of object for any updates and rendering a notification to the user to refresh the page.
func WatchSearchResults ¶
func WatchSearchResults() http.HandlerFunc
WatchSearchResults handles watching the search results for any updates and rendering a notification to the user to refresh the page.
Types ¶
type ExternalError ¶ added in v0.36.0
type ExternalError struct {
// contains filtered or unexported fields
}
ExternalError represents errors shown on external (public) pages.
func (*ExternalError) FullResponse ¶ added in v0.36.0
func (p *ExternalError) FullResponse(res http.ResponseWriter, req *http.Request)
FullResponse renders the error on a full page.
func (*ExternalError) PartialResponse ¶ added in v0.36.0
func (p *ExternalError) PartialResponse(res http.ResponseWriter, req *http.Request)
PartialResponse renders the error message itself.
type FullResponseHandler ¶ added in v0.36.0
type FullResponseHandler interface {
PartialResponseHandler
FullResponse(w http.ResponseWriter, r *http.Request)
}
type InternalError ¶ added in v0.36.0
type InternalError struct {
// contains filtered or unexported fields
}
InternalError represents errors shown on internal (pages accessible to logged in users) pages.
func (*InternalError) FullResponse ¶ added in v0.36.0
func (p *InternalError) FullResponse(res http.ResponseWriter, req *http.Request)
FullResponse renders the error message on a full page.
func (*InternalError) PartialResponse ¶ added in v0.36.0
func (p *InternalError) PartialResponse(res http.ResponseWriter, req *http.Request)
PartialResponse will render the error in the content area for GET requests, as a notification otherwise.
type LandingPage ¶ added in v0.36.0
type LandingPage struct {
// contains filtered or unexported fields
}
func (*LandingPage) FullResponse ¶ added in v0.36.0
func (p *LandingPage) FullResponse(w http.ResponseWriter, r *http.Request)
func (*LandingPage) PartialResponse ¶ added in v0.36.0
func (p *LandingPage) PartialResponse(w http.ResponseWriter, r *http.Request)
type ListSubscriptions ¶
type ListSubscriptions struct {
// contains filtered or unexported fields
}
ListSubscriptions holds data for generating the subscriptions list page.
func (*ListSubscriptions) FullResponse ¶ added in v0.36.0
func (p *ListSubscriptions) FullResponse(res http.ResponseWriter, req *http.Request)
FullResponse renders a full page (headers, footers and list of subscriptions).
func (*ListSubscriptions) PartialResponse ¶ added in v0.36.0
func (p *ListSubscriptions) PartialResponse(res http.ResponseWriter, req *http.Request)
PartialResponse will either render the list of subscriptions, the controls and update the title/dock/sidebar or, when paginating, just the list of subscriptions.
type Login ¶
type Login struct {
// contains filtered or unexported fields
}
func (*Login) FullResponse ¶ added in v0.36.0
func (p *Login) FullResponse(w http.ResponseWriter, r *http.Request)
func (*Login) PartialResponse ¶ added in v0.36.0
func (p *Login) PartialResponse(w http.ResponseWriter, r *http.Request)
type NotFoundPage ¶ added in v0.36.0
type NotFoundPage struct{}
func (*NotFoundPage) FullResponse ¶ added in v0.36.0
func (p *NotFoundPage) FullResponse(w http.ResponseWriter, r *http.Request)
func (*NotFoundPage) PartialResponse ¶ added in v0.36.0
func (p *NotFoundPage) PartialResponse(w http.ResponseWriter, r *http.Request)
type PartialResponseHandler ¶ added in v0.36.0
type PartialResponseHandler interface {
PartialResponse(w http.ResponseWriter, r *http.Request)
}
type Viewer ¶ added in v0.21.0
type Viewer struct {
// contains filtered or unexported fields
}
Viewer holds data for the feed viewer page.
func (*Viewer) FullResponse ¶ added in v0.36.0
func (p *Viewer) FullResponse(res http.ResponseWriter, req *http.Request)
FullResponse renders the full viewer page.
func (*Viewer) PartialResponse ¶ added in v0.36.0
func (p *Viewer) PartialResponse(res http.ResponseWriter, req *http.Request)
PartialResponse returns no content for the viewer as partials are unsupported.
type ViewerError ¶ added in v0.36.0
type ViewerError struct {
// contains filtered or unexported fields
}
ViewerError holds an error when the viewer failed to parse a url.
func (*ViewerError) PartialResponse ¶ added in v0.36.0
func (p *ViewerError) PartialResponse(res http.ResponseWriter, req *http.Request)
PartialResponse renders an error as the viewer response.