Add missing handlers
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"net/http"
|
||||
@@ -17,14 +16,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
MediaResolution = 720 // 720x576
|
||||
AvatarResolution = 360 // 360x360
|
||||
AsyncTaskLimit = 5
|
||||
MaxFailedLogins = 3 // By default 3 failed login attempts per 5 minutes
|
||||
)
|
||||
|
||||
var (
|
||||
ErrFeedImposter = errors.New("error: imposter detected, you do not own this feed")
|
||||
MaxFailedLogins = 3 // By default 3 failed login attempts per 5 minutes
|
||||
)
|
||||
|
||||
func (s *Server) NotFoundHandler(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -98,3 +90,27 @@ func (s *Server) PageHandler(name string) httprouter.Handle {
|
||||
s.render("page", w, ctx)
|
||||
}
|
||||
}
|
||||
|
||||
// IndexHandler ...
|
||||
func (s *Server) IndexHandler(name string) httprouter.Handle {
|
||||
return func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
|
||||
ctx := NewContext(s.config, s.db, r)
|
||||
s.render("index", w, ctx)
|
||||
}
|
||||
}
|
||||
|
||||
// CachedHandler ...
|
||||
func (s *Server) CachedHandler(name string) httprouter.Handle {
|
||||
return func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
|
||||
ctx := NewContext(s.config, s.db, r)
|
||||
s.render("cached", w, ctx)
|
||||
}
|
||||
}
|
||||
|
||||
// SearchHandler ...
|
||||
func (s *Server) SearchHandler(name string) httprouter.Handle {
|
||||
return func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
|
||||
ctx := NewContext(s.config, s.db, r)
|
||||
s.render("search", w, ctx)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,11 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"git.mills.io/prologic/spyda/internal/session"
|
||||
"github.com/julienschmidt/httprouter"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/steambap/captcha"
|
||||
|
||||
"git.mills.io/prologic/spyda/internal/session"
|
||||
)
|
||||
|
||||
// CaptchaHandler ...
|
||||
|
||||
@@ -31,7 +31,7 @@ type TemplateManager struct {
|
||||
funcMap template.FuncMap
|
||||
}
|
||||
|
||||
func NewTemplateManager(conf *Config, blogs *BlogsCache, cache *Cache) (*TemplateManager, error) {
|
||||
func NewTemplateManager(conf *Config) (*TemplateManager, error) {
|
||||
templates := make(map[string]*template.Template)
|
||||
|
||||
funcMap := sprig.FuncMap()
|
||||
|
||||
Reference in New Issue
Block a user