forked from jason/cpolis
Instead of having entire articles in the RSS feed, items now contain just a link
This commit is contained in:
@ -11,23 +11,25 @@ import (
|
||||
|
||||
func ServeArticle(c *b.Config, db *b.DB) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
if tokenIsVerified(w, r, c) {
|
||||
idString := r.PathValue("id")
|
||||
id, err := strconv.ParseInt(idString, 10, 64)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
article, err := db.GetArticle(id)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Fprint(w, article.Content)
|
||||
if !tokenIsVerified(w, r, c) {
|
||||
return
|
||||
}
|
||||
|
||||
idString := r.PathValue("id")
|
||||
id, err := strconv.ParseInt(idString, 10, 64)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
article, err := db.GetArticle(id)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Fprint(w, article.Content)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user