A social RSS reader built on the AT Protocol. glean.at
glean atproto atmosphere rss feed social app
14
fork

Configure Feed

Select the types of activity you want to include in your feed.

Group OPML feeds by category in export

+31 -3
+28 -1
internal/feed/opml.go
··· 104 104 } 105 105 opml.Head.Title = title 106 106 107 + categoryMap := make(map[string][]Outline) 108 + var categories []string 107 109 for _, f := range feeds { 108 110 outline := Outline{ 109 111 Text: f.Title, ··· 111 113 XMLURL: f.URL, 112 114 HTMLURL: f.SiteURL, 113 115 } 114 - opml.Body.Outlines = append(opml.Body.Outlines, outline) 116 + if f.Category != "" { 117 + categoryMap[f.Category] = append(categoryMap[f.Category], outline) 118 + if !contains(categories, f.Category) { 119 + categories = append(categories, f.Category) 120 + } 121 + } else { 122 + opml.Body.Outlines = append(opml.Body.Outlines, outline) 123 + } 124 + } 125 + 126 + for _, cat := range categories { 127 + parent := Outline{ 128 + Text: cat, 129 + Title: cat, 130 + Outlines: categoryMap[cat], 131 + } 132 + opml.Body.Outlines = append(opml.Body.Outlines, parent) 115 133 } 116 134 117 135 var buf bytes.Buffer ··· 125 143 126 144 return buf.Bytes(), nil 127 145 } 146 + 147 + func contains(slice []string, s string) bool { 148 + for _, v := range slice { 149 + if v == s { 150 + return true 151 + } 152 + } 153 + return false 154 + }
+3 -2
internal/server/feeds_handler.go
··· 277 277 var feedURLs []feed.FeedURL 278 278 for _, sub := range subs { 279 279 feedURLs = append(feedURLs, feed.FeedURL{ 280 - URL: sub.FeedURL, 281 - Title: sub.FeedTitle, 280 + URL: sub.FeedURL, 281 + Title: sub.FeedTitle, 282 + Category: sub.Category.String, 282 283 }) 283 284 } 284 285