From eb1be1167778836f191cb5888a1348cf8f33f40f Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Sat, 8 Jan 2022 14:05:57 +1100 Subject: [PATCH] Nuke RSS (Atom only!), and use Atom in the OPML --- gitweb.cgi | 172 ++++++++++++++++++----------------------------------- 1 file changed, 57 insertions(+), 115 deletions(-) diff --git a/gitweb.cgi b/gitweb.cgi index f8d82f7..16e2e3c 100755 --- a/gitweb.cgi +++ b/gitweb.cgi @@ -887,7 +887,6 @@ our %actions = ( "patch" => \&git_patch, "patches" => \&git_patches, "remotes" => \&git_remotes, - "rss" => \&git_rss, "atom" => \&git_atom, "search" => \&git_search, "search_help" => \&git_search_help, @@ -907,7 +906,7 @@ our %actions = ( # finally, we have the hash of allowed extra_options for the commands that # allow them our %allowed_options = ( - "--no-merges" => [ qw(rss atom log shortlog history) ], + "--no-merges" => [ qw(atom log shortlog history) ], ); # fill %input_params with the CGI parameters. All values except for 'opt' @@ -4070,7 +4069,7 @@ sub print_feed_meta { $href_params{'-title'} = 'log'; } - foreach my $format (qw(RSS Atom)) { + foreach my $format (qw(Atom)) { my $type = lc($format); my %link_attr = ( '-rel' => 'alternate', @@ -4282,7 +4281,7 @@ sub git_footer_html { } $href_params{'-title'} ||= 'log'; - foreach my $format (qw(RSS Atom)) { + foreach my $format (qw(Atom)) { $href_params{'action'} = lc($format); print $cgi->a({-href => href(%href_params), -title => "$href_params{'-title'} $format feed", @@ -8202,15 +8201,14 @@ sub git_shortlog { } ## ...................................................................... -## feeds (RSS, Atom; OPML) +## feeds (Atom; OPML) sub git_feed { my $format = shift || 'atom'; my $have_blame = gitweb_check_feature('blame'); # Atom: http://www.atomenabled.org/developers/syndication/ - # RSS: http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ - if ($format ne 'rss' && $format ne 'atom') { + if ($format ne 'atom') { die_error(400, "Unknown web feed format"); } @@ -8262,9 +8260,7 @@ sub git_feed { if (defined $descr) { $descr = esc_html($descr); } else { - $descr = "$project " . - ($format eq 'rss' ? 'RSS' : 'Atom') . - " feed"; + $descr = "$project Atom feed"; } my $owner = git_get_project_owner($project); $owner = esc_html($owner); @@ -8280,60 +8276,32 @@ sub git_feed { } $alt_url = esc_attr($alt_url); print qq!\n!; - if ($format eq 'rss') { - print < - -XML - print "$title\n" . - "$alt_url\n" . - "$descr\n" . - "en\n" . - # project owner is responsible for 'editorial' content - "$owner\n"; - if (defined $logo || defined $favicon) { - # prefer the logo to the favicon, since RSS - # doesn't allow both - my $img = esc_url($logo || $favicon); - print "\n" . - "$img\n" . - "$title\n" . - "$alt_url\n" . - "\n"; - } - if (%latest_date) { - print "$latest_date{'rfc2822'}\n"; - print "$latest_date{'rfc2822'}\n"; - } - print "gitweb v.$version/$git_version\n"; - } elsif ($format eq 'atom') { - print < XML - print "$title\n" . - "$descr\n" . - '' . "\n" . - '' . "\n" . - "" . esc_url(href(-full=>1)) . "\n" . - # use project owner for feed author - "$owner\n"; - if (defined $favicon) { - print "" . esc_url($favicon) . "\n"; - } - if (defined $logo) { - # not twice as wide as tall: 72 x 27 pixels - print "" . esc_url($logo) . "\n"; - } - if (! %latest_date) { - # dummy date to keep the feed valid until commits trickle in: - print "1970-01-01T00:00:00Z\n"; - } else { - print "$latest_date{'iso-8601'}\n"; - } - print "gitweb\n"; + print "$title\n" . + "$descr\n" . + '' . "\n" . + '' . "\n" . + "" . esc_url(href(-full=>1)) . "\n" . + # use project owner for feed author + "$owner\n"; + if (defined $favicon) { + print "" . esc_url($favicon) . "\n"; + } + if (defined $logo) { + # not twice as wide as tall: 72 x 27 pixels + print "" . esc_url($logo) . "\n"; + } + if (! %latest_date) { + # dummy date to keep the feed valid until commits trickle in: + print "1970-01-01T00:00:00Z\n"; + } else { + print "$latest_date{'iso-8601'}\n"; } + print "gitweb\n"; # contents for (my $i = 0; $i <= $#commitlist; $i++) { @@ -8356,39 +8324,27 @@ XML # print element (entry, item) my $co_url = href(-full=>1, action=>"commitdiff", hash=>$commit); - if ($format eq 'rss') { - print "\n" . - "" . esc_html($co{'title'}) . "\n" . - "" . esc_html($co{'author'}) . "\n" . - "$cd{'rfc2822'}\n" . - "$co_url\n" . - "" . esc_html($co_url) . "\n" . - "" . esc_html($co{'title'}) . "\n" . - "" . - "\n" . - "" . esc_html($co{'title'}) . "\n" . - "$cd{'iso-8601'}\n" . - "\n" . - " " . esc_html($co{'author_name'}) . "\n"; - if ($co{'author_email'}) { - print " " . esc_html($co{'author_email'}) . "\n"; - } - print "\n" . - # use committer for contributor - "\n" . - " " . esc_html($co{'committer_name'}) . "\n"; - if ($co{'committer_email'}) { - print " " . esc_html($co{'committer_email'}) . "\n"; - } - print "\n" . - "$cd{'iso-8601'}\n" . - "\n" . - "" . esc_html($co_url) . "\n" . - "\n" . - "
\n"; - } + print "\n" . + "" . esc_html($co{'title'}) . "\n" . + "$cd{'iso-8601'}\n" . + "\n" . + " " . esc_html($co{'author_name'}) . "\n"; + if ($co{'author_email'}) { + print " " . esc_html($co{'author_email'}) . "\n"; + } + print "\n" . + # use committer for contributor + "\n" . + " " . esc_html($co{'committer_name'}) . "\n"; + if ($co{'committer_email'}) { + print " " . esc_html($co{'committer_email'}) . "\n"; + } + print "\n" . + "$cd{'iso-8601'}\n" . + "\n" . + "" . esc_html($co_url) . "\n" . + "\n" . + "
\n"; my $comment = $co{'comment'}; print "
\n";
 		foreach my $line (@$comment) {
@@ -8424,27 +8380,13 @@ XML
 			print "] ".
 			      "$file\n";
 		}
-		if ($format eq 'rss') {
-			print "]]>\n" .
-			      "\n" .
-			      "\n";
-		} elsif ($format eq 'atom') {
-			print "\n
\n" . - "
\n" . - "
\n"; - } + print "\n
\n" . + "
\n" . + "\n"; } # end of feed - if ($format eq 'rss') { - print "
\n\n"; - } elsif ($format eq 'atom') { - print "\n"; - } -} - -sub git_rss { - git_feed('rss'); + print "\n"; } sub git_atom { @@ -8476,7 +8418,7 @@ sub git_opml { $title OPML Export$filter - + XML foreach my $pr (@list) { @@ -8492,9 +8434,9 @@ XML } my $path = esc_html(chop_str($proj{'path'}, 25, 5)); - my $rss = esc_attr(href('project' => $proj{'path'}, 'action' => 'rss', -full => 1)); + my $atom = esc_attr(href('project' => $proj{'path'}, 'action' => 'atom', -full => 1)); my $html = esc_attr(href('project' => $proj{'path'}, 'action' => 'summary', -full => 1)); - print "\n"; + print "\n"; } print < -- 2.42.0