about summary refs log tree commit homepage
path: root/lib/PublicInbox/WwwStream.pm
DateCommit message (Collapse)
2023-11-29www: start working on a repo listing
The HTML is still extremely rough, but links seem to be mostly working...
2023-11-10www: add topics_(new|active).(html|atom) endpoints
This seems like a easy (but WWW-specific) way to get recently created and recently active topics as suggested by Konstantin. To do this with Xapian will require a new columns and reindexing; and I'm not sure if the current lei handling of search results by dumping results to a format readable by common MUAs would work well with this. A new TUI may be required... Suggested-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org> Link: https://public-inbox.org/meta/20231107-skilled-cobra-of-swiftness-a6ff26@meerkat/
2023-06-17www_stream: drop unused $same_host variable
2023-01-13www_stream: coderepo-specific top bar
It gets nasty when multiple, non-ALL lists point to the same coderepo, but I guess ALL exists for that. Only lightly-tested with various PSGI prefix mounts, but it seems to be working...
2023-01-05www: make coderepo URL generation more consistent
WwwStream and WwwText basically show the same thing, except the latter relies on Linkify to create links.
2022-10-05www_stream: use git->pub_urls for coderepo links
This is already used by */$OID/s/, so just reuse existing code and make git->local_nick use the assigned nick from the config file, if there is one.
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-01www_stream: use DESTROY to cleanup temporary gits
Relying on a timer to handle cleanup in f9ac22a4b485 was sub-optimal since the delay could prove expensive under heavy traffic. So rely on ->DESTROY instead since we we no longer hold reference cycles by the time the show_blob callback executes. Fixes: f9ac22a4b485 ("git_async_cat: automatically cleanup temporary gits")
2022-09-10www: use PerlIO::scalar (zfh) for buffering
Calling Compress::Raw::Zlib::deflate is fairly expensive. Relying on the `.=' (concat) operator inside ->zadd operator is faster, but the method dispatch overhead is noticeable compared to the original code where we had bare `.=' littered throughout. Fortunately, `print' and `say' with the PerlIO::scalar IO layer appears to offer better performance without high method dispatch overhead. This doesn't allow us to save as much memory as I originally hoped, but does allow us to rely less on concat operators in other places and just pass a list of args to `print' and `say' as a appropriate. This does reduce scratchpad use, however, allowing for large memory savings, and we still ->deflate every single $eml.
2022-09-10www: switch to zadd for the majority of buffering
This allows us to focus string concatenations in one place to allow Perl internal scratchpad optimizations to reuse memory. Calling Compress::Raw::Zlib::deflate repeatedly proves too expensive in terms of CPU cycles.
2022-09-10viewvcs: use shorter and simpler ctx->html_done
We only return 200s for any response large enough to warrant ->html_done, so we can just assume it. ViewVCS can also take advantage of it with some tweaking to avoid an extra method dispatch.
2022-09-10www_stream: aresponse assumes 200, too
There's no reason to be streaming large amounts of HTML for anything other than a 200 response.
2022-09-10view: rework single message page to compress earlier
We can rely on deflate to compress large thread skeletons on single message pages. Subsequent commits will compress bodies, as well.
2022-08-29www: allow html_oneshot to take an array arg
Another step towards making our internal APIs more writev-like and reducing the copies needed for `join' or `.=' concatenation.
2022-08-23viewvcs: start improving display of git commits
For non-merge git commits, we already have ViewDiff for displaying patch emails, we can reuse it to display non-merge git commits. AFAIK, this is the first web-based git repository viewer to display the output of "git-patch-id --stable". It currently fills in the search form box with "patchid:", but maybe it'll do more than that. More work will be done to support bidirectional mapping of commits to emails in the future.
2022-08-20www: use absolute URLs for coderepo URLs
Showing "../../foo.git" looks awkward and isn't conducive to users who want to "git clone" a URL.
2021-11-01treewide: kill problematic "$h->{k} //= do {" assignments
As stated in the previous change, conditional hash assignments which trigger other hash assignments seem problematic, at times. So replace: $h->{k} //= do { $h->{x} = ...; $val }; $h->{k} // do { $h->{x} = ...; $hk->{k} = $val }; "||=" is affected the same way, and some instances of "||=" are replaced with "//=" or "// do {", now.
2021-10-25gzip_filter: delay async wcb call
This will let us modify the response header later to set a proper charset for Content-Type when displaying raw messages. Cc: Thomas Weißschuh <thomas@t-8ch.de>
2021-09-16www_stream: note existence of IMAP and NNTP URLs
The "mirror" link may not clue users into the existence of NNTP and IMAP servers, so add a note about them (but don't list them, in case there are dozens of URLs :>).
2021-08-31www_stream: extra link to mirroring information in the footer
This may be redundant with the "mirror" link at the top right, but maybe people will miss one. Properly capitalize the "Code repositories" text while we're at it. Link: https://public-inbox.org/20210828175827.rgzwqbn7brl56oej@nitro.local/ Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2021-08-30www_stream: description header links to top $INBOX_URL
Making the inbox description link back to the most recent per-inbox topics from text/ and $OID/s/ URLs seems useful, rather than keeping the description up there. Followup-to: 6c853f5256f3a324 ("www: improve navigation around contemporary threads")
2021-08-30www: move mirror instructions to /text/
This makes the mirroring and code retrieval instructions less obstructive. Relying on WwwText means we only use our Linkify module to make hrefs of full URLs; making relative and shortened hrefs off-limits; hopefully this isn't too much of a problem. coderepo information remains duplicated on every page since (IMHO) coderepos are an important feature; but nobody besides me has ever bothered to configure coderepos, so I suppose it's fine... Suggested-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org> Link: https://public-inbox.org/meta/20210826132747.6gxuwnhftyf7c6hp@nitro.local/
2021-08-28www: avoid incorrect instructions for extindex
There's no way to clone an extindex, since there's no git storage associated with them. So attempt to link to the HTML listing of public-inboxes, instead.
2021-08-28www_stream: sh-friendly .onion URLs wrapping
The long v3 .onion URL was causing havoc on small mobile displays, so extract "hostname" into a variable which can still used as a Bourne shell snippet. While we're at it, include "torsocks" in the git command used for .onion URLs since that's the (near)-universal wrapper for Tor-ifying things (like git) which are dynamically linked to libc. Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org> Link: https://public-inbox.org/meta/20210816163654.c6gfzuezhji4l6s7@nitro.local/
2021-08-28get rid of unnecessary bytes::length usage
The only place where we could return wide characters with -httpd was the raw $INBOX_DIR/description text, which is now converted to octets. All daemon (HTTP/NNTP/IMAP) sockets are opened in binary mode, so length() and bytes::length() are equivalent on reads. For socket writes, any non-octet data would warn about wide characters and we are strict in warnings with test_httpd. All gzipped buffers are also octets, as is PublicInbox::Eml->body, and anything from PerlIO objects ("git cat-file --batch" output, filesystems), so bytes::length was unnecessary in all those places.
2021-05-04treewide: update to v3 Tor onions
v2 onions are insecure, deprecated and going away. v3 names are unfortunately longer and more difficult to remember, but should be more resistant to attack than v2 ones.
2021-03-17www: improve visibility of coderepos
By adding "+code" next to "mirror" at the top next to the search box. Instead of showing "/path/to/$FOO", showing "$FOO.git" makes it more obvious we're talking about a git repo, here, instead of some random directory.
2021-03-17config: lazy-load coderepos, support extindex
Extsearch objects are duck-types of Inbox objects, and are capable of supporting code repos all the same.
2021-03-17www_stream: add trailing slash for help and color links
This saves clients a redirect
2021-01-01update copyrights for 2021
Using "make update-copyrights" after setting GNULIB_PATH in my config.mak
2020-12-22wwwstream: show relative coderepo URLs correctly
Trying to link "foo.git" relative to the current URL usually does not provide correct results, so prefix it by going into the parent directory if an absolute (or protocol-relative) URL is not supplied.
2020-12-22support multiple CODE_URLs
public-inbox.org will expire in a few years, so ensure Tor .onions can be known before then.
2020-12-20wwwstream: linkify coderepo URLs
It seems like a good idea to get more cgit visibility.
2020-12-10www+nntp: deal with lack of addresses for ->ALL
Since extindex is an amalgamation of several inboxes, discerning an appropriate address for List-Post: would be expensive and most likely unnecessary. Some legacy/historical inboxes may have no active address, either, so don't attempt to set the List-Post header if no addresses are configured.
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-12-09treewide: replace {-inbox} with {ibx} for consistency
{ibx} is shorter and is the most prevalent abbreviation in indexing and IMAP code, and the `$ibx' local variable is already prevalent throughout. In general, the codebase favors removal of vowels in variable and field names to denote non-references (because references are "lighter" than non-references). So update WWW and Filter users to use the same code since it reduces confusion and may allow easier code sharing.
2020-12-05isearch: emulate per-inbox search with ->ALL
Using "eidx_key:" boolean prefix to limit results to a given inbox, we can use ->ALL to emulate and replace per-Inbox xap15/[0-9] search indices. With this change, the presence of "extindex.all.topdir" in the $PI_CONFIG will cause the WWW code to use that extindex and ignore per-inbox Xapian DBs in xap15/[0-9]. Unfortunately IMAP search still requires old per-inbox indices, for now. Mapping extindex Xapian docids to per-Inbox UIDs and vice-versa is proving tricky. Fortunately, IMAP search is rarely used and optional. The RFCs don't specify expensive phrase search, either, so `indexlevel=medium' can be used in per-inbox Xapian indices to save space. For primarily WWW (and future JMAP) users; this should result in significant disk space, FD, and page cache footprint savings for large instances with many inboxes and many cross-posted messages.
2020-09-16wwwstream: link to cgit URLs for coderepo
Hopefully this reduces the ambiguity between code for the project(s) using public-inbox and the code for public-inbox itself.
2020-09-10wwwstream: show init + index instructions for -V1, too
This should've always been there. I'm not sure how widely spread 1.0 and earlier releases were, but we'll keep documenting the version requirement.
2020-09-09wwwstream: fix "Atom feed" link
Oops, I wanted to stop escaping double-quotes with `qq()' but used `q()' instead :x Fixes: 2f61828fcb727e51 ("www: make mirror instructions more prominent")
2020-09-09www: make mirror instructions more prominent
In order to fight the misconception that public-inboxes are centralized, anchor "#mirror" to the clone instructions and place an emphasis on "mirror", not just cloning. While we're at it, better describe multi-epoch -V2 inboxes, since some users do not seem to realize epochs consist of different data.
2020-08-28www: improve navigation around contemporary threads
Sometimes it's useful to quickly get to threads and messages which are contemporaries of the current thread/message being focused on. This hopefully improves navigation by making: a) the top line (where $INBOX_DIR/description) is shown a link to the latest topics in search results and per-thread/per-message views. b) providing a link to contemporaries ("~YYYY-MM-DD") at around the thread overview skeleton area for per-thread and per-message views
2020-08-01www: rework async_* to use method table
Although the ->async_next method does not take $self as a receiver, but rather a PublicInbox::HTTP object, we may still retrieve it to be called with the HTTP object via UNIVERSAL->can.
2020-07-06www: update internal docs
We no longer favor getline+close for streaming PSGI responses when using public-inbox-httpd. We still support it for other PSGI servers, though.
2020-07-06wwwstream: eliminate ::response, use html_oneshot
All of our streaming responses use ::aresponse, now, and our synchronous responses use html_oneshot. So there's no need for the old WwwStream::response.
2020-07-06view: make /$INBOX/$MSGID/ permalink async
This will allow -httpd to handle other requusts if waiting on an HDD seek or git to decode a blob.
2020-07-06wwwstream: subclass off GzipFilter
This makes WwwStream closer to MboxGz and WwwAtomStream and will eventually allow us to follow the same patterns.
2020-07-06wwwstream: use parent.pm and no warnings
parent.pm is leaner than base and we'll rely on `-w' for warnings during development.
2020-07-06wwwstream: reduce blob fetch paths for ->getline
This will make it easier to support asynchronous blob retrievals. The `$ctx->{nr}' counter is no longer implicitly supplied since many users didn't care for it, so stack overhead is slightly reduced.
2020-07-06wwwstream: reduce object graph depth
Like with WwwAtomStream and MboxGz, we can bless the existing $ctx object directly to avoid allocating a new hashref. We'll also switch from "->" to "::" to reduce stack utilization.