intake/web/source.go

28 lines
569 B
Go
Raw Normal View History

package web
import (
"net/http"
"github.com/Jaculabilis/intake/core"
"github.com/Jaculabilis/intake/web/html"
)
2025-01-28 00:38:02 +00:00
func (env *Env) getSource(writer http.ResponseWriter, req *http.Request) {
source := req.PathValue("source")
if source == "" {
http.NotFound(writer, req)
return
}
// TODO this needs to properly error if the source doesn't exist instead of just returning []
items, err := core.GetAllItemsForSource(env.db, source)
if err != nil {
http.NotFound(writer, req)
return
}
data := html.FeedData{
Items: items,
}
html.Feed(writer, data)
}