From: "Eric Wong (Contractor, The Linux Foundation)" <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 1/4] wwwlisting: allow hiding entries from manifest
Date: Sun, 9 Jun 2019 04:31:02 +0000 [thread overview]
Message-ID: <20190609043105.22338-2-e@80x24.org> (raw)
In-Reply-To: <20190609043105.22338-1-e@80x24.org>
Since we already have a mechanism for hiding repositories from
the WWW listing, we might as well support another one for hiding
repositories from the upcoming manifest.js.gz generation.
---
lib/PublicInbox/WwwListing.pm | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/lib/PublicInbox/WwwListing.pm b/lib/PublicInbox/WwwListing.pm
index e1473b3..6d6d301 100644
--- a/lib/PublicInbox/WwwListing.pm
+++ b/lib/PublicInbox/WwwListing.pm
@@ -10,25 +10,27 @@ use PublicInbox::Hval qw(ascii_html);
use PublicInbox::Linkify;
use PublicInbox::View;
-sub list_all ($$) {
- my ($self, undef) = @_;
+sub list_all ($$$) {
+ my ($self, $env, $hide_key) = @_;
my @list;
$self->{pi_config}->each_inbox(sub {
my ($ibx) = @_;
- push @list, $ibx unless $ibx->{-hide}->{www};
+ push @list, $ibx unless $ibx->{-hide}->{$hide_key};
});
\@list;
}
-sub list_match_domain ($$) {
- my ($self, $env) = @_;
+sub list_match_domain ($$$) {
+ my ($self, $env, $hide_key) = @_;
my @list;
my $host = $env->{HTTP_HOST} // $env->{SERVER_NAME};
$host =~ s/:[0-9]+\z//;
my $re = qr!\A(?:https?:)?//\Q$host\E(?::[0-9]+)?/!i;
$self->{pi_config}->each_inbox(sub {
my ($ibx) = @_;
- push @list, $ibx if !$ibx->{-hide}->{www} && $ibx->{url} =~ $re;
+ if (!$ibx->{-hide}->{$hide_key} && $ibx->{url} =~ $re) {
+ push @list, $ibx;
+ }
});
\@list;
}
@@ -78,7 +80,11 @@ sub ibx_entry {
sub call {
my ($self, $env) = @_;
my $h = [ 'Content-Type', 'text/html; charset=UTF-8' ];
- my $list = $self->{list_cb}->($self, $env);
+ my $hide_key = 'www';
+ if ($env->{PATH_INFO} =~ m!/manifest\.js(?:\.gz)\z/!) {
+ $hide_key = 'manifest';
+ }
+ my $list = $self->{list_cb}->($self, $env, $hide_key);
my $code = 404;
my $title = 'public-inbox';
my $out = '';
--
EW
next prev parent reply other threads:[~2019-06-09 4:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-09 4:31 [PATCH 0/4] grokmirror-compatible manifests Eric Wong (Contractor, The Linux Foundation)
2019-06-09 4:31 ` Eric Wong (Contractor, The Linux Foundation) [this message]
2019-06-09 4:31 ` [PATCH 2/4] wwwlisting: generate grokmirror-compatible manifest.js.gz Eric Wong (Contractor, The Linux Foundation)
2019-06-09 4:31 ` [PATCH 3/4] www: wire up /$INBOX/manifest.js.gz, too Eric Wong (Contractor, The Linux Foundation)
2019-06-09 4:31 ` [PATCH 4/4] www: support $INBOX/git/$EPOCH.git for v2 cloning Eric Wong (Contractor, The Linux Foundation)
2019-06-10 6:21 ` [PATCH 5/4] git: ensure ->modified returns an integer Eric Wong (Contractor, The Linux Foundation)
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=20190609043105.22338-2-e@80x24.org \
--to=e@80x24.org \
--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).