user/dev discussion of public-inbox itself
 help / color / Atom feed
From: Eric Wong <e@yhbt.net>
To: meta@public-inbox.org
Subject: [PATCH 2/3] wwwtext: show altid instructions in config
Date: Thu, 26 Mar 2020 08:21:28 +0000
Message-ID: <20200326082129.21699-3-e@yhbt.net> (raw)
In-Reply-To: <20200326082129.21699-1-e@yhbt.net>

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;

  parent reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26  8:21 [PATCH 0/3] wwwaltid: add pointers for usability Eric Wong
2020-03-26  8:21 ` [PATCH 1/3] inbox: altid_map becomes a method Eric Wong
2020-03-26  8:21 ` Eric Wong [this message]
2020-03-26  8:21 ` [PATCH 3/3] wwwaltid: inform users to use POST instead of GET Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200326082129.21699-3-e@yhbt.net \
    --to=e@yhbt.net \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror https://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git