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.

Add subscribe button in article view for non subscribed feeds

+13 -3
+5 -2
internal/server/articles_handler.go
··· 91 91 if feed, err := s.db.GetFeed(r.Context(), feedURL); err == nil { 92 92 data["Feed"] = feed 93 93 } 94 - unreadCount, _ := s.db.GetUnreadCount(r.Context(), user.DID, feedURL) 95 - data["FeedUnreadCount"] = unreadCount 94 + if _, err := s.db.GetSubscription(r.Context(), user.DID, feedURL); err == nil { 95 + data["IsSubscribed"] = true 96 + } else { 97 + data["IsSubscribed"] = false 98 + } 96 99 } 97 100 98 101 if r.Header.Get("HX-Request") == "true" {
+8 -1
internal/tmpl/articles.html
··· 15 15 </div> 16 16 </div> 17 17 <div class="flex items-center gap-3"> 18 - {{if .FeedUnreadCount}}<span class="text-xs bg-spot-green/20 text-spot-green px-2.5 py-0.5 rounded-full font-bold">{{.FeedUnreadCount}} unread</span>{{end}} 18 + {{if not .IsSubscribed}} 19 + <form hx-post="/feeds/add" hx-swap="none" hx-on::after-request="if(event.detail.successful) window.location.reload()"> 20 + {{csrfInput .CSRFToken}} 21 + <input type="hidden" name="feed_url" value="{{.FeedURL}}"> 22 + <button type="submit" class="bg-spot-green text-white rounded-pill px-4 py-1.5 text-xs font-bold uppercase tracking-button hover:brightness-110 transition">Subscribe</button> 23 + </form> 24 + {{else}} 19 25 <form hx-post="/articles/mark-all-read" hx-confirm="Mark all articles as read?"> 20 26 {{csrfInput .CSRFToken}} 21 27 <input type="hidden" name="feed" value="{{.FeedURL}}"> 22 28 <button type="submit" class="border border-spot-outline text-spot-text rounded-pill px-4 py-1.5 text-xs font-bold uppercase tracking-button hover:border-spot-text transition">Mark all read</button> 23 29 </form> 30 + {{end}} 24 31 </div> 25 32 </div> 26 33 {{if .Feed.Description.Valid}}<p class="text-sm text-spot-secondary mt-2">{{.Feed.Description.String}}</p>{{end}}