diff options
author | Eric Wong <e@80x24.org> | 2019-04-05 20:04:26 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-04-15 06:20:35 +0000 |
commit | 19151f1b6a04532a1bc3f86fa945a10be6849b8d (patch) | |
tree | 3ef59c69c008a831653de93baed87fe426b4a897 /lib/PublicInbox/Config.pm | |
parent | 8efc7b62fc3e3bd94d0196fc1942ca9572a481cc (diff) | |
download | public-inbox-19151f1b6a04532a1bc3f86fa945a10be6849b8d.tar.gz |
We can reduce the configuration needed to run cgit by reusing the static file handling logic of the dumb git HTTP protocol. I hate logos and icons, so don't expect public-inbox.org or 80x24.org to ever have those to waste users' bandwidth with :P But I expect other users to find this useful.
Diffstat (limited to 'lib/PublicInbox/Config.pm')
-rw-r--r-- | lib/PublicInbox/Config.pm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm index 9f1e57ac..2c1c5111 100644 --- a/lib/PublicInbox/Config.pm +++ b/lib/PublicInbox/Config.pm @@ -234,6 +234,12 @@ sub scan_path_coderepo { sub parse_cgitrc { my ($self, $cgitrc, $nesting) = @_; + if ($nesting == 0) { + # defaults: + my %s = map { $_ => 1 } qw(/cgit.css /cgit.png + /favicon.ico /robots.txt); + $self->{-cgit_static} = \%s; + } # same limit as cgit/configfile.c::parse_configfile return if $nesting > 8; @@ -263,6 +269,10 @@ sub parse_cgitrc { $self->{-cgit_scan_hidden_path} = $1; } elsif (m!\Ascan-path=(.+)\z!) { scan_path_coderepo($self, '', $1); + + } elsif (m!\A(?:css|favicon|logo|repo\.logo)=(/.+)\z!) { + # absolute paths for static files via PublicInbox::Cgit + $self->{-cgit_static}->{$1} = 1; } } cgit_repo_merge($self, $repo) if $repo; |