From 44fbd4169f7434442dbf57851232edafa6fd0e46 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 4 Jan 2023 10:34:04 +0000 Subject: [PATCH] git: pub_urls shows base_url default Since we have native coderepo viewing support without cgit, configuring coderepo.$FOO.cgitUrl shouldn't be necessary anymore and we can infer the public name based on the project nickname (or whatever's in the generated project.list) --- lib/PublicInbox/Git.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index d8468b4f..96627daa 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -485,10 +485,11 @@ sub host_prefix_url ($$) { sub base_url { # for coderepos, PSGI-only my ($self, $env) = @_; # env - PSGI env + my $nick = $self->{nick} // return undef; my $url = host_prefix_url($env, ''); # for mount in Plack::Builder $url .= '/' if substr($url, -1, 1) ne '/'; - $url . $self->{nick} . '/'; + $url . $nick . '/'; } sub isrch {} # TODO @@ -496,9 +497,10 @@ sub isrch {} # TODO sub pub_urls { my ($self, $env) = @_; if (my $urls = $self->{cgit_url}) { - return map { host_prefix_url($env, $_) } @$urls; + map { host_prefix_url($env, $_) } @$urls; + } else { + (base_url($self, $env) // '???'); } - (local_nick($self) // '???'); } sub cat_async_begin { -- 2.44.0