about summary refs log tree commit homepage
path: root/lib/PublicInbox/WwwStream.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-11-28 14:56:27 +0000
committerEric Wong <e@80x24.org>2023-11-29 02:13:26 +0000
commita8e3c2ad544f9f78ebbe91bfe0dece0e2d385322 (patch)
tree7f304b6f51c9f5babfb2b687c4b6e128efb7dbec /lib/PublicInbox/WwwStream.pm
parent83655d5dd1679e7c44586aaae4e16a2bffdeaa1a (diff)
downloadpublic-inbox-a8e3c2ad544f9f78ebbe91bfe0dece0e2d385322.tar.gz
The HTML is still extremely rough, but links seem to be mostly
working...
Diffstat (limited to 'lib/PublicInbox/WwwStream.pm')
-rw-r--r--lib/PublicInbox/WwwStream.pm11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm
index 3a1d6edf..8d32074f 100644
--- a/lib/PublicInbox/WwwStream.pm
+++ b/lib/PublicInbox/WwwStream.pm
@@ -17,8 +17,9 @@ http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/public-inb
 https://public-inbox.org/public-inbox.git) ];
 
 sub base_url ($) {
-        my $ctx = shift;
-        my $base_url = ($ctx->{ibx} // $ctx->{git})->base_url($ctx->{env});
+        my ($ctx) = @_;
+        my $thing = $ctx->{ibx} // $ctx->{git} // return;
+        my $base_url = $thing->base_url($ctx->{env});
         chop $base_url; # no trailing slash for clone
         $base_url;
 }
@@ -40,7 +41,7 @@ sub async_eml { # for async_blob_cb
 
 sub html_repo_top ($) {
         my ($ctx) = @_;
-        my $git = $ctx->{git};
+        my $git = $ctx->{git} // return $ctx->html_top_fallback;
         my $desc = ascii_html($git->description);
         my $title = delete($ctx->{-title_html}) // $desc;
         my $upfx = $ctx->{-upfx} // '';
@@ -265,11 +266,11 @@ sub aresponse {
 }
 
 sub html_init {
-        my ($ctx) = @_;
+        my $ctx = $_[-1];
         $ctx->{base_url} = base_url($ctx);
         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__;
+        bless $ctx, @_ > 1 ? $_[0] : __PACKAGE__;
         print { $ctx->zfh } html_top($ctx);
 }