From: Ali Alnubani <alialnu@mellanox.com>
To: "meta@public-inbox.org" <meta@public-inbox.org>
Subject: [RFC] make external urls user configurable
Date: Tue, 4 Jun 2019 22:41:19 +0000 [thread overview]
Message-ID: <20190604224051.8442-1-alialnu@mellanox.com> (raw)
The configuration variable publicinbox.exturls will
hold a comma-delimited list of external urls to point
to in case a thread wasn't found.
This configuration will replace the default hard-coded
list in the module 'PublicInbox::ExtMsg' (lib/PublicInbox/ExtMsg.pm:17).
An example configuration:
[publicinbox]
exturls=//marc.info/?i=%s,\
//www.mail-archive.com/search?l=mid&q=%s,\
nntp://news.gmane.org/%s,\
https://lists.debian.org/msgid-search/%s,\
//docs.FreeBSD.org/cgi/mid.cgi?db=mid&id=%s,\
https://www.w3.org/mid/%s,\
http://www.postgresql.org/message-id/%s,\
; The following entry has to be a single line
https://lists.debconf.org/cgi-lurker/keyword.cgi?doc-url=/lurker&
format=en.html&query=id:%s
---
We started using public-inbox for dpdk.org (http://inbox.dpdk.org/dev/),
and most of our mailing lists aren't archived by these external
websites.
This still needs further improvements.
lib/PublicInbox/ExtMsg.pm | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/lib/PublicInbox/ExtMsg.pm b/lib/PublicInbox/ExtMsg.pm
index d07d5a7..b1f6528 100644
--- a/lib/PublicInbox/ExtMsg.pm
+++ b/lib/PublicInbox/ExtMsg.pm
@@ -13,20 +13,6 @@ use PublicInbox::MID qw/mid2path/;
use PublicInbox::WwwStream;
our $MIN_PARTIAL_LEN = 16;
-# TODO: user-configurable
-our @EXT_URL = map { ascii_html($_) } (
- # leading "//" denotes protocol-relative (http:// or https://)
- '//marc.info/?i=%s',
- '//www.mail-archive.com/search?l=mid&q=%s',
- 'nntp://news.gmane.org/%s',
- 'https://lists.debian.org/msgid-search/%s',
- '//docs.FreeBSD.org/cgi/mid.cgi?db=mid&id=%s',
- 'https://www.w3.org/mid/%s',
- 'http://www.postgresql.org/message-id/%s',
- 'https://lists.debconf.org/cgi-lurker/keyword.cgi?'.
- 'doc-url=/lurker&format=en.html&query=id:%s'
-);
-
sub PARTIAL_MAX () { 100 }
sub search_partial ($$) {
@@ -166,7 +152,9 @@ sub ext_urls {
if (@EXT_URL && index($mid, '@') >= 0) {
my $env = $ctx->{env};
my $e = "\nPerhaps try an external site:\n\n";
- foreach my $url (@EXT_URL) {
+ my @exturls = grep { /\S/ } map { ascii_html($_) } (
+ split(/[\s,]+/, $ctx->{www}->{pi_config}->{'publicinbox.exturls'}));
+ foreach my $url (@exturls) {
my $u = PublicInbox::Hval::prurl($env, $url);
my $r = sprintf($u, $href);
my $t = sprintf($u, $html);
--
2.21.0
next reply other threads:[~2019-06-04 22:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-04 22:41 Ali Alnubani [this message]
2019-06-05 0:58 ` [RFC] make external urls user configurable Eric Wong
2019-06-09 7:16 ` Ali Alnubani
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=20190604224051.8442-1-alialnu@mellanox.com \
--to=alialnu@mellanox.com \
--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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).