user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 1/2] config: assume lists have multiple addresses
  2017-06-23 22:34  6% [PATCH 0/2] selective obfuscation Eric Wong
@ 2017-06-23 22:34  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2017-06-23 22:34 UTC (permalink / raw)
  To: meta

This should simplify the rest of our code for handling
the do-not-obfuscate list.
---
 lib/PublicInbox/Config.pm | 11 +++--------
 t/config.t                |  2 +-
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm
index 0597a52..2be485e 100644
--- a/lib/PublicInbox/Config.pm
+++ b/lib/PublicInbox/Config.pm
@@ -134,7 +134,7 @@ sub _fill {
 	my ($self, $pfx) = @_;
 	my $rv = {};
 
-	foreach my $k (qw(mainrepo address filter url newsgroup
+	foreach my $k (qw(mainrepo filter url newsgroup
 			infourl watch watchheader httpbackendmax
 			replyto feedmax nntpserver)) {
 		my $v = $self->{"$pfx.$k"};
@@ -154,7 +154,7 @@ sub _fill {
 
 	# TODO: more arrays, we should support multi-value for
 	# more things to encourage decentralization
-	foreach my $k (qw(altid nntpmirror)) {
+	foreach my $k (qw(address altid nntpmirror)) {
 		if (defined(my $v = $self->{"$pfx.$k"})) {
 			$rv->{$k} = ref($v) eq 'ARRAY' ? $v : [ $v ];
 		}
@@ -166,12 +166,7 @@ sub _fill {
 	$rv->{name} = $name;
 	$rv->{-pi_config} = $self;
 	$rv = PublicInbox::Inbox->new($rv);
-	my $v = $rv->{address};
-	if (ref($v) eq 'ARRAY') {
-		$self->{-by_addr}->{lc($_)} = $rv foreach @$v;
-	} else {
-		$self->{-by_addr}->{lc($v)} = $rv;
-	}
+	$self->{-by_addr}->{lc($_)} = $rv foreach @{$rv->{address}};
 	if (my $ng = $rv->{newsgroup}) {
 		$self->{-by_newsgroup}->{$ng} = $rv;
 	}
diff --git a/t/config.t b/t/config.t
index 3ba6111..437f1d1 100644
--- a/t/config.t
+++ b/t/config.t
@@ -25,7 +25,7 @@ my $tmpdir = tempdir('pi-config-XXXXXX', TMPDIR => 1, CLEANUP => 1);
 	my $cfg = PublicInbox::Config->new($f);
 	is_deeply($cfg->lookup('meta@public-inbox.org'), {
 		'mainrepo' => '/home/pi/meta-main.git',
-		'address' => 'meta@public-inbox.org',
+		'address' => [ 'meta@public-inbox.org' ],
 		'domain' => 'public-inbox.org',
 		'url' => 'http://example.com/meta',
 		-primary_address => 'meta@public-inbox.org',
-- 
EW


^ permalink raw reply related	[relevance 7%]

* [PATCH 0/2] selective obfuscation
@ 2017-06-23 22:34  6% Eric Wong
  2017-06-23 22:34  7% ` [PATCH 1/2] config: assume lists have multiple addresses Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2017-06-23 22:34 UTC (permalink / raw)
  To: meta

Obfuscating well-known, publically known addresses such as the
list address is pointless and poses accessibility problems.
Mitigate that by allowing admins to avoid obfuscating certain
addresses.

For example, I currently have this in my config:

==> ~/.public-inbox/config <==
	[publicinbox]
		noObfuscate = @80x24.org @vger.kernel.org
		noObfuscate = @public-inbox.org @nongnu.org @googlegroups.com
		noObfuscate = @ruby-lang.org @debian.org @lists.debian.org

Eric Wong (2):
      config: assume lists have multiple addresses
      allow admins to configure non-obfuscated addresses/domains

 MANIFEST                      |  1 +
 lib/PublicInbox/Config.pm     | 42 +++++++++++++++++++++++++++-------
 lib/PublicInbox/Hval.pm       | 15 +++++++++++-
 lib/PublicInbox/SearchView.pm |  9 ++++----
 lib/PublicInbox/View.pm       | 53 +++++++++++++++++++++++--------------------
 t/config.t                    | 30 +++++++++++++++++++++++-
 t/hval.t                      | 33 +++++++++++++++++++++++++++
 7 files changed, 144 insertions(+), 39 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 --
2017-06-23 22:34  6% [PATCH 0/2] selective obfuscation Eric Wong
2017-06-23 22:34  7% ` [PATCH 1/2] config: assume lists have multiple addresses 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).