----------
/$LISTNAME/?before=$GIT_COMMIT -> HTML only
-/$LISTNAME/all.html?before=$GIT_COMMIT -> HTML only, includes replies
/$LISTNAME/index.atom.xml -> Atom feed
/$LISTNAME/all.atom.xml -> Atom feed, includes replies
/$LISTNAME/m/$MESSAGE_ID.html -> HTML content (short quotes)
if ($path_info eq "/") {
r404();
} elsif ($path_info =~ m!$LISTNAME_RE/?\z!o) {
- invalid_list(\%ctx, $1) || get_list_log(\%ctx, $cgi);
- } elsif ($path_info =~ m!$LISTNAME_RE/all\z!o) {
- invalid_list(\%ctx, $1) || get_list_all(\%ctx, $cgi);
+ invalid_list(\%ctx, $1) || get_index(\%ctx, $cgi, 1);
} 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) {
})
];
}
+
+sub get_index {
+ my ($ctx, $cgi, $top) = @_;
+ require PublicInbox::Feed;
+ [ '200 OK', { 'Content-Type' => 'text/html' },
+ PublicInbox::Feed->generate_html_index({
+ git_dir => $ctx->{git_dir},
+ listname => $ctx->{listname},
+ pi_config => $pi_config,
+ cgi => $cgi,
+ top => $top,
+ })
+ ];
+}
# indices
{
local $ENV{HOME} = $home;
- my $res = cgi_run("/test/all.atom.xml");
- like($res->{body}, qr/<title>test for public-inbox/,
- "set title in XML feed");
- like($res->{body},
- qr!http://test\.example\.com/test/mid/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");
+ my $res = cgi_run("/test/");
+ like($res->{head}, qr/Status: 200 OK/, "index returns 200");
+ # more checks in t/feed.t
}
done_testing();