From d69f561c55632c26d0473c888ebc0a02ae8bef6d Mon Sep 17 00:00:00 2001 From: partisan Date: Thu, 22 Aug 2024 19:10:14 +0200 Subject: [PATCH] oopsie --- main.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/main.go b/main.go index be607fa..aed5dde 100644 --- a/main.go +++ b/main.go @@ -106,6 +106,16 @@ func main() { // Serve static files (CSS, JS, etc.) from the /static directory http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir(staticDir)))) + // Serve downloads.html at /downloads + http.HandleFunc("/download", func(w http.ResponseWriter, r *http.Request) { + renderTemplate(w, "download.html", nil) + }) + + // Serve download-linux.html at /download-linux + http.HandleFunc("/download-linux", func(w http.ResponseWriter, r *http.Request) { + renderTemplate(w, "download-linux.html", nil) + }) + // Define route handlers http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { if r.URL.Path == "/" { @@ -452,14 +462,6 @@ func updateBlogEntries(blogName, path string) { log.Printf("Created new blog %s with entry %d", blogName, entry.Number) } -func getFileModTime(path string) (time.Time, error) { - info, err := os.Stat(path) - if err != nil { - return time.Time{}, err - } - return info.ModTime(), nil -} - func sendNotifications(entry BlogEntry) { message := fmt.Sprintf("New blog post published!\nTitle: %s\nDescription: %s\nAuthor: %s\nDate: %s", entry.Title, entry.Description, entry.Author, entry.Date.Format("2006-01-02 15:04"))