Commit 0c37db1

Eric Bower  ·  2026-03-08 09:45:46 -0400 EDT
parent 12c3f12
fix(feeds): parse urls properly with comments
2 files changed,  +15, -11
+2, -2
......@@ -23,8 +23,8 @@ func NewConfigSite(service string) *shared.ConfigSite {
2323 Protocol: protocol,
2424 DbURL: dbURL,
2525 Space: "feeds",
26- AllowedExt: []string{".txt"},
27- HiddenPosts: []string{"_header.txt", "_readme.txt"},
26+ AllowedExt: []string{".txt", ".lxt"},
27+ HiddenPosts: []string{},
2828 Logger: shared.CreateLogger(service, withPipe),
2929 }
3030 }
+13, -9
......@@ -227,25 +227,25 @@ func (f *Fetcher) RunPost(logger *slog.Logger, user *db.User, isPicoPlus bool, p
227227
228228 urls := []string{}
229229 for _, item := range parsed.Items {
230- u := ""
231- if item.IsText || item.IsURL {
232- u = item.Value
230+ rawUrl := ""
231+ if item.IsText {
232+ rawUrl = string(item.Value)
233233 } else if item.IsURL {
234- u = string(item.Value)
234+ rawUrl = string(item.URL)
235235 }
236236
237- if u == "" {
237+ if rawUrl == "" {
238238 continue
239239 }
240240
241- _, err := url.Parse(string(item.URL))
241+ _, err := url.Parse(rawUrl)
242242 if err != nil {
243- logger.Info("invalid url", "url", string(item.URL))
243+ logger.Info("invalid url", "url", rawUrl)
244244 continue
245245 }
246246
247- logger.Info("found rss feed url", "url", u)
248- urls = append(urls, u)
247+ logger.Info("found rss feed url", "url", rawUrl)
248+ urls = append(urls, rawUrl)
249249 }
250250
251251 if post.ExpiresAt == nil {
......@@ -344,6 +344,10 @@ func (f *Fetcher) RunUser(user *db.User, now time.Time) error {
344344 }
345345 }
346346
347+ if !isPicoPlus {
348+ return fmt.Errorf("must be pico+ user to receive rss digests")
349+ }
350+
347351 if len(posts.Data) > 0 {
348352 logger.Info("found feed posts", "len", len(posts.Data))
349353 }