* [PATCH 7/8] www_text: add coderepo config support for extindex
2021-08-26 12:33 7% ` [PATCH 0/8] various WWW + extindex stuff Eric Wong
@ 2021-08-26 12:33 5% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-08-26 12:33 UTC (permalink / raw)
To: meta
At least manually configured coderepos "just work"
for extindex, though it probably could be automatic
and inherited from the publicinbox configs.
---
lib/PublicInbox/WwwText.pm | 75 +++++++++++++++++++-------------------
1 file changed, 38 insertions(+), 37 deletions(-)
diff --git a/lib/PublicInbox/WwwText.pm b/lib/PublicInbox/WwwText.pm
index eb5e3ac7..47310258 100644
--- a/lib/PublicInbox/WwwText.pm
+++ b/lib/PublicInbox/WwwText.pm
@@ -129,7 +129,42 @@ sub dq_escape ($) {
$name;
}
-sub URI_PATH () { '^A-Za-z0-9\-\._~/' }
+sub _coderepo_config ($$) {
+ my ($ctx, $txt) = @_;
+ my $cr = $ctx->{ibx}->{coderepo} // return;
+ # note: this doesn't preserve cgitrc layout, since we parse cgitrc
+ # and drop the original structure
+ $$txt .= "\tcoderepo = $_\n" for @$cr;
+ $$txt .= <<'EOF';
+
+; `coderepo' entries allows blob reconstruction via patch emails if
+; the inbox is indexed with Xapian. `@@ <from-range> <to-range> @@'
+; line number ranges in `[PATCH]' emails link to /$INBOX_NAME/$OID/s/,
+; an HTTP endpoint which reconstructs git blobs via git-apply(1).
+EOF
+ my $pi_cfg = $ctx->{www}->{pi_cfg};
+ for my $cr_name (@$cr) {
+ my $urls = $pi_cfg->get_all("coderepo.$cr_name.cgiturl");
+ my $path = "/path/to/$cr_name";
+ $cr_name = dq_escape($cr_name);
+
+ $$txt .= qq([coderepo "$cr_name"]\n);
+ if ($urls && scalar(@$urls)) {
+ $$txt .= "\t; ";
+ $$txt .= join(" ||\n\t;\t", map {;
+ my $dst = $path;
+ if ($path !~ m![a-z0-9_/\.\-]!i) {
+ $dst = '"'.dq_escape($dst).'"';
+ }
+ qq(git clone $_ $dst);
+ } @$urls);
+ $$txt .= "\n";
+ }
+ $$txt .= "\tdir = $path\n";
+ $$txt .= "\tcgiturl = https://example.com/";
+ $$txt .= uri_escape_utf8($cr_name, '^A-Za-z0-9\-\._~/')."\n";
+ }
+}
# n.b. this is a perfect candidate for memoization
sub inbox_config ($$$) {
@@ -176,41 +211,7 @@ EOF
$$txt .= "\t$k = $v\n";
}
$$txt .= "\tnntpmirror = $_\n" for (@{$ibx->nntp_url});
-
- # note: this doesn't preserve cgitrc layout, since we parse cgitrc
- # and drop the original structure
- if (defined(my $cr = $ibx->{coderepo})) {
- $$txt .= "\tcoderepo = $_\n" for @$cr;
- $$txt .= <<'EOF';
-
-; `coderepo' entries allows blob reconstruction via patch emails if
-; the inbox is indexed with Xapian. `@@ <from-range> <to-range> @@'
-; line number ranges in `[PATCH]' emails link to /$INBOX_NAME/$OID/s/,
-; an HTTP endpoint which reconstructs git blobs via git-apply(1).
-EOF
- my $pi_cfg = $ctx->{www}->{pi_cfg};
- for my $cr_name (@$cr) {
- my $urls = $pi_cfg->get_all("coderepo.$cr_name.cgiturl");
- my $path = "/path/to/$cr_name";
- $cr_name = dq_escape($cr_name);
-
- $$txt .= qq([coderepo "$cr_name"]\n);
- if ($urls && scalar(@$urls)) {
- $$txt .= "\t; ";
- $$txt .= join(" ||\n\t;\t", map {;
- my $dst = $path;
- if ($path !~ m![a-z0-9_/\.\-]!i) {
- $dst = '"'.dq_escape($dst).'"';
- }
- qq(git clone $_ $dst);
- } @$urls);
- $$txt .= "\n";
- }
- $$txt .= "\tdir = $path\n";
- $$txt .= "\tcgiturl = https://example.com/";
- $$txt .= uri_escape_utf8($cr_name, URI_PATH)."\n";
- }
- }
+ _coderepo_config($ctx, $txt);
1;
}
@@ -235,7 +236,7 @@ EOS
defined(my $v = $ibx->{$k}) or next;
$$txt .= "\t$k = $v\n";
}
- # TODO: coderepo support for extindex
+ _coderepo_config($ctx, $txt);
1;
}
^ permalink raw reply related [relevance 5%]
* [PATCH 0/8] various WWW + extindex stuff
@ 2021-08-26 12:33 7% ` Eric Wong
2021-08-26 12:33 5% ` [PATCH 7/8] www_text: add coderepo config support for extindex Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-08-26 12:33 UTC (permalink / raw)
To: meta; +Cc: Konstantin Ryabitsev
This hopefully makes the long .onion URL more usable on small
displays; but I also got sidetracked into making our "use bytes"
stuff less scary based on the notice in the bytes(3perl)
manpage.
There's a couple of small extindex-related fixes to reconcile
the differences between the two ibxish object types for WWW.
Eric Wong (8):
get rid of unnecessary bytes::length usage
ds: use bytes::substr and bytes::length module-wide for now
www_stream: sh-friendly .onion URLs wrapping
www: avoid incorrect instructions for extindex
www_text: fix example config snippet for extindex
config: do not parse altid for extindex
www_text: add coderepo config support for extindex
move ->ids_after from mm to over
lib/PublicInbox/Config.pm | 2 +-
lib/PublicInbox/DS.pm | 21 +++---
lib/PublicInbox/ExtSearch.pm | 4 -
lib/PublicInbox/HTTP.pm | 17 ++---
lib/PublicInbox/ManifestJsGz.pm | 3 +-
lib/PublicInbox/Mbox.pm | 10 +--
lib/PublicInbox/Msgmap.pm | 11 ---
lib/PublicInbox/NNTP.pm | 4 +-
lib/PublicInbox/Over.pm | 11 +++
lib/PublicInbox/View.pm | 5 +-
lib/PublicInbox/ViewVCS.pm | 5 +-
lib/PublicInbox/WWW.pm | 10 +--
lib/PublicInbox/WwwAttach.pm | 4 +-
lib/PublicInbox/WwwHighlight.pm | 5 +-
lib/PublicInbox/WwwListing.pm | 4 +-
lib/PublicInbox/WwwStatic.pm | 4 +-
lib/PublicInbox/WwwStream.pm | 126 +++++++++++++++++++-------------
lib/PublicInbox/WwwText.pm | 103 ++++++++++++++++----------
t/extindex-psgi.t | 15 ++++
t/psgi_search.t | 1 -
t/search-thr-index.t | 8 +-
t/www_listing.t | 19 ++++-
xt/cmp-msgstr.t | 2 +-
23 files changed, 229 insertions(+), 165 deletions(-)
^ permalink raw reply [relevance 7%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-08-16 16:36 RFE: Long .onion URL breaks mobile view Konstantin Ryabitsev
2021-08-26 12:33 7% ` [PATCH 0/8] various WWW + extindex stuff Eric Wong
2021-08-26 12:33 5% ` [PATCH 7/8] www_text: add coderepo config support for extindex Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).