about summary refs log tree commit homepage
path: root/lib/PublicInbox/Cgit.pm
DateCommit message (Collapse)
2024-02-14www: cgit: support non-standard cgitrc locations
If publicinbox.cgitrc is set in the config file, we'll ensure cgit sees it as CGIT_CONFIG since the configured publicinbox.cgitrc knob may not be the default path the cgit.cgi binary was configured to use. Furthermore, we'll respect CGIT_CONFIG in the environment if publicinbox.cgitrc is unset in the config file at -httpd/-netd startup.
2023-10-25cgit: switch to psgi_yield
Another drop-in replacement using an alternate limiter.
2023-04-18www_coderepo: rescan cgit project-list for new coderepos
Coderepo changes are probably more common than inbox changes, so it probably makes sense to rescan and look for new coderepos on 404s, especially since we serve mirrored manifest.js.gz as-is. I noticed my git.kernel.org mirror was serving manifest.js.gz pointing to irretrievable repositories. This should stop that. We'll also drop the underscore ('_') and use `coderepo' everywhere to be consistent with our documentation. We may serve new inboxes in a similar way down the line, too; but this change only affects coderepos for now since we can guarantee the inbox manifest.js.gz never contains irretrievable inboxes as it's dynamically generated.
2023-03-07cgit: fix smart HTTP clone interception
We need to use the proper hash and key to do coderepo lookups since we culled a redundant data structure a few months back. Fixes: 1802dc29bda25a54 ("www_coderepo: do not copy {-code_repos} from config")
2022-10-07www: support publicinbox.cgit knob
For backwards-compatibility, this defaults to `first'. When set to `fallback', PublicInbox::WwwCoderepo is favored and cgit is only used as a fallback. Eventually, `rewrite' will also be supported to rewrite cgit URLs to WwwCoderepo ones. Of course, WwwCoderepo is still missing search and other key features, but that's being worked on...
2022-10-07www: cgit: fall back to WwwCoderepo on 404s
We can't rely on 3-element array response when calling WwwCoderepo for ViewVCS endpoints since that uses Qspawn internally. Thus, we have to allow two Qspawn objects to run in parallel and ensure `qspawn.wcb' only gets called once, so we end up duplicating the entire $ctx to ensure this.
2022-10-05www_coderepo: an alternative to cgit
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.
2022-10-05cgit: use Perl 5.10-isms, optimize, and golf
We can reduce variable assignments in a few places and filter keys more quickly using the `grep' Perl op rather than relying on `m// or next' inside a loop. Similar changes to the NNTP and IMAP (e.g. b700fce60f25038e (nntp: NEWNEWS: speed up filtering, 2020-11-27)) yielded good improvements.
2021-10-23www: respect coderepo.*.url during cgit init
This is necessary for showing "found $OID in $CODEREPO_URL" in solver-generated pages ($INBOX_URL/$OID/s/).
2021-03-19cgit: fix fallout from lazy coderepo loading
We can't completely instantiate our cgit wrapper without knowing knowing cgit locations for serving static content. Fixes: a5968dc059f655a ("config: lazy-load coderepos, support extindex")
2021-01-01update copyrights for 2021
Using "make update-copyrights" after setting GNULIB_PATH in my config.mak
2020-12-09rename {pi_config} fields to {pi_cfg}
{pi_config} may be confused with the documented `PI_CONFIG' environment variable, and we'll favor vowel-removal to be consistent with our usage of object references. The `pi_' prefix may stay in some places, for now; since a separate namespace may come into this codebase for local/private client-tooling. For InboxIdle, we'll also remove an invalid comment about holding a reference to the PublicInbox::Config object, too.
2020-09-10use "\&" where possible when referring to subroutines
"*foo" is ambiguous in that it may refer to a bareword file handle; so we'll use it where we can without triggering warnings. PublicInbox::TestCommon::run_script_exit required dropping the prototype, however. We'll also future-proof by dropping "use warnings" in Cgit.pm and use the less-ambiguous "//=" in Inbox.pm while we're in the area.
2020-02-06treewide: run update-copyrights from gnulib for 2019
I didn't wait until September to do it, this year!
2020-01-13cgit: drop cgit_parse_hdr wrapper
Unlike PublicInbox::GitHTTPBackend::git_parse_hdr, cgit_parse_hdr does nothing interesting besides calling parse_cgi_headers. So just make a reference to PublicInbox::GitHTTPBackend::parse_cgi_headers and call it.
2020-01-01wwwstatic: add directory listing + index.html support
It's now possible to use WwwStatic as a standalone PSGI app to serve static files and recreate the award-winning web design of https://public-inbox.org/ :>
2020-01-01wwwstatic: move r(...) functions here
Remove redundant "r" functions for generating short error responses. These responses will no longer be cached by clients, which is probably a good thing since most errors ought to be transient, anyways. This also fixes error responses for our cgit wrapper when static files are missing.
2020-01-01cgit: type declaration for PublicInbox::Git
AFAIK this doesn't do anything for Perl internally since PublicInbox::Git doesn't "use fields", but it makes it easier for humans readers to follow and ensure we're not passing unblessed or non-ref scalars to PublicInbox::GitHTTPBackend::serve.
2019-12-27config: each_inbox: pass user arg to callback
Another place where we can replace anonymous subs with named subs by passing a user-supplied arg.
2019-12-27githttpbackend: split out wwwstatic
Make it easier to share code between our GitHTTPBackend and Cgit packages, for now, and possibly other packages in the future. We can avoid inline_object and anonymous subs at the same time, reducing per-request memory overhead.
2019-12-26qspawn: psgi_return: allow non-anon parse_hdr callback
Callers can supply an arg to parse_hdr, now, eliminating the need for closures to capture local variables.
2019-04-25cgit: improve handling of cgit data path
Document `publicinbox.cgitdata' config directive, but allow it to be unspecified and/or missing for installations which do not wish to serve static data at all. For users installing cgit from source to their home directory, we can usually infer the cgit data path based on the cgit.cgi binary path, even.
2019-04-15cgit: serve static css, logo, favicon directly
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.
2019-04-04cgit: use a dedicated named limiter
I mainly need this to enforce RLIMIT_CPU (and RLIMIT_CORE) when requests come which generate giant, unrealistic diffs. Per-coderepo limiters may be added in the future. But for now, I need to prevent cgit from monopolizing resources on my dinky server.
2019-04-04cgit: support running cgit as a standalone CGI
We depend on git-http-backend for smart HTTP clone support, however; since cgit does not support smart clones natively. WWW.pm will be able to cascade down to this as a 404 handler in the future.