]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/WwwStream.pm
www: give tor2web some exposure, too
[public-inbox.git] / lib / PublicInbox / WwwStream.pm
index 9ed25e1d047f6fed024ba95ead017399bbc0b020..dfbcf4105a14ae74d97181183f547c01aef9318a 100644 (file)
@@ -8,6 +8,7 @@ use warnings;
 use PublicInbox::Hval qw(ascii_html);
 use URI;
 our $TOR_URL = 'https://www.torproject.org/';
+our $TOR2WEB_URL = 'https://www.tor2web.org/';
 our $CODE_URL = 'https://public-inbox.org/';
 our $PROJECT = 'public-inbox';
 
@@ -31,10 +32,12 @@ sub _html_top ($) {
        my $desc = ascii_html($obj->description);
        my $title = $ctx->{-title_html} || $desc;
        my $upfx = $ctx->{-upfx} || '';
+       my $help = $upfx.'_/text/help';
        my $atom = $ctx->{-atom} || $upfx.'new.atom';
        my $tip = $ctx->{-html_tip} || '';
        my $top = "<b>$desc</b>";
-       my $links = "<a\nhref=\"$atom\">Atom feed</a>";
+       my $links = "<a\nhref=\"$help\">help</a> / ".
+                       "<a\nhref=\"$atom\">Atom feed</a>";
        if ($obj->search) {
                my $q_val = $ctx->{-q_value_html};
                if (defined $q_val && $q_val ne '') {
@@ -94,6 +97,10 @@ sub _html_end {
        if ($urls =~ m!\b[^:]+://\w+\.onion/!) {
                $urls .= "\n note: .onion URLs require Tor: ";
                $urls .= qq[<a\nhref="$TOR_URL">$TOR_URL</a>];
+               if ($TOR2WEB_URL) {
+                       $urls .= "\n       or Tor2web: ";
+                       $urls .= qq[<a\nhref="$TOR2WEB_URL">$TOR2WEB_URL</a>];
+               }
        }
        my $url = PublicInbox::Hval::prurl($ctx->{env}, $CODE_URL);
        '<hr><pre>'.join("\n\n",