From b39e6e140d7a074dfb5c7b768285736511e04d97 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 21 Apr 2014 10:00:21 +0000 Subject: feed: there is only one atom feed, with all messages This is not a blog. All posts, whether replies or not, carry equal weight. --- Documentation/design_www.txt | 3 +-- lib/PublicInbox/Feed.pm | 8 ++++---- public-inbox.cgi | 7 ++----- t/cgi.t | 5 +---- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Documentation/design_www.txt b/Documentation/design_www.txt index 0d25a45a..226a22c9 100644 --- a/Documentation/design_www.txt +++ b/Documentation/design_www.txt @@ -3,8 +3,7 @@ URL naming ### Unstable endpoints /$LISTNAME/?r=$GIT_COMMIT -> HTML only -/$LISTNAME/index.atom.xml -> Atom feed -/$LISTNAME/all.atom.xml -> Atom feed, includes replies +/$LISTNAME/atom.xml -> Atom feed ### Stable endpoints /$LISTNAME/m/$MESSAGE_ID.html -> HTML content (short quotes) diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index 6658a52b..0f0528c9 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -39,7 +39,7 @@ sub generate { link => { rel => 'self', href => $feed_opts->{atomurl} || - "http://example.com/atom", + "http://example.com/atom.xml", }, id => $feed_opts->{address} || 'public-inbox@example.com', updated => POSIX::strftime(DATEFMT, gmtime), @@ -208,15 +208,15 @@ sub get_feedopts { my $base = $cgi->url(-base); $url_base = $cgi_url; if ($url_base =~ s!/(?:|index\.html)?\z!!) { - $rv{atomurl} = "$base$url_base/index.atom.xml"; + $rv{atomurl} = "$base$url_base/atom.xml"; } else { - $url_base =~ s!/?(?:index|all)\.atom\.xml\z!!; + $url_base =~ s!/atom\.xml\z!!; $rv{atomurl} = $base . $cgi_url; $url_base = $base . $url_base; # XXX is this needed? } } else { $url_base = "http://example.com"; - $rv{atomurl} = "$url_base/index.atom.xml"; + $rv{atomurl} = "$url_base/atom.xml"; } $rv{url} ||= "$url_base/"; $rv{midurl} = "$url_base/m/"; diff --git a/public-inbox.cgi b/public-inbox.cgi index 03202c61..33313bf5 100755 --- a/public-inbox.cgi +++ b/public-inbox.cgi @@ -65,9 +65,7 @@ sub main { invalid_list(\%ctx, $1) || redirect_list_index(\%ctx, $cgi); } elsif ($path_info =~ m!$LISTNAME_RE(?:/|/index\.html)?\z!o) { invalid_list(\%ctx, $1) || get_index(\%ctx, $cgi, 0); - } elsif ($path_info =~ m!$LISTNAME_RE/index\.atom\.xml\z!o) { - invalid_list(\%ctx, $1) || get_atom(\%ctx, $cgi, 1); - } elsif ($path_info =~ m!$LISTNAME_RE/all\.atom\.xml\z!o) { + } elsif ($path_info =~ m!$LISTNAME_RE/atom\.xml\z!o) { invalid_list(\%ctx, $1) || get_atom(\%ctx, $cgi, 0); # single-message pages @@ -114,8 +112,7 @@ sub invalid_list_mid { undef; } -# /$LISTNAME/index.atom.xml -> Atom feed -# /$LISTNAME/all.atom.xml -> Atom feed, includes replies +# /$LISTNAME/atom.xml -> Atom feed, includes replies sub get_atom { my ($ctx, $cgi, $top) = @_; require PublicInbox::Feed; diff --git a/t/cgi.t b/t/cgi.t index f7035228..365acd84 100644 --- a/t/cgi.t +++ b/t/cgi.t @@ -102,16 +102,13 @@ EOF # atom feeds { local $ENV{HOME} = $home; - my $res = cgi_run("/test/all.atom.xml"); + my $res = cgi_run("/test/atom.xml"); like($res->{body}, qr/test for public-inbox/, "set title in XML feed"); like($res->{body}, qr!http://test\.example\.com/test/m/blah%40example\.com!, "link id set"); like($res->{body}, qr/what\?/, "reply included"); - - $res = cgi_run("/test/index.atom.xml"); - unlike($res->{body}, qr/what\?/, "reply not included in index"); } # indices -- cgit v1.2.3-24-ge0c7