Compare commits

..

No commits in common. "8814467db999b194f413f3fce185654c98272ff0" and "ea8c2e4bbba3c63ea5c7e21e22f6b26cbbfa02cf" have entirely different histories.

2 changed files with 19 additions and 1 deletions

View File

@ -44,7 +44,7 @@ func RefreshFeed(feedUrl string) Feed {
feed = *foundFeed
}
} else if err != nil {
fmt.Printf("Failed to refresh %s - %v\n", feedUrl, err)
fmt.Printf("Failed to refresh %s\n%v\n", feedUrl, err)
} else {
imageURL := ""
if f.Image != nil {

View File

@ -2,7 +2,10 @@ package server
import (
"fmt"
"html/template"
"time"
"github.com/dustin/go-humanize"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/template/html"
@ -21,6 +24,21 @@ func Start(port string) error {
engine := html.New("./views", ".html")
engine.Reload(true)
engine.AddFunc("htmlSafe", func(html string) template.HTML {
return template.HTML(html)
})
engine.AddFunc("humanDate", func(date time.Time) template.HTML {
return template.HTML(humanize.Time(date))
})
engine.AddFunc("coalesce", func(args ...*string) string {
for _, s := range args {
if s != nil && *s != "" {
return *s
}
}
return ""
})
app := fiber.New(fiber.Config{
Views: engine,
})