diff options
Diffstat (limited to 'overlays/patches/public-inbox/0001-wwwtext-make-source-info-configurable.patch')
-rw-r--r-- | overlays/patches/public-inbox/0001-wwwtext-make-source-info-configurable.patch | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/overlays/patches/public-inbox/0001-wwwtext-make-source-info-configurable.patch b/overlays/patches/public-inbox/0001-wwwtext-make-source-info-configurable.patch new file mode 100644 index 000000000000..401e3f8a72cc --- /dev/null +++ b/overlays/patches/public-inbox/0001-wwwtext-make-source-info-configurable.patch @@ -0,0 +1,69 @@ +From 1fadaba96bd64ef113bfe37e14925b627ec2940e Mon Sep 17 00:00:00 2001 +From: Alyssa Ross <hi@alyssa.is> +Date: Fri, 17 Jan 2020 15:21:42 +0000 +Subject: [PATCH] wwwtext: make source info configurable + +--- + Documentation/public-inbox-config.pod | 6 ++++++ + lib/PublicInbox/WwwText.pm | 19 ++++++++++++++++++- + 2 files changed, 24 insertions(+), 1 deletion(-) + +diff --git a/Documentation/public-inbox-config.pod b/Documentation/public-inbox-config.pod +index d8504e61..420b5c01 100644 +--- a/Documentation/public-inbox-config.pod ++++ b/Documentation/public-inbox-config.pod +@@ -196,6 +196,12 @@ and the path may be "/dev/null" or any empty file. + Multiple files may be specified and will be included in the + order specified. + ++=item publicinbox.sourceinfo ++ ++Path to a file containing HTML instructions for downloading the ++public-inbox source code. Useful for AGPL compliance. If not ++specified, default git clone instructions are used. ++ + =item publicinboxmda.spamcheck + + This may be set to C<none> to disable the use of SpamAssassin +diff --git a/lib/PublicInbox/WwwText.pm b/lib/PublicInbox/WwwText.pm +index c6957e81..fa22ab94 100644 +--- a/lib/PublicInbox/WwwText.pm ++++ b/lib/PublicInbox/WwwText.pm +@@ -309,6 +309,21 @@ note: .onion URLs require Tor: https://www.torproject.org/ + EOM + } + ++sub _get_user_source_info ($) { ++ my ($pi_cfg) = @_; ++ ++ local $/; ++ my $path = $pi_cfg->{'publicinbox.sourceinfo'}; ++ if (!defined($path)) { ++ return; ++ } ++ open my $fh, '<', $path or do { ++ warn "Failed to open publicinbox.sourceinfo=$path: $!\n"; ++ return; ++ }; ++ <$fh>; ++} ++ + sub _mirror_help ($$) { + my ($ctx, $txt) = @_; + my $ibx = $ctx->{ibx}; +@@ -390,9 +405,11 @@ EOF + _add_onion_note($txt); + + my $code_url = prurl($ctx->{env}, $PublicInbox::WwwStream::CODE_URL); ++ my $default_info = "git clone $code_url"; ++ my $info = _get_user_source_info($ctx->{www}->{pi_cfg}) || $default_info; + $$txt .= join("\n\n", + coderepos_raw($ctx, $top_url), # may be empty +- "AGPL code for this site:\n git clone $code_url"); ++ "AGPL code for this site:\n $info"); + 1; + } + +-- +2.40.1 + |