oopsie
This commit is contained in:
parent
b890637222
commit
d69f561c55
1 changed files with 10 additions and 8 deletions
18
main.go
18
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"))
|
||||
|
|
Loading…
Reference in a new issue