]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/WwwStream.pm
www: allow including links to NNTP sites in HTML footer
[public-inbox.git] / lib / PublicInbox / WwwStream.pm
index 29395f40909661ec2231304677a4d33a5dbbae35..9ed25e1d047f6fed024ba95ead017399bbc0b020 100644 (file)
@@ -72,10 +72,8 @@ sub _html_end {
        chop $http;
        my %seen = ( $http => 1 );
        my @urls = ($http);
-       my $need_tor;
        foreach my $u (@{$obj->cloneurl}) {
                next if $seen{$u};
-               $need_tor = 1 if $u =~ m!\A[^:]+://\w+\.onion/!;
                $seen{$u} = 1;
                push @urls, $u =~ /\Ahttps?:/ ? qq(<a\nhref="$u">$u</a>) : $u;
        }
@@ -86,7 +84,14 @@ sub _html_end {
                        join("\n", map { "\tgit clone --mirror $_" } @urls);
        }
 
-       if ($need_tor) {
+       my @nntp = map { qq(<a\nhref="$_">$_</a>) } @{$obj->nntp_url};
+       if (@nntp) {
+               $urls .= "\n\n";
+               $urls .= @nntp == 1 ? 'Newsgroup' : 'Newsgroups are';
+               $urls .= ' available over NNTP:';
+               $urls .= "\n\t" . join("\n\t", @nntp) . "\n";
+       }
+       if ($urls =~ m!\b[^:]+://\w+\.onion/!) {
                $urls .= "\n note: .onion URLs require Tor: ";
                $urls .= qq[<a\nhref="$TOR_URL">$TOR_URL</a>];
        }