forked from jason/cpolis
Serve images from only one route enabling image previews in articles
This commit is contained in:
@ -6,12 +6,15 @@ import (
|
||||
"path/filepath"
|
||||
|
||||
b "streifling.com/jason/cpolis/cmd/backend"
|
||||
f "streifling.com/jason/cpolis/cmd/frontend"
|
||||
)
|
||||
|
||||
func ServeImage(c *b.Config) http.HandlerFunc {
|
||||
func ServeImage(c *b.Config, s *b.CookieStore) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
if !tokenIsVerified(w, r, c) {
|
||||
return
|
||||
if _, err := f.GetSession(w, r, c, s); err != nil {
|
||||
if !tokenIsVerified(w, r, c) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
absFilepath, err := filepath.Abs(c.PicsDir)
|
||||
|
Reference in New Issue
Block a user