From e3ce1d7b551c4d2b365019de54f3375a3b7dce49 Mon Sep 17 00:00:00 2001 From: Jason Streifling Date: Thu, 4 Apr 2024 17:13:42 +0200 Subject: [PATCH] Simply provide RSS feed when GET request is received --- cmd/main.go | 2 +- cmd/view/rss.go | 15 --------------- web/templates/hub.html | 2 +- 3 files changed, 2 insertions(+), 17 deletions(-) delete mode 100644 cmd/view/rss.go diff --git a/cmd/main.go b/cmd/main.go index 2749faa..dbca8bf 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -60,7 +60,7 @@ func main() { mux.HandleFunc("GET /rejected-articles", view.ShowRejectedArticles(args, db, store)) mux.HandleFunc("GET /review-rejected-article/{id}", view.ReviewRejectedArticle(args, db, store)) mux.HandleFunc("GET /review-unpublished-article/{id}", view.ReviewUnpublishedArticle(args, db, store)) - mux.HandleFunc("GET /rss", view.ShowRSS(args)) + mux.HandleFunc("GET /rss", func(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, args.RSSFile) }) mux.HandleFunc("GET /this-issue", view.ShowCurrentArticles(args, db)) mux.HandleFunc("GET /unpublished-articles", view.ShowUnpublishedArticles(args, db)) mux.HandleFunc("GET /write-article", view.WriteArticle(args, db)) diff --git a/cmd/view/rss.go b/cmd/view/rss.go deleted file mode 100644 index 6338913..0000000 --- a/cmd/view/rss.go +++ /dev/null @@ -1,15 +0,0 @@ -package view - -import ( - "net/http" - "path/filepath" - - "streifling.com/jason/cpolis/cmd/control" -) - -func ShowRSS(c *control.CliArgs) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - w.Header().Add("Content-Disposition", "attachment; filename=\""+filepath.Base(c.RSSFile)+"\"") - http.ServeFile(w, r, c.RSSFile) - } -} diff --git a/web/templates/hub.html b/web/templates/hub.html index 09cf905..3ddb97f 100644 --- a/web/templates/hub.html +++ b/web/templates/hub.html @@ -7,7 +7,7 @@
- RSS Feed + RSS Feed