Documentation/design_www.txt | 34 +++++++++++++++++----------------- lib/PublicInbox/Config.pm | 10 +++++----- lib/PublicInbox/ExtMsg.pm | 12 ++++++------ lib/PublicInbox/Feed.pm | 8 ++++---- lib/PublicInbox/NewsWWW.pm | 10 +++++----- lib/PublicInbox/View.pm | 2 +- lib/PublicInbox/WWW.pm | 112 +++++++++++++++++++++++++++--------------------------- script/public-inbox-init | 4 ++-- script/public-inbox-learn | 2 +- script/public-inbox-mda | 4 ++-- scripts/import_maildir | 4 ++-- scripts/import_slrnspool | 4 ++-- t/cgi.t | 2 +- t/config.t | 4 ++-- t/feed.t | 2 +- diff --git a/Documentation/design_www.txt b/Documentation/design_www.txt index 3cf6ea85106534aa7a5ced99e57ac2c9f0b35e30..67a90931f84e2405ba9e0ca3dab433685fe703ae 100644 --- a/Documentation/design_www.txt +++ b/Documentation/design_www.txt @@ -2,46 +2,46 @@ URL and anchor naming --------------------- ### Unstable endpoints -/$LISTNAME/?r=$GIT_COMMIT -> HTML only -/$LISTNAME/new.atom -> Atom feed +/$INBOX/?r=$GIT_COMMIT -> HTML only +/$INBOX/new.atom -> Atom feed #### Optional, relies on Search::Xapian -/$LISTNAME/$MESSAGE_ID/t/ -> HTML content of thread +/$INBOX/$MESSAGE_ID/t/ -> HTML content of thread anchors: #u location of $MESSAGE_ID in URL #m per-message links, where is of the Message-ID of each message (stable) #s relative numeric position of message in thread (unstable) -/$LISTNAME/$MESSAGE_ID/t.atom -> Atom feed for thread -/$LISTNAME/$MESSAGE_ID/t.mbox.gz -> gzipped mbox of thread +/$INBOX/$MESSAGE_ID/t.atom -> Atom feed for thread +/$INBOX/$MESSAGE_ID/t.mbox.gz -> gzipped mbox of thread ### Stable endpoints -/$LISTNAME/$MESSAGE_ID/ -> HTML content +/$INBOX/$MESSAGE_ID/ -> HTML content anchors: #r location of the current message in thread skeleton (requires Xapian search) #b start of the message body (linked from thread skeleton) -/$LISTNAME/$MESSAGE_ID -> 301 to /$LISTNAME/$MESSAGE_ID/ -/$LISTNAME/$MESSAGE_ID/raw -> raw mbox -/$LISTNAME/$MESSAGE_ID/R/ -> HTML reply instructions +/$INBOX/$MESSAGE_ID -> 301 to /$INBOX/$MESSAGE_ID/ +/$INBOX/$MESSAGE_ID/raw -> raw mbox +/$INBOX/$MESSAGE_ID/R/ -> HTML reply instructions # Covering up a pre-1.0 design mistake: -/$LISTNAME/$MESSAGE_ID/f/ -> 301 to /$LISTNAME/$MESSAGE_ID/ +/$INBOX/$MESSAGE_ID/f/ -> 301 to /$INBOX/$MESSAGE_ID/ ### Legacy endpoints (may be ambiguous given Message-IDs with similar suffixes) -/$LISTNAME/m/$MESSAGE_ID/ -> 301 to /$LISTNAME/$MESSAGE_ID/ -/$LISTNAME/m/$MESSAGE_ID.html -> 301 to /$LISTNAME/$MESSAGE_ID/ -/$LISTNAME/m/$MESSAGE_ID.txt -> 301 to /$LISTNAME/$MESSAGE_ID/raw -/$LISTNAME/f/$MESSAGE_ID.html -> 301 to /$LISTNAME/$MESSAGE_ID/ -/$LISTNAME/f/$MESSAGE_ID.txt [1] -> 301 to /$LISTNAME/$MESSAGE_ID/raw +/$INBOX/m/$MESSAGE_ID/ -> 301 to /$INBOX/$MESSAGE_ID/ +/$INBOX/m/$MESSAGE_ID.html -> 301 to /$INBOX/$MESSAGE_ID/ +/$INBOX/m/$MESSAGE_ID.txt -> 301 to /$INBOX/$MESSAGE_ID/raw +/$INBOX/f/$MESSAGE_ID.html -> 301 to /$INBOX/$MESSAGE_ID/ +/$INBOX/f/$MESSAGE_ID.txt [1] -> 301 to /$INBOX/$MESSAGE_ID/raw -/$LISTNAME/atom.xml [2] -> identical to /$LISTNAME/new.atom +/$INBOX/atom.xml [2] -> identical to /$INBOX/new.atom Additionally, we support git clone/fetch over HTTP (dumb and smart): - git clone --mirror http://$HOSTNAME/$LISTNAME + git clone --mirror http://$HOSTNAME/$INBOX FIXME: we must refactor/cleanup/add tests for most of our CGI before adding more endpoints and features. diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm index f84a9550b6c9a63f04477d8a2fee541c51e3382c..331d25c56bd5cddfe43687d0b50f607d6e218d25 100644 --- a/lib/PublicInbox/Config.pm +++ b/lib/PublicInbox/Config.pm @@ -45,18 +45,18 @@ foreach my $k (qw(mainrepo address filter)) { my $v = $self->{"$pfx.$k"}; $rv{$k} = $v if defined $v; } - my $listname = $pfx; - $listname =~ s/\Apublicinbox\.//; - $rv{listname} = $listname; + my $inbox = $pfx; + $inbox =~ s/\Apublicinbox\.//; + $rv{inbox} = $inbox; my $v = $rv{address}; $rv{-primary_address} = ref($v) eq 'ARRAY' ? $v->[0] : $v; \%rv; } sub get { - my ($self, $listname, $key) = @_; + my ($self, $inbox, $key) = @_; - $self->{"publicinbox.$listname.$key"}; + $self->{"publicinbox.$inbox.$key"}; } sub config_dir { $ENV{PI_DIR} || expand_filename('~/.public-inbox') } diff --git a/lib/PublicInbox/ExtMsg.pm b/lib/PublicInbox/ExtMsg.pm index 6356c3244ef14b414c00fe1ab7cc4e23d4ea41ce..e15ababcde05e50ec515590c14a7537463045988 100644 --- a/lib/PublicInbox/ExtMsg.pm +++ b/lib/PublicInbox/ExtMsg.pm @@ -24,7 +24,7 @@ sub ext_msg { my ($ctx) = @_; my $pi_config = $ctx->{pi_config}; - my $listname = $ctx->{listname}; + my $inbox = $ctx->{inbox}; my $mid = $ctx->{mid}; my $cgi = $ctx->{cgi}; my $env = $cgi->{env}; @@ -35,13 +35,13 @@ my (@nox, @pfx); foreach my $k (keys %$pi_config) { $k =~ /\Apublicinbox\.([A-Z0-9a-z-]+)\.url\z/ or next; - my $list = $1; - next if $list eq $listname; + my $name = $1; + next if $name eq $inbox; - my $git_dir = $pi_config->{"publicinbox.$list.mainrepo"}; + my $git_dir = $pi_config->{"publicinbox.$name.mainrepo"}; defined $git_dir or next; - my $url = $pi_config->{"publicinbox.$list.url"}; + my $url = $pi_config->{"publicinbox.$name.url"}; defined $url or next; $url =~ s!/+\z!!; @@ -93,7 +93,7 @@ if ($have_mm) { my $tmp_mid = $mid; my $url; again: - $url = $base_url . $listname; + $url = $base_url . $inbox; unshift @pfx, { git_dir => $ctx->{git_dir}, url => $url }; foreach my $pfx (@pfx) { my $git_dir = delete $pfx->{git_dir} or next; diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index d433726fb8d624506fa423bb3b2fd6f589566fa7..0d3bc81dfc410e42931f8d0b7c75a53387fda68c 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -260,7 +260,7 @@ # private functions below sub get_feedopts { my ($ctx) = @_; my $pi_config = $ctx->{pi_config}; - my $listname = $ctx->{listname}; + my $inbox = $ctx->{inbox}; my $cgi = $ctx->{cgi}; my %rv; if (open my $fh, '<', "$ctx->{git_dir}/description") { @@ -269,8 +269,8 @@ } else { $rv{description} = '($GIT_DIR/description missing)'; } - if ($pi_config && defined $listname && $listname ne '') { - my $addr = $pi_config->get($listname, 'address') || ""; + if ($pi_config && defined $inbox && $inbox ne '') { + my $addr = $pi_config->get($inbox, 'address') || ""; $rv{address} = $addr; $addr = $addr->[0] if ref($addr); $rv{id_addr} = $addr; @@ -279,7 +279,7 @@ $rv{id_addr} ||= 'public-inbox@example.com'; my $url_base; if ($cgi) { - $url_base = $cgi->base->as_string . $listname; + $url_base = $cgi->base->as_string . $inbox; if (my $mid = $ctx->{mid}) { # per-thread feed: $rv{atomurl} = "$url_base/$mid/t.atom"; } else { diff --git a/lib/PublicInbox/NewsWWW.pm b/lib/PublicInbox/NewsWWW.pm index dfc002171e650325d23d70fa5a7a6a3f352296fb..19eb596cea2a1563489ae2d6107a8e3643248cec 100644 --- a/lib/PublicInbox/NewsWWW.pm +++ b/lib/PublicInbox/NewsWWW.pm @@ -2,7 +2,7 @@ # Copyright (C) 2016 all contributors # License: AGPL-3.0+ # # Plack app redirector for mapping /$NEWSGROUP requests to -# the appropriate /$LISTNAME in PublicInbox::WWW because some +# the appropriate /$INBOX in PublicInbox::WWW because some # auto-linkifiers cannot handle nntp:// redirects properly. # This is also used directly by PublicInbox::WWW package PublicInbox::NewsWWW; @@ -64,11 +64,11 @@ my $pi_config = $self->{pi_config}; my %ng_map; foreach my $k (keys %$pi_config) { $k =~ /\Apublicinbox\.([^\.]+)\.mainrepo\z/ or next; - my $listname = $1; - my $git_dir = $pi_config->{"publicinbox.$listname.mainrepo"}; - my $url = $pi_config->{"publicinbox.$listname.url"}; + my $inbox = $1; + my $git_dir = $pi_config->{"publicinbox.$inbox.mainrepo"}; + my $url = $pi_config->{"publicinbox.$inbox.url"}; defined $url or next; - my $ng = $pi_config->{"publicinbox.$listname.newsgroup"}; + my $ng = $pi_config->{"publicinbox.$inbox.newsgroup"}; next if (!defined $ng) || ($ng eq ''); # disabled $url =~ m!/\z! or $url .= '/'; diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 70eb44e5b64768a0b6169e3c6c2af2cae853615a..d559cae4b9cbe34239f5c930dcf3abcca5929119 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -35,7 +35,7 @@ $footer . ''; } -# /$LISTNAME/$MESSAGE_ID/R/ +# /$INBOX/$MESSAGE_ID/R/ sub msg_reply { my ($ctx, $hdr, $footer) = @_; my $s = $hdr->header('Subject'); diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm index ce00e34518a5d7c717b52df77e12ebd2add1f0c8..85cb234b4d56351589bbbf8d633893e7498a17b6 100644 --- a/lib/PublicInbox/WWW.pm +++ b/lib/PublicInbox/WWW.pm @@ -20,7 +20,7 @@ use constant SSOMA_URL => '//ssoma.public-inbox.org/'; use constant PI_URL => '//public-inbox.org/'; require PublicInbox::Git; use PublicInbox::GitHTTPBackend; -our $LISTNAME_RE = qr!\A/([\w\.\-]+)!; +our $INBOX_RE = qr!\A/([\w\.\-]+)!; our $MID_RE = qr!([^/]+)!; our $END_RE = qr!(T/|t/|R/|t\.mbox(?:\.gz)?|t\.atom|raw|)!; @@ -44,9 +44,9 @@ my $path_info = $cgi->path_info; my $method = $cgi->method; if ($method eq 'POST' && - $path_info =~ m!$LISTNAME_RE/(git-upload-pack)\z!) { + $path_info =~ m!$INBOX_RE/(git-upload-pack)\z!) { my $path = $2; - return (invalid_list($self, $ctx, $1) || + return (invalid_inbox($self, $ctx, $1) || serve_git($cgi, $ctx->{git}, $path)); } elsif ($method !~ /\AGET|HEAD\z/) { @@ -56,32 +56,32 @@ # top-level indices and feeds if ($path_info eq '/') { r404(); - } elsif ($path_info =~ m!$LISTNAME_RE\z!o) { - invalid_list($self, $ctx, $1) || r301($ctx, $1); - } elsif ($path_info =~ m!$LISTNAME_RE(?:/|/index\.html)?\z!o) { - invalid_list($self, $ctx, $1) || get_index($ctx); - } elsif ($path_info =~ m!$LISTNAME_RE/(?:atom\.xml|new\.atom)\z!o) { - invalid_list($self, $ctx, $1) || get_atom($ctx); + } elsif ($path_info =~ m!$INBOX_RE\z!o) { + invalid_inbox($self, $ctx, $1) || r301($ctx, $1); + } elsif ($path_info =~ m!$INBOX_RE(?:/|/index\.html)?\z!o) { + invalid_inbox($self, $ctx, $1) || get_index($ctx); + } elsif ($path_info =~ m!$INBOX_RE/(?:atom\.xml|new\.atom)\z!o) { + invalid_inbox($self, $ctx, $1) || get_atom($ctx); - } elsif ($path_info =~ m!$LISTNAME_RE/ + } elsif ($path_info =~ m!$INBOX_RE/ ($PublicInbox::GitHTTPBackend::ANY)\z!ox) { my $path = $2; - invalid_list($self, $ctx, $1) || + invalid_inbox($self, $ctx, $1) || serve_git($cgi, $ctx->{git}, $path); - } elsif ($path_info =~ m!$LISTNAME_RE/$MID_RE/$END_RE\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/$MID_RE/$END_RE\z!o) { msg_page($self, $ctx, $1, $2, $3); # in case people leave off the trailing slash: - } elsif ($path_info =~ m!$LISTNAME_RE/$MID_RE/(T|t|R)\z!o) { - my ($listname, $mid, $suffix) = ($1, $2, $3); + } elsif ($path_info =~ m!$INBOX_RE/$MID_RE/(T|t|R)\z!o) { + my ($inbox, $mid, $suffix) = ($1, $2, $3); $suffix .= $suffix =~ /\A[tT]\z/ ? '/#u' : '/'; - r301($ctx, $listname, $mid, $suffix); + r301($ctx, $inbox, $mid, $suffix); - } elsif ($path_info =~ m!$LISTNAME_RE/$MID_RE/f/?\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/$MID_RE/f/?\z!o) { r301($ctx, $1, $2); # convenience redirects order matters - } elsif ($path_info =~ m!$LISTNAME_RE/([^/]{2,})\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/([^/]{2,})\z!o) { r301($ctx, $1, $2); } else { @@ -121,13 +121,13 @@ # simple response for errors sub r { [ $_[0], ['Content-Type' => 'text/plain'], [ join(' ', @_, "\n") ] ] } # returns undef if valid, array ref response if invalid -sub invalid_list { - my ($self, $ctx, $listname, $mid) = @_; - my $git_dir = $ctx->{pi_config}->get($listname, "mainrepo"); +sub invalid_inbox { + my ($self, $ctx, $inbox, $mid) = @_; + my $git_dir = $ctx->{pi_config}->get($inbox, "mainrepo"); if (defined $git_dir) { $ctx->{git_dir} = $git_dir; $ctx->{git} = PublicInbox::Git->new($git_dir); - $ctx->{listname} = $listname; + $ctx->{inbox} = $inbox; return; } @@ -139,9 +139,9 @@ $self->news_www->call($ctx->{cgi}->{env}); } # returns undef if valid, array ref response if invalid -sub invalid_list_mid { - my ($self, $ctx, $listname, $mid) = @_; - my $ret = invalid_list($self, $ctx, $listname, $mid); +sub invalid_inbox_mid { + my ($self, $ctx, $inbox, $mid) = @_; + my $ret = invalid_inbox($self, $ctx, $inbox, $mid); return $ret if $ret; $ctx->{mid} = $mid = uri_unescape($mid); @@ -157,14 +157,14 @@ } undef; } -# /$LISTNAME/new.atom -> Atom feed, includes replies +# /$INBOX/new.atom -> Atom feed, includes replies sub get_atom { my ($ctx) = @_; require PublicInbox::Feed; PublicInbox::Feed::generate($ctx); } -# /$LISTNAME/?r=$GIT_COMMIT -> HTML only +# /$INBOX/?r=$GIT_COMMIT -> HTML only sub get_index { my ($ctx) = @_; require PublicInbox::Feed; @@ -186,7 +186,7 @@ my $path = PublicInbox::MID::mid2path($ctx->{mid}); $ctx->{git}->cat_file("HEAD:$path"); } -# /$LISTNAME/$MESSAGE_ID/raw -> raw mbox +# /$INBOX/$MESSAGE_ID/raw -> raw mbox sub get_mid_txt { my ($ctx) = @_; my $x = mid2blob($ctx) or return r404($ctx); @@ -194,7 +194,7 @@ require PublicInbox::Mbox; PublicInbox::Mbox::emit1($ctx, $x); } -# /$LISTNAME/$MESSAGE_ID/ -> HTML content (short quotes) +# /$INBOX/$MESSAGE_ID/ -> HTML content (short quotes) sub get_mid_html { my ($ctx) = @_; my $x = mid2blob($ctx) or return r404($ctx); @@ -208,7 +208,7 @@ [ 200, [ 'Content-Type' => 'text/html; charset=UTF-8' ], [ PublicInbox::View::msg_html($ctx, $mime, $foot) ] ]; } -# /$LISTNAME/$MESSAGE_ID/R/ -> HTML content (fullquotes) +# /$INBOX/$MESSAGE_ID/R/ -> HTML content (fullquotes) sub get_reply_html { my ($ctx) = @_; my $x = mid2blob($ctx) or return r404($ctx); @@ -221,7 +221,7 @@ [ 200, [ 'Content-Type' => 'text/html; charset=UTF-8' ], [ PublicInbox::View::msg_reply($ctx, $hdr, $foot)] ]; } -# /$LISTNAME/$MESSAGE_ID/t/ +# /$INBOX/$MESSAGE_ID/t/ sub get_thread { my ($ctx, $flat) = @_; my $srch = searcher($ctx) or return need_search($ctx); @@ -252,7 +252,7 @@ return $footer; } # auto-generate a footer - my $listname = ctx_get($ctx, 'listname'); + my $inbox = ctx_get($ctx, 'inbox'); my $desc = try_cat("$git_dir/description"); $desc = '$GIT_DIR/description missing' unless defined $desc; chomp $desc; @@ -261,7 +261,7 @@ my $urls = try_cat("$git_dir/cloneurl"); my @urls = split(/\r?\n/, $urls || ''); my %seen = map { $_ => 1 } @urls; my $cgi = $ctx->{cgi}; - my $http = $cgi->base->as_string . $listname; + my $http = $cgi->base->as_string . $inbox; $seen{$http} or unshift @urls, $http; my $ssoma_url = PublicInbox::Hval::prurl($cgi->{env}, SSOMA_URL); if (scalar(@urls) == 1) { @@ -273,7 +273,7 @@ qq(">ssoma or git clone --mirror\n) . join("\n", map { "\tgit clone --mirror $_" } @urls); } - my $addr = $ctx->{pi_config}->get($listname, 'address'); + my $addr = $ctx->{pi_config}->get($inbox, 'address'); if (ref($addr) eq 'ARRAY') { $addr = $addr->[0]; # first address is primary } @@ -311,8 +311,8 @@ EOF [ 501, [ 'Content-Type' => 'text/html; charset=UTF-8' ], [ $msg ] ]; } -# /$LISTNAME/$MESSAGE_ID/t.mbox -> thread as mbox -# /$LISTNAME/$MESSAGE_ID/t.mbox.gz -> thread as gzipped mbox +# /$INBOX/$MESSAGE_ID/t.mbox -> thread as mbox +# /$INBOX/$MESSAGE_ID/t.mbox.gz -> thread as gzipped mbox # note: I'm not a big fan of other compression formats since they're # significantly more expensive on CPU than gzip and less-widely available, # especially on older systems. Stick to zlib since that's what git uses. @@ -324,7 +324,7 @@ PublicInbox::Mbox::thread_mbox($ctx, $srch, $sfx); } -# /$LISTNAME/$MESSAGE_ID/t.atom -> thread as Atom feed +# /$INBOX/$MESSAGE_ID/t.atom -> thread as Atom feed sub get_thread_atom { my ($ctx) = @_; searcher($ctx) or return need_search($ctx); @@ -337,54 +337,54 @@ sub legacy_redirects { my ($self, $ctx, $path_info) = @_; # single-message pages - if ($path_info =~ m!$LISTNAME_RE/m/(\S+)/\z!o) { + if ($path_info =~ m!$INBOX_RE/m/(\S+)/\z!o) { r301($ctx, $1, $2); - } elsif ($path_info =~ m!$LISTNAME_RE/m/(\S+)/raw\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/m/(\S+)/raw\z!o) { r301($ctx, $1, $2, 'raw'); - } elsif ($path_info =~ m!$LISTNAME_RE/f/(\S+)/\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/f/(\S+)/\z!o) { r301($ctx, $1, $2); # thread display - } elsif ($path_info =~ m!$LISTNAME_RE/t/(\S+)/\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/t/(\S+)/\z!o) { r301($ctx, $1, $2, 't/#u'); - } elsif ($path_info =~ m!$LISTNAME_RE/t/(\S+)/mbox(\.gz)?\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/t/(\S+)/mbox(\.gz)?\z!o) { r301($ctx, $1, $2, "t.mbox$3"); # even older legacy redirects - } elsif ($path_info =~ m!$LISTNAME_RE/m/(\S+)\.html\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/m/(\S+)\.html\z!o) { r301($ctx, $1, $2); - } elsif ($path_info =~ m!$LISTNAME_RE/t/(\S+)\.html\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/t/(\S+)\.html\z!o) { r301($ctx, $1, $2, 't/#u'); - } elsif ($path_info =~ m!$LISTNAME_RE/f/(\S+)\.html\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/f/(\S+)\.html\z!o) { r301($ctx, $1, $2); - } elsif ($path_info =~ m!$LISTNAME_RE/(?:m|f)/(\S+)\.txt\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/(?:m|f)/(\S+)\.txt\z!o) { r301($ctx, $1, $2, 'raw'); - } elsif ($path_info =~ m!$LISTNAME_RE/t/(\S+)(\.mbox(?:\.gz)?)\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/t/(\S+)(\.mbox(?:\.gz)?)\z!o) { r301($ctx, $1, $2, "t$3"); # legacy convenience redirects, order still matters - } elsif ($path_info =~ m!$LISTNAME_RE/m/(\S+)\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/m/(\S+)\z!o) { r301($ctx, $1, $2); - } elsif ($path_info =~ m!$LISTNAME_RE/t/(\S+)\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/t/(\S+)\z!o) { r301($ctx, $1, $2, 't/#u'); - } elsif ($path_info =~ m!$LISTNAME_RE/f/(\S+)\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/f/(\S+)\z!o) { r301($ctx, $1, $2); # some Message-IDs have slashes in them and the HTTP server # may try to be clever and unescape them :< - } elsif ($path_info =~ m!$LISTNAME_RE/(\S+/\S+)/$END_RE\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/(\S+/\S+)/$END_RE\z!o) { msg_page($self, $ctx, $1, $2, $3); # in case people leave off the trailing slash: - } elsif ($path_info =~ m!$LISTNAME_RE/(\S+/\S+)/(T|t)\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/(\S+/\S+)/(T|t)\z!o) { r301($ctx, $1, $2, $3 eq 't' ? 't/#u' : $3); - } elsif ($path_info =~ m!$LISTNAME_RE/(\S+/\S+)/f\z!o) { + } elsif ($path_info =~ m!$INBOX_RE/(\S+/\S+)/f\z!o) { r301($ctx, $1, $2); } else { $self->news_www->call($ctx->{cgi}->{env}); @@ -392,11 +392,11 @@ } } sub r301 { - my ($ctx, $listname, $mid, $suffix) = @_; + my ($ctx, $inbox, $mid, $suffix) = @_; my $cgi = $ctx->{cgi}; my $url; my $qs = $cgi->env->{QUERY_STRING}; - $url = $cgi->base->as_string . $listname . '/'; + $url = $cgi->base->as_string . $inbox . '/'; $url .= (uri_escape_utf8($mid) . '/') if (defined $mid); $url .= $suffix if (defined $suffix); $url .= "?$qs" if $qs ne ''; @@ -407,9 +407,9 @@ [ "Redirecting to $url\n" ] ] } sub msg_page { - my ($self, $ctx, $list, $mid, $e) = @_; + my ($self, $ctx, $inbox, $mid, $e) = @_; my $ret; - $ret = invalid_list_mid($self, $ctx, $list, $mid) and return $ret; + $ret = invalid_inbox_mid($self, $ctx, $inbox, $mid) and return $ret; '' eq $e and return get_mid_html($ctx); 't/' eq $e and return get_thread($ctx); 't.atom' eq $e and return get_thread_atom($ctx); diff --git a/script/public-inbox-init b/script/public-inbox-init index d66361dfed4877801033595430aff9b2dfa04291..ca0f9ddfa8fe0de98a6ec0498b6477d348553cdb 100755 --- a/script/public-inbox-init +++ b/script/public-inbox-init @@ -43,10 +43,10 @@ my $conflict; foreach my $addr (@address) { my $found = $cfg->lookup($addr); if ($found) { - if ($found->{listname} ne $name) { + if ($found->{inbox} ne $name) { print STDERR "`$addr' already defined for ", - "`$found->{listname}',\n", + "`$found->{inbox}',\n", "does not match intend `$name'\n"; $conflict = 1; } else { diff --git a/script/public-inbox-learn b/script/public-inbox-learn index 0af1e94c4a3e2b9ac269feb99be0a0e453597601..1c051ec1e274a0a9ff166d7ec4a7c779a1d2c8c4 100755 --- a/script/public-inbox-learn +++ b/script/public-inbox-learn @@ -51,7 +51,7 @@ my ($out, $err) = ("", ""); my $git = PublicInbox::Git->new($git_dir); # We do not touch GIT_COMMITTER_* env here so we can track # who trained the message. - my $name = $ENV{GIT_COMMITTER_NAME} || $dst->{listname}; + my $name = $ENV{GIT_COMMITTER_NAME} || $dst->{inbox}; my $email = $ENV{GIT_COMMITTER_EMAIL} || $recipient; my $im = PublicInbox::Import->new($git, $name, $email); diff --git a/script/public-inbox-mda b/script/public-inbox-mda index 611e7c3887035d35d49381056bcca1937185ea24..8e224a50858a4fbd7846f6519febf75d58eea890 100755 --- a/script/public-inbox-mda +++ b/script/public-inbox-mda @@ -49,7 +49,7 @@ $filter_arg = $filter; } elsif ($fcfg eq 'scrub') { $filter_arg = undef; # the default for legacy versions } else { - warn "publicinbox.$dst->{listname}.filter=$fcfg invalid\n"; + warn "publicinbox.$dst->{inbox}.filter=$fcfg invalid\n"; warn "must be either 'scrub' or 'reject' (the default)\n"; } @@ -65,7 +65,7 @@ index_sync($main_repo) if ($? == 0); }; my $git = PublicInbox::Git->new($main_repo); my $im = PublicInbox::Import->new($git, - $dst->{listname}, $recipient); + $dst->{inbox}, $recipient); if (defined $im->add($msg)) { $im->done; $filter->ignore; # exits diff --git a/scripts/import_maildir b/scripts/import_maildir index aaabe80da37347f4cdf24a5e68ee7e4a82f96ff4..c87ca1b2bb5e49ca38d47b3481f28047c61b8eed 100755 --- a/scripts/import_maildir +++ b/scripts/import_maildir @@ -9,8 +9,8 @@ MAINREPO=/path/to/your/repo.git export ORIGINAL_RECIPIENT='list@example.com' git init --bare $MAINREPO export GIT_CONFIG=$HOME/.public-inbox/config - git config publicinbox.$LISTNAME.address $ORIGINAL_RECIPIENT - git config publicinbox.$LISTNAME.mainrepo $MAINREPO + git config publicinbox.$INBOX.address $ORIGINAL_RECIPIENT + git config publicinbox.$INBOX.mainrepo $MAINREPO unset GIT_CONFIG ./import_maildir /path/to/maildir/ =cut diff --git a/scripts/import_slrnspool b/scripts/import_slrnspool index f8271f586f010e41b3dee7247876f72428c3eb77..687809b7eb64446aca7a52b86f5fa10d7ab33c19 100755 --- a/scripts/import_slrnspool +++ b/scripts/import_slrnspool @@ -5,7 +5,7 @@ # # Incremental (or one-shot) importer of a slrnpull news spool =begin usage export ORIGINAL_RECIPIENT=address@example.com - public-inbox-init $LISTNAME $GIT_DIR $HTTP_URL $ORIGINAL_RECIPIENT + public-inbox-init $INBOX $GIT_DIR $HTTP_URL $ORIGINAL_RECIPIENT ./import_slrnspool SLRNPULL_ROOT/news/foo/bar =cut use strict; @@ -33,7 +33,7 @@ } sub key { my ($cfg) = @_; - "publicinbox.$cfg->{listname}.importslrnspoolstate"; + "publicinbox.$cfg->{inbox}.importslrnspoolstate"; } sub get_min { diff --git a/t/cgi.t b/t/cgi.t index fbdbfbf6a5407847776711d9e865ca653baf2348..9d2d87fefff6bc508646f8debe078e4909dad4f7 100644 --- a/t/cgi.t +++ b/t/cgi.t @@ -141,7 +141,7 @@ $idx->{body} =~ s!/index.html(\?r=)!/$1!g; # dirty... $idx->{body} = [ split(/\n/, $idx->{body}) ]; $res->{body} = [ split(/\n/, $res->{body}) ]; is_deeply($res, $idx, - '/$LISTNAME/ and /$LISTNAME/index.html are nearly identical'); + '/$INBOX/ and /$INBOX/index.html are nearly identical'); # more checks in t/feed.t } diff --git a/t/config.t b/t/config.t index 48df08716c654fac0f3ca5852e739a85fd41b683..7a63aa7639e651f3e072d4064e684c00083d45c3 100644 --- a/t/config.t +++ b/t/config.t @@ -29,7 +29,7 @@ is_deeply($cfg->lookup('meta@public-inbox.org'), { 'mainrepo' => '/home/pi/meta-main.git', 'address' => 'meta@public-inbox.org', -primary_address => 'meta@public-inbox.org', - 'listname' => 'meta', + 'inbox' => 'meta', }, "lookup matches expected output"); is($cfg->lookup('blah@example.com'), undef, @@ -42,7 +42,7 @@ 'sandbox@public-inbox.org', 'test@public-inbox.org'], -primary_address => 'try@public-inbox.org', 'mainrepo' => '/home/pi/test-main.git', - 'listname' => 'test', + 'inbox' => 'test', }, "lookup matches expected output for test"); } diff --git a/t/feed.t b/t/feed.t index 61f0dc724328931da52daacac90b2ac8fd7362a0..ab92039f8e1e503d41e4841317ef249ce2c17199 100644 --- a/t/feed.t +++ b/t/feed.t @@ -184,7 +184,7 @@ foreach my $addr (('a@example.com'), ['a@example.com','b@localhost']) { my $feed = string_feed({ git_dir => $git_dir, max => 3, - listname => 'asdf', + inbox => 'asdf', pi_config => bless({ 'publicinbox.asdf.address' => $addr, }, 'PublicInbox::Config'),