* [PATCH 2/3] wwwtext: show altid instructions in config
2020-03-26 8:21 6% [PATCH 0/3] wwwaltid: add pointers for usability Eric Wong
@ 2020-03-26 8:21 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2020-03-26 8:21 UTC (permalink / raw)
To: meta
Exposing altid dumps will help and ensure total reproducibility
of existing instances.
AFAIK, sqlite3(1) can't execute arbitrary code, so it's not
quite as fashionable as the "curl | bash" stuff the cool people
are doing, these days :P
---
lib/PublicInbox/WwwText.pm | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/lib/PublicInbox/WwwText.pm b/lib/PublicInbox/WwwText.pm
index cbe82b73..2008ba09 100644
--- a/lib/PublicInbox/WwwText.pm
+++ b/lib/PublicInbox/WwwText.pm
@@ -138,15 +138,16 @@ sub inbox_config ($$$) {
my $ibx = $ctx->{-inbox};
push @$hdr, 'Content-Disposition', 'inline; filename=inbox.config';
my $name = dq_escape($ibx->{name});
+ my $inboxdir = '/path/to/top-level-inbox';
$$txt .= <<EOS;
; example public-inbox config snippet for "$name"
; see public-inbox-config(5) manpage for more details:
; https://public-inbox.org/public-inbox-config.html
[publicinbox "$name"]
- inboxdir = /path/to/top-level-inbox
+ inboxdir = $inboxdir
; note: public-inbox before v1.2.0 used "mainrepo"
; instead of "inboxdir", both remain supported after 1.2
- mainrepo = /path/to/top-level-inbox
+ mainrepo = $inboxdir
url = https://example.com/$name/
url = http://example.onion/$name/
EOS
@@ -154,6 +155,21 @@ EOS
defined(my $v = $ibx->{$k}) or next;
$$txt .= "\t$k = $_\n" for @$v;
}
+ if (my $altid = $ibx->{altid}) {
+ my $base_url = $ibx->base_url($ctx->{env});
+ my $altid_map = $ibx->altid_map;
+ $$txt .= <<EOF;
+ ; altid DBs may be used to provide numeric article ID lookup from
+ ; old, pre-existing sources. You can recreate them via curl(1),
+ ; gzip(1), and sqlite3(1) as documented:
+EOF
+ for (sort keys %$altid_map) {
+ $$txt .= "\t;\tcurl -XPOST $base_url$_.sql.gz | \\\n" .
+ "\t;\tgzip -dc | \\\n" .
+ "\t;\tsqlite3 $inboxdir/$_.sqlite3\n";
+ $$txt .= "\taltid = serial:$_:file=$_.sqlite3\n";
+ }
+ }
for my $k (qw(filter newsgroup obfuscate replyto watchheader)) {
defined(my $v = $ibx->{$k}) or next;
^ permalink raw reply related [relevance 7%]
* [PATCH 0/3] wwwaltid: add pointers for usability
@ 2020-03-26 8:21 6% Eric Wong
2020-03-26 8:21 7% ` [PATCH 2/3] wwwtext: show altid instructions in config Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2020-03-26 8:21 UTC (permalink / raw)
To: meta
Provide helpful hints and pointers in existing config example
to reproduce altid DBs when mirroring
Eric Wong (3):
inbox: altid_map becomes a method
wwwtext: show altid instructions in config
wwwaltid: inform users to use POST instead of GET
lib/PublicInbox/Inbox.pm | 15 +++++++++++++++
lib/PublicInbox/WWW.pm | 3 +++
lib/PublicInbox/WwwAltId.pm | 32 ++++++++++++++++++--------------
lib/PublicInbox/WwwText.pm | 20 ++++++++++++++++++--
4 files changed, 54 insertions(+), 16 deletions(-)
^ permalink raw reply [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-03-26 8:21 6% [PATCH 0/3] wwwaltid: add pointers for usability Eric Wong
2020-03-26 8:21 7% ` [PATCH 2/3] wwwtext: show altid instructions in config 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).