]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/WWW.pm
www_coderepo: an alternative to cgit
[public-inbox.git] / lib / PublicInbox / WWW.pm
index 1df5572db61c8a82b217090cbc8e9c27efd9f841..d0e20fb54da4a82768d899c53fb693415b759a67 100644 (file)
@@ -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) = @_;