Deleted ServePDFs() and added ServePDF()
This commit is contained in:
parent
f4ae2f9c04
commit
c7add76a12
@ -5,7 +5,6 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
|
|
||||||
b "streifling.com/jason/cpolis/cmd/backend"
|
b "streifling.com/jason/cpolis/cmd/backend"
|
||||||
)
|
)
|
||||||
@ -60,15 +59,10 @@ func ServePDFList(c *b.Config) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ServePDFs(c *b.Config) http.HandlerFunc {
|
func ServePDF(c *b.Config) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
if tokenIsVerified(w, r) {
|
if tokenIsVerified(w, r) {
|
||||||
pdfIDsString := r.PathValue("ids")
|
http.ServeFile(w, r, r.PathValue("id"))
|
||||||
pdfIDs := strings.Split(pdfIDsString, ",")
|
|
||||||
|
|
||||||
for _, id := range pdfIDs {
|
|
||||||
http.ServeFile(w, r, id)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,7 @@ func main() {
|
|||||||
mux.HandleFunc("GET /hub", f.ShowHub(config, db, store))
|
mux.HandleFunc("GET /hub", f.ShowHub(config, db, store))
|
||||||
mux.HandleFunc("GET /logout", f.Logout(config, store))
|
mux.HandleFunc("GET /logout", f.Logout(config, store))
|
||||||
mux.HandleFunc("GET /pdf/get-list", f.ServePDFList(config))
|
mux.HandleFunc("GET /pdf/get-list", f.ServePDFList(config))
|
||||||
|
mux.HandleFunc("GET /pdf/{id}", f.ServePDF(config))
|
||||||
mux.HandleFunc("GET /pics/{pic}", f.ServeImage(config, store))
|
mux.HandleFunc("GET /pics/{pic}", f.ServeImage(config, store))
|
||||||
mux.HandleFunc("GET /publish-article/{id}", f.PublishArticle(config, db, store))
|
mux.HandleFunc("GET /publish-article/{id}", f.PublishArticle(config, db, store))
|
||||||
mux.HandleFunc("GET /publish-issue", f.PublishLatestIssue(config, db, store))
|
mux.HandleFunc("GET /publish-issue", f.PublishLatestIssue(config, db, store))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user