Add missing handlers
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
package internal
|
package internal
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -17,14 +16,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
MediaResolution = 720 // 720x576
|
MaxFailedLogins = 3 // By default 3 failed login attempts per 5 minutes
|
||||||
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")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *Server) NotFoundHandler(w http.ResponseWriter, r *http.Request) {
|
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)
|
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"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"git.mills.io/prologic/spyda/internal/session"
|
|
||||||
"github.com/julienschmidt/httprouter"
|
"github.com/julienschmidt/httprouter"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/steambap/captcha"
|
"github.com/steambap/captcha"
|
||||||
|
|
||||||
|
"git.mills.io/prologic/spyda/internal/session"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CaptchaHandler ...
|
// CaptchaHandler ...
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ type TemplateManager struct {
|
|||||||
funcMap template.FuncMap
|
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)
|
templates := make(map[string]*template.Template)
|
||||||
|
|
||||||
funcMap := sprig.FuncMap()
|
funcMap := sprig.FuncMap()
|
||||||
|
|||||||
Reference in New Issue
Block a user