X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FWwwStream.pm;h=29395f40909661ec2231304677a4d33a5dbbae35;hb=b7c4bca292fb1f7ac4d73ff96b2ce95185b4fc66;hp=d9abb5ab8068756d51c3f5aaae5b9098703744ce;hpb=21b7f9f282bd6b877f1da7a9d0169ce958191a34;p=public-inbox.git diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm index d9abb5ab..29395f40 100644 --- a/lib/PublicInbox/WwwStream.pm +++ b/lib/PublicInbox/WwwStream.pm @@ -7,11 +7,15 @@ use strict; use warnings; use PublicInbox::Hval qw(ascii_html); use URI; -use constant PI_URL => 'https://public-inbox.org/README.html'; +our $TOR_URL = 'https://www.torproject.org/'; +our $CODE_URL = 'https://public-inbox.org/'; +our $PROJECT = 'public-inbox'; + +sub close {} sub new { my ($class, $ctx, $cb) = @_; - bless { nr => 0, cb => $cb, ctx => $ctx }, $class; + bless { nr => 0, cb => $cb || *close, ctx => $ctx }, $class; } sub response { @@ -29,11 +33,12 @@ sub _html_top ($) { my $upfx = $ctx->{-upfx} || ''; my $atom = $ctx->{-atom} || $upfx.'new.atom'; my $tip = $ctx->{-html_tip} || ''; - my $top = "$desc (Atom feed)"; + my $top = "$desc"; + my $links = "Atom feed"; if ($obj->search) { my $q_val = $ctx->{-q_value_html}; if (defined $q_val && $q_val ne '') { - $q_val = qq(\nvalue="$q_val" ); + $q_val = qq(\nvalue="$q_val"); } else { $q_val = ''; } @@ -41,12 +46,13 @@ sub _html_top ($) { my $extra = $ctx->{-extra_form_html} || ''; my $action = $upfx eq '' ? './' : $upfx; $top = qq{
} } else { - $top = '' . $top . ''; + $top = '
' . $top . "\n" . $links . ''; } "
'.join("\n", - '- ' . $desc, + + if ($need_tor) { + $urls .= "\n note: .onion URLs require Tor: "; + $urls .= qq[$TOR_URL]; + } + my $url = PublicInbox::Hval::prurl($ctx->{env}, $CODE_URL); + ''.join("\n\n", + $desc, $urls, - 'served with software from public-inbox: ' - ."$url", + 'Code for this site: '. + qq(git clone $url $PROJECT) ).''; } @@ -104,6 +112,4 @@ sub getline { delete $self->{cb} ? _html_end($self) : undef; } -sub close {} - 1;