1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-01 17:38:37 +00:00

Add bookmarklet

This commit is contained in:
Frédéric Guillot 2017-11-21 19:37:47 -08:00
parent 1bc43ec2bc
commit 6690f6a70e
26 changed files with 244 additions and 48 deletions

View file

@ -18,16 +18,19 @@ import (
"github.com/gorilla/mux"
)
// HandlerFunc is an application HTTP handler.
type HandlerFunc func(ctx *Context, request *Request, response *Response)
// Handler manages HTTP handlers and middlewares.
type Handler struct {
store *storage.Storage
translator *locale.Translator
template *template.TemplateEngine
template *template.Engine
router *mux.Router
middleware *middleware.MiddlewareChain
}
// Use is a wrapper around an HTTP handler.
func (h *Handler) Use(f HandlerFunc) http.Handler {
return h.middleware.WrapFunc(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
defer helper.ExecutionTime(time.Now(), r.URL.Path)
@ -47,7 +50,8 @@ func (h *Handler) Use(f HandlerFunc) http.Handler {
}))
}
func NewHandler(store *storage.Storage, router *mux.Router, template *template.TemplateEngine, translator *locale.Translator, middleware *middleware.MiddlewareChain) *Handler {
// NewHandler returns a new Handler.
func NewHandler(store *storage.Storage, router *mux.Router, template *template.Engine, translator *locale.Translator, middleware *middleware.MiddlewareChain) *Handler {
return &Handler{
store: store,
translator: translator,

View file

@ -15,7 +15,7 @@ import (
type HTMLResponse struct {
writer http.ResponseWriter
request *http.Request
template *template.TemplateEngine
template *template.Engine
}
// Render execute a template and send to the client the generated HTML.

View file

@ -15,7 +15,7 @@ import (
type Response struct {
writer http.ResponseWriter
request *http.Request
template *template.TemplateEngine
template *template.Engine
}
// SetCookie send a cookie to the client.
@ -67,6 +67,6 @@ func (r *Response) commonHeaders() {
}
// NewResponse returns a new Response.
func NewResponse(w http.ResponseWriter, r *http.Request, template *template.TemplateEngine) *Response {
func NewResponse(w http.ResponseWriter, r *http.Request, template *template.Engine) *Response {
return &Response{writer: w, request: r, template: template}
}