From 18617f1dbc682a1356527cd5c08ec6d922159cf9 Mon Sep 17 00:00:00 2001 From: Jason Streifling Date: Sun, 1 Sep 2024 18:48:18 +0200 Subject: [PATCH] Give autogenerated articles tags as well --- cmd/backend/rss.go | 5 ++++- cmd/frontend/issues.go | 1 - cmd/frontend/pdf.go | 7 ------- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/cmd/backend/rss.go b/cmd/backend/rss.go index e79a73c..b03ead5 100644 --- a/cmd/backend/rss.go +++ b/cmd/backend/rss.go @@ -32,9 +32,12 @@ func GenerateRSS(c *Config, db *DB) (*string, error) { tagNames = append(tagNames, tag.Name) } - if article.IsInIssue { + if article.IsInIssue || article.AutoGenerated { tagNames = append(tagNames, fmt.Sprint("Orient Express ", article.IssueID)) } + if article.AutoGenerated { + tagNames = append(tagNames, "autogenerated") + } user, err := db.GetUser(article.AuthorID) if err != nil { diff --git a/cmd/frontend/issues.go b/cmd/frontend/issues.go index 47e32ae..10eefce 100644 --- a/cmd/frontend/issues.go +++ b/cmd/frontend/issues.go @@ -69,7 +69,6 @@ func PublishLatestIssue(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFun AuthorID: session.Values["id"].(int64), AutoGenerated: true, } - fmt.Println(article.Link) article.ID, err = db.AddArticle(article) if err != nil { diff --git a/cmd/frontend/pdf.go b/cmd/frontend/pdf.go index e00069c..ac9176a 100644 --- a/cmd/frontend/pdf.go +++ b/cmd/frontend/pdf.go @@ -14,19 +14,16 @@ import ( func UploadPDF(c *b.Config, s *b.CookieStore) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - fmt.Println("Content-Type:", r.Header.Get("Content-Type")) if _, err := getSession(w, r, c, s); err != nil { return } - fmt.Println(1) if err := r.ParseMultipartForm(10 << 20); err != nil { log.Println(err) http.Error(w, err.Error(), http.StatusBadRequest) return } - fmt.Println(2) file, _, err := r.FormFile("pdf-upload") if err != nil { log.Println(err) @@ -35,7 +32,6 @@ func UploadPDF(c *b.Config, s *b.CookieStore) http.HandlerFunc { } defer file.Close() - fmt.Println(3) filename := fmt.Sprint(uuid.New(), ".pdf") absFilepath, err := filepath.Abs(fmt.Sprint(c.PDFDir, "/", filename)) if err != nil { @@ -44,7 +40,6 @@ func UploadPDF(c *b.Config, s *b.CookieStore) http.HandlerFunc { return } - fmt.Println(4) pdf, err := os.Create(absFilepath) if err != nil { log.Println(err) @@ -53,14 +48,12 @@ func UploadPDF(c *b.Config, s *b.CookieStore) http.HandlerFunc { } defer pdf.Close() - fmt.Println(5) if _, err = io.Copy(pdf, file); err != nil { log.Println(err) http.Error(w, err.Error(), http.StatusInternalServerError) return } - fmt.Println(6) w.WriteHeader(http.StatusOK) } }