about summary refs log tree commit homepage
path: root/lib/PublicInbox/WWW.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-10-04 19:12:35 +0000
committerEric Wong <e@80x24.org>2022-10-05 21:15:26 +0000
commit6dec9bf8c0e1b859703d7a5dfb87052cf4e87846 (patch)
tree7d0e0c7bf96da3a3fe494eaaaaf1c714b5aa1775 /lib/PublicInbox/WWW.pm
parenta002384a74382df2649d6a1f8dfba4f291af032e (diff)
downloadpublic-inbox-6dec9bf8c0e1b859703d7a5dfb87052cf4e87846.tar.gz
This will allow it to easily map a single coderepo to multiple
inboxes (or multiple coderepos to any number of inboxes).
For now, this is just a summary, but $REPO/$OID/s/ support
will be added, along with archive downloads.

Indexing of coderepos will probably be supported via -extindex,
only.
Diffstat (limited to 'lib/PublicInbox/WWW.pm')
-rw-r--r--lib/PublicInbox/WWW.pm12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm
index 1df5572d..d0e20fb5 100644
--- a/lib/PublicInbox/WWW.pm
+++ b/lib/PublicInbox/WWW.pm
@@ -197,7 +197,9 @@ sub news_cgit_fallback ($) {
         my $www = $ctx->{www};
         my $env = $ctx->{env};
         my $res = $www->news_www->call($env);
-        $res->[0] == 404 ? $www->cgit->call($env) : $res;
+        $res = $www->cgit->call($env) if $res->[0] == 404;
+        $res = $www->coderepo->srv($ctx) if $res->[0] == 404;
+        $res;
 }
 
 # returns undef if valid, array ref response if invalid
@@ -494,6 +496,14 @@ sub cgit {
         }
 }
 
+sub coderepo {
+        my ($self) = @_;
+        $self->{coderepo} //= do {
+                require PublicInbox::WwwCoderepo;
+                PublicInbox::WwwCoderepo->new($self->{pi_cfg});
+        }
+}
+
 # GET $INBOX/manifest.js.gz
 sub get_inbox_manifest ($$$) {
         my ($ctx, $inbox, $key) = @_;