From d44ed46ee92c78aaaed64975c4d6846613963be4 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 1 Sep 2015 08:55:23 +0000 Subject: implement per-thread Atom feeds This allows users to subscribe to only a single thread with their feed reader without subscribing to the rest of the thread. Update our endpoint notes while we're at it. --- lib/PublicInbox/WWW.pm | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/PublicInbox/WWW.pm') diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm index e6eec3d6..c99c25f8 100644 --- a/lib/PublicInbox/WWW.pm +++ b/lib/PublicInbox/WWW.pm @@ -56,6 +56,9 @@ sub run { invalid_list_mid(\%ctx, $1, $2) || get_thread_mbox(\%ctx, $sfx); + } elsif ($path_info =~ m!$LISTNAME_RE/t/(\S+)/atom\z!o) { + invalid_list_mid(\%ctx, $1, $2) || get_thread_atom(\%ctx); + # legacy redirects } elsif ($path_info =~ m!$LISTNAME_RE/(t|m|f)/(\S+)\.html\z!o) { my $pfx = $2; @@ -348,4 +351,14 @@ sub get_thread_mbox { PublicInbox::Mbox::thread_mbox($ctx, $srch, $sfx); } + +# /$LISTNAME/t/$MESSAGE_ID/atom -> thread as Atom feed +sub get_thread_atom { + my ($ctx) = @_; + searcher($ctx) or return need_search($ctx); + $ctx->{self_url} = self_url($ctx->{cgi}); + require PublicInbox::Feed; + PublicInbox::Feed::generate_thread_atom($ctx); +} + 1; -- cgit v1.2.3-24-ge0c7