X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FWwwStream.pm;h=e27da8c2ed0f0b6bf359ac10760857032b6ebab3;hb=4e60d74e6cab0a134c0c62785c766b5fa02ac360;hp=d79770ed1d82b8dbd484ca84dbf445962116bef8;hpb=0821af5f21fdb083020ae2e3e79e4227ef59cd4f;p=public-inbox.git
diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm
index d79770ed..e27da8c2 100644
--- a/lib/PublicInbox/WwwStream.pm
+++ b/lib/PublicInbox/WwwStream.pm
@@ -10,7 +10,7 @@ use strict;
use parent qw(Exporter PublicInbox::GzipFilter);
our @EXPORT_OK = qw(html_oneshot);
use bytes (); # length
-use PublicInbox::Hval qw(ascii_html prurl);
+use PublicInbox::Hval qw(ascii_html prurl ts2str);
our $TOR_URL = 'https://www.torproject.org/';
our $CODE_URL = 'https://public-inbox.org/public-inbox.git';
@@ -43,9 +43,17 @@ sub html_top ($) {
my $color = $upfx.'_/text/color';
my $atom = $ctx->{-atom} || $upfx.'new.atom';
my $top = "$desc";
- my $links = "help / ".
- "color / ".
- "Atom feed";
+ if (my $t_max = $ctx->{-t_max}) {
+ $t_max = ts2str($t_max);
+ $top = qq($top);
+ # we had some kind of query, link to /$INBOX/?t=YYYYMMDDhhmmss
+ } elsif ($ctx->{qp}->{t}) {
+ $top = qq($top);
+ }
+ my $links = qq(help / ).
+ qq(color / ).
+ qq(mirror / ).
+ qq(Atom feed);
if ($ibx->search) {
my $q_val = delete($ctx->{-q_value_html}) // '';
$q_val = qq(\nvalue="$q_val") if $q_val ne '';
@@ -76,7 +84,11 @@ sub code_footer ($) {
sub _html_end {
my ($ctx) = @_;
- my $urls = 'Archives are clonable:';
+ my $urls = <This inbox may be cloned and mirrored by anyone:
+EOF
+
my $ibx = $ctx->{-inbox};
my $desc = ascii_html($ibx->description);
@@ -87,12 +99,18 @@ sub _html_end {
my %seen = ($http => 1);
if (defined($max)) { # v2
for my $i (0..$max) {
- # old parts my be deleted:
+ # old epochs my be deleted:
-d "$ibx->{inboxdir}/git/$i.git" or next;
my $url = "$http/$i";
$seen{$url} = 1;
push @urls, "$url $dir/git/$i.git";
}
+ my $nr = scalar(@urls);
+ if ($nr > 1) {
+ $urls .= "\n\t# this inbox consists of $nr epochs:";
+ $urls[0] .= "\t# oldest";
+ $urls[-1] .= "\t# newest";
+ }
} else { # v1
push @urls, $http;
}
@@ -104,12 +122,7 @@ sub _html_end {
push @urls, $u =~ /\Ahttps?:/ ? qq($u) : $u;
}
- if (defined($max) || scalar(@urls) > 1) {
- $urls .= "\n" .
- join("\n", map { "\tgit clone --mirror $_" } @urls);
- } else {
- $urls .= " git clone --mirror $urls[0]";
- }
+ $urls .= "\n" . join("\n", map { "\tgit clone --mirror $_" } @urls);
if (defined $max) {
my $addrs = $ibx->{address};
$addrs = join(' ', @$addrs) if ref($addrs) eq 'ARRAY';
@@ -127,16 +140,19 @@ EOF
}
my $cfg_link = ($ctx->{-upfx} // '').'_/text/config/raw';
- $urls .= qq(\nExample config snippet for mirrors\n);
+ $urls .= <config snippet for mirrors.
+EOF
my @nntp = map { qq($_) } @{$ibx->nntp_url};
if (@nntp) {
- $urls .= "\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 .= " note: .onion URLs require Tor: ";
$urls .= qq[$TOR_URL];
}
'
'.join("\n\n",