Eric Wong [Mon, 4 Apr 2016 21:09:19 +0000 (21:09 +0000)]
repobrowse: snapshot support for cgit compatibility
We currently do not display links to snapshots, but may in the
future (optionally, like cgit). However, support snapshots for
compatibility reasons in case people had cached URLs or
auto-generated them somewhere.
We won't natively support xz and bzip2 just yet, but will
document (at least in comments) how to enable these expensive
compression schemes via git-config(1). Also, support disabling
certain archive types to twart URL guessing or old cached links
from spiders burning bandwidth.
In retrospect, enabling snapshots for my own cgit views was a
bad idea since it wastes bandwidth from crawlers and is
is often not useful for users with maintainer-built files
(e.g. "configure" from "configure.ac" for autoconf, where
only the latter is stored in git and the former is
generated in release tarballs).
Eric Wong [Thu, 31 Mar 2016 03:39:06 +0000 (03:39 +0000)]
repobrowse: avoid confusing linkification for "diff"
In /diff/ and /commit/ endpoints, making the word "diff"
a link to the top of the diff is not very useful and may
be confusing. Avoid wasting bandwidth and overloading
the reader with potential options.
Eric Wong [Wed, 30 Mar 2016 18:51:27 +0000 (18:51 +0000)]
repobrowse: git commit view uses pi-httpd.async
diff generation takes an indeterminate amount of time,
so avoid blocking our -httpd process if possible and
rely on Danga::Socket. This falls back to synchronous
execution as does the rest of public-inbox WWW code.
Eric Wong [Tue, 29 Mar 2016 21:45:37 +0000 (21:45 +0000)]
repobrowse: more consistent variable naming for /commit/
We avoid creating an extra hashref to share more code
with the /diff/ view. Furthermore, more preparation for
making the /commit/ view use Danga::Socket
Eric Wong [Sat, 12 Mar 2016 03:41:29 +0000 (03:41 +0000)]
repobrowse: implement diff view for compatibility
This needs to be cleaned up, but we shall support the
(potentially very expensive) diff view between arbitrary
revisions to avoid breaking existing URLs.
The diff parsing code will need to be consolidated
between this and the commit view.
Eric Wong [Sat, 12 Mar 2016 03:41:12 +0000 (03:41 +0000)]
examples/repobrowse.psgi: disable Chunked response by default
It seems incompatible with Starman and probably confuses other
HTTP/1.0-only servers, too. Our -httpd will respect it and
requires it for persistent connections.
Followup-to: dca2724e0aeb ("examples: disable Chunked response in PSGI example")
Eric Wong [Mon, 7 Mar 2016 08:10:58 +0000 (08:10 +0000)]
repobrowse: improve API consistency, harder
This allows RepobrowseConfig objects to passed directly
to Repobrowse initialization, similar to the way the normal
Config can be passed to WWW at initialization.
Eric Wong [Mon, 7 Mar 2016 08:10:55 +0000 (08:10 +0000)]
repobrowse: git fallback allows smart cloning
We can reuse the existing code for cloning ssoma repositories
to serve normal git repos for repobrowse.
Also, this finally adds a test to fallback to dumb cloning when
http.uploadPack is disabled for the git repository to save
CPU/memory on the host machine.
Eric Wong [Sat, 5 Mar 2016 07:47:10 +0000 (07:47 +0000)]
repobrowse: shorten env name to REPOBROWSE_CONFIG
...From PI_REPOBROWSE_CONFIG. The "PI_" prefix is
a bit too long and "repobrowse" is nearly an independent
project at this point from a user-perspective.
Eric Wong [Fri, 29 Jan 2016 03:23:39 +0000 (03:23 +0000)]
repobrowse: implement Atom feed
Mostly following cgit, except we do not serve redundant
text-only output which wastes bandwidth and doesn't preserve
pre-formatting layout which is critical to some messages.
Eric Wong [Wed, 20 Jan 2016 22:35:23 +0000 (22:35 +0000)]
repobrowse: commits with path redirect to root with anchor
We shall save clients the overhead of making extra HTTP requests
to follow partial paths. This ought to improve cache hit
effectiveness on both the server and client side by reducing
the potential different pages we may set.
Eric Wong [Tue, 19 Jan 2016 01:16:19 +0000 (01:16 +0000)]
repobrowse: nofollow and noindex tree links
It is expensive and of dubious usefulness to have tree content
auto-followed and indexed by search engines. Reduce the
links we recommend to crawlers so they don't waste resources
of users running our code or waste the time of search engine
users finding low-value content.
We will allow indexing blobs, however, as they may contain
useful information for others to refer to.
Of course, I definitely want search engines to index commit
messages; as I consider those to be the most important data
served.
Eric Wong [Sun, 17 Jan 2016 01:13:36 +0000 (01:13 +0000)]
repobrowse: italicize removed lines in diffs
This doesn't look too horrible on displays which render italics
and even degrades gracefully in text-only displays to underline
or colors in other terminals (lynx). Do not italicize leading
whitespace, since the fallback to underlines looks too noisy.
Eric Wong [Sun, 17 Jan 2016 00:32:24 +0000 (00:32 +0000)]
repobrowse: use 'raw' to link to the /plain/ endpoint
We use 'raw' in the rest of public-inbox to resolve the raw,
unformatted message (as does gmane and gitweb), so don't expose
the word 'plain' to users which only cgit seems to use.
Eric Wong [Sun, 17 Jan 2016 00:18:02 +0000 (00:18 +0000)]
repobrowse: allow serving PDF files from the 'plain' endpoint
PDFs are no more harmful than images or audio files
(they're not innocuous, but they're more difficult to use as an
XSS vector).
This prepares us to allow access the MIME_TYPE_WHITELIST for
serving random file types. But perhaps this will become
object-local to allow serving multiple, independent repobrowse
instances within one process...
Eric Wong [Sat, 16 Jan 2016 05:52:34 +0000 (05:52 +0000)]
rename PI_REPO_CONFIG => PI_REPOBROWSE_CONFIG
We want to use 'repobrowse' terminology consistently despite
it being longer. Furthermore, "repo-config" is an old git
command (nowadays git-config(1)) which may confuse some old
git users.
Eric Wong [Sat, 16 Jan 2016 03:21:06 +0000 (03:21 +0000)]
honor core.abbrev from git-config(1)
We will use core.abbrev=12 by default if unset, as the git
default of 7 is too low for long-term usability of links.
Some of our callers used 16, which was probably excessive.
Eric Wong [Sat, 16 Jan 2016 02:29:23 +0000 (02:29 +0000)]
repobrowse: eliminate oneline log view
The oneline view lacks sufficient information at times.
Reduce the number of options presented and always show
the full log message to avoid making the user follow more
links.
Eric Wong [Fri, 15 Jan 2016 22:04:30 +0000 (22:04 +0000)]
repobrowse: redirect w/o trailing slashes for humans
For human-visible HTML pages, avoid the trailing slash as that
can reduce cache hits in both the server (using varnish) and
clients. Typical web browsers are all capable of following
301 redirects without difficulty or human interaction.
We do not redirect for endpoints which may be consumed by
automated tools as that may cause compatibility problems. For
example, curl(1) does not automatically follow redirects and
needs the "-L" flag to do so.
Eric Wong [Thu, 14 Jan 2016 00:47:28 +0000 (00:47 +0000)]
repobrowse: queries are VCS-specific
While we want to keep a consistent set of parameters across
different VCSes, we cannot expect users of non-git VCSes to
use the same parameter names which make sense for git users.
Eric Wong [Sun, 3 Jan 2016 11:22:54 +0000 (11:22 +0000)]
repobrowse: tree view omits plain and log links
No need to clutter up the page with more senseless links few
people will follow. The blob view now has plain links for
people who want to save a single file, and will have log links
added, later.
Eric Wong [Sat, 26 Dec 2015 12:17:14 +0000 (12:17 +0000)]
repobrowse: support --graph output in log
This may be reverted if it turns out to be unsupportable
due to performance problems. However it certainly looks
useful for understanding commit history.
I'm keeping it off by default for now since taking over
500ms to render a page is not acceptable.
Even "git log --graph -50 554f6e41067b9e >/dev/null" on
git://git.kernel.org/pub/scm/git/git.git
takes around 700ms on my system.
Eric Wong [Thu, 24 Dec 2015 20:46:48 +0000 (20:46 +0000)]
repobrowse: patch generation improvements
It now works more or less correctly for merges (at least it does
what cgit does). It also supports path-limiting and the
signature line shows information on how the patch was generated
in an effort to educate git users.
Eric Wong [Thu, 24 Dec 2015 02:32:08 +0000 (02:32 +0000)]
repobrowse: blob view no longer displays line numbers
We will always support links to them, but they're a waste of
space and render poorly on small screens. Perhaps in the future
we may support linking to function context headers based on
.gitattributes, instead.
Eric Wong [Thu, 24 Dec 2015 01:56:22 +0000 (01:56 +0000)]
repobrowse: /commit/ forces everything to UTF-8
Hopefully we'll show some names properly in our pages now,
as well as simplify our code when escaping text for HTML
display.
Additionally, tweak our diff display by using <ins> and
<del> tags for added/removed text, respectively. This should
allow users to choose their own styles when viewing diffs
in their browser while being meaningful to people who cannot
differentiate colors.
Eric Wong [Wed, 23 Dec 2015 21:46:57 +0000 (21:46 +0000)]
repobrowse: git tree API modernizations
Rely on Hval more since that is stateful and hopefully makes it
easier-to-manage pathnames with weird characters. Additionally,
prefix individual function names to improve searchability
when/if we support additional VCSes.
Eric Wong [Wed, 23 Dec 2015 10:03:30 +0000 (10:03 +0000)]
examples/repobrowse.psgi: rename to eliminate the dash
We've been refering to this as "repobrowse", so drop the '-'.
While we're at it, enable chunking since we stream a good chunk
of our responses to avoid having too much in memory at once.
Eric Wong [Wed, 23 Dec 2015 10:00:20 +0000 (10:00 +0000)]
repobrowse: linkify hunk headers
A work-in-progress, but this provides useful links to the
exact line number of modified lines instead of blindly linking
to the top-of-the-file. Avoid flooding the user with links
but give hints by bolding the final resulting file or SHA-1
object ID.
Eric Wong [Tue, 5 Apr 2016 06:26:35 +0000 (06:26 +0000)]
view: link restructuring for index view
The "next/prev" links seem a bit awkward and I don't use them as
much as I expected to. However, move the "raw" message link
near the top since it's most useful for checking or reinforcing
the validity of the message via GPG or just reading headers.
Turn the Subject line into a permalink to the message, since
that's probably the common behavior anyways for other messaging
systems. Make the "[threaded|flat]" view links to always
visible for bookmark-ability despite the lack of a "permalink"
label.
Eric Wong [Mon, 4 Apr 2016 21:15:26 +0000 (21:15 +0000)]
http: fix condition for detecting persistence
Oops, we need to watch out for how we handle operator
precedence and ensure responses without a Content-Length
or "Transfer-Encoding: chunked" header will always
disconnect after writing.
Eric Wong [Thu, 17 Mar 2016 01:50:07 +0000 (01:50 +0000)]
daemon: expand @ARGV paths for running in '/'
We also require --stdout/--stderr/--pid-file to be absolute
paths for USR2 usage. However, allow PSGI files for -httpd
to be relative paths for ease-of-use.
Eric Wong [Sat, 12 Mar 2016 06:51:22 +0000 (06:51 +0000)]
searchmsg: preserve hard tabs, but drop CR (\r)
Hard tabs *may* be searchable, so preserve them since they do
not take up any more space than a normal space. However, CR
(carriage return) is worthless and likely a sign of a buggy mail
(or spam) client anyways.