mirroring instructions on how to clone and mirror
all data and code used by this external index.
EOF
+ } elsif ($ctx->{git}) { # coderepo
+ $x = join('', map { "git clone $_\n" }
+ @{$ctx->{git}->cloneurl($ctx->{env})});
}
chomp $x;
'
'.join("\n\n", coderepos($ctx), $x).'
'
@@ -167,12 +219,12 @@ sub getline {
$ctx->zflush(_html_end($ctx));
}
-sub html_done ($$) {
- my ($ctx, $code) = @_;
- my $bdy = $ctx->zflush(_html_end($ctx));
+sub html_done ($;@) {
+ my $ctx = $_[0];
+ my $bdy = $ctx->zflush(@_[1..$#_], _html_end($ctx));
my $res_hdr = delete $ctx->{-res_hdr};
push @$res_hdr, 'Content-Length', length($bdy);
- [ $code, $res_hdr, [ $bdy ] ]
+ [ 200, $res_hdr, [ $bdy ] ]
}
sub html_oneshot ($$;@) {
@@ -181,11 +233,12 @@ sub html_oneshot ($$;@) {
'Content-Length' => undef ];
bless $ctx, __PACKAGE__;
$ctx->{gz} = PublicInbox::GzipFilter::gz_or_noop($res_hdr, $ctx->{env});
+ my @top;
$ctx->{base_url} // do {
- $ctx->zmore(html_top($ctx));
+ @top = html_top($ctx);
$ctx->{base_url} = base_url($ctx);
};
- my $bdy = $ctx->zflush(@_[2..$#_], _html_end($ctx));
+ my $bdy = $ctx->zflush(@top, @_[2..$#_], _html_end($ctx));
$res_hdr->[3] = length($bdy);
[ $code, $res_hdr, [ $bdy ] ]
}
@@ -216,7 +269,12 @@ sub html_init {
my $h = $ctx->{-res_hdr} = ['Content-Type', 'text/html; charset=UTF-8'];
$ctx->{gz} = PublicInbox::GzipFilter::gz_or_noop($h, $ctx->{env});
bless $ctx, __PACKAGE__;
- $ctx->zmore(html_top($ctx));
+ print { $ctx->zfh } html_top($ctx);
+}
+
+sub DESTROY {
+ my ($ctx) = @_;
+ $ctx->{git}->cleanup if $ctx->{git} && $ctx->{git}->{-tmp};
}
1;