Converted RSS package to git.streifling.com/jason/rss
This commit is contained in:
@ -6,8 +6,8 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"git.streifling.com/jason/rss"
|
||||
"github.com/google/uuid"
|
||||
"github.com/gorilla/feeds"
|
||||
"streifling.com/jason/cpolis/cmd/data"
|
||||
)
|
||||
|
||||
@ -116,7 +116,7 @@ func ReviewArticle(al *data.ArticleList, s *data.CookieStore) http.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
func PublishArticle(f *data.Feed, al *data.ArticleList, s *data.CookieStore) http.HandlerFunc {
|
||||
func PublishArticle(c *data.Channel, al *data.ArticleList, s *data.CookieStore) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
uuid, err := uuid.Parse(r.PostFormValue("uuid"))
|
||||
if err != nil {
|
||||
@ -141,14 +141,14 @@ func PublishArticle(f *data.Feed, al *data.ArticleList, s *data.CookieStore) htt
|
||||
template.Must(tmpl, err).ExecuteTemplate(w, "page-content", msg)
|
||||
}
|
||||
|
||||
f.Add(&feeds.Item{
|
||||
c.Add(&rss.Item{
|
||||
Title: article.Title,
|
||||
Author: &feeds.Author{Name: session.Values["name"].(string)},
|
||||
Created: article.Created,
|
||||
Author: session.Values["name"].(string),
|
||||
PubDate: article.Created.Format(time.RFC1123Z),
|
||||
Description: article.Desc,
|
||||
Content: article.Content,
|
||||
Content: &rss.Content{Value: article.Content},
|
||||
})
|
||||
f.Save("tmp/rss.gob")
|
||||
c.Save("tmp/rss.gob")
|
||||
|
||||
tmpl, err := template.ParseFiles("web/templates/hub.html")
|
||||
tmpl = template.Must(tmpl, err)
|
||||
|
@ -5,13 +5,16 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"git.streifling.com/jason/rss"
|
||||
"streifling.com/jason/cpolis/cmd/data"
|
||||
)
|
||||
|
||||
func ShowRSS(f *data.Feed) http.HandlerFunc {
|
||||
func ShowRSS(c *data.Channel) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
feed := f.Get()
|
||||
rss, err := feed.ToRss()
|
||||
channel := c.Get()
|
||||
feed := rss.NewFeed()
|
||||
feed.Channels = append(feed.Channels, &channel)
|
||||
rss, err := feed.ToXML()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
|
Reference in New Issue
Block a user