22 lines
462 B
Go
22 lines
462 B
Go
package calls
|
|
|
|
import (
|
|
"net/http"
|
|
"path/filepath"
|
|
|
|
b "streifling.com/jason/cpolis/cmd/backend"
|
|
f "streifling.com/jason/cpolis/cmd/frontend"
|
|
)
|
|
|
|
func ServeImage(c *b.Config, s map[string]*f.Session) http.HandlerFunc {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
if _, err := f.ManageSession(w, r, c, s); err != nil {
|
|
if !tokenIsVerified(w, r, c) {
|
|
return
|
|
}
|
|
}
|
|
|
|
http.ServeFile(w, r, filepath.Join(c.PicsDir, r.PathValue("pic")))
|
|
}
|
|
}
|