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
sub get_vcs_object ($$$;$) {
my ($ctx, $inbox, $oid, $filename) = @_;
my $r404 = invalid_inbox($ctx, $inbox);
- return $r404 if $r404 || !$ctx->{www}->{pi_cfg}->repo_objs($ctx->{ibx});
+ return $r404 if $r404;
+ return r(404) if !$ctx->{www}->{pi_cfg}->repo_objs($ctx->{ibx});
require PublicInbox::ViewVCS;
PublicInbox::ViewVCS::show($ctx, $oid, $filename);
}
sub need {
my ($ctx, $extra) = @_;
require PublicInbox::WwwStream;
- PublicInbox::WwwStream::html_oneshot($ctx, 501, \<<EOF);
+ PublicInbox::WwwStream::html_oneshot($ctx, 501, <<EOF);
<pre>$extra is not available for this public-inbox
<a\nhref="../">Return to index</a></pre>
EOF
}
}
+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) = @_;