about summary refs log tree commit diff
path: root/overlays/patches/public-inbox/0002-wwwtext-make-source-info-configurable.patch
diff options
context:
space:
mode:
Diffstat (limited to 'overlays/patches/public-inbox/0002-wwwtext-make-source-info-configurable.patch')
-rw-r--r--overlays/patches/public-inbox/0002-wwwtext-make-source-info-configurable.patch69
1 files changed, 69 insertions, 0 deletions
diff --git a/overlays/patches/public-inbox/0002-wwwtext-make-source-info-configurable.patch b/overlays/patches/public-inbox/0002-wwwtext-make-source-info-configurable.patch
new file mode 100644
index 000000000000..895b0925450c
--- /dev/null
+++ b/overlays/patches/public-inbox/0002-wwwtext-make-source-info-configurable.patch
@@ -0,0 +1,69 @@
+From f930ec868a8596b0d30305ce76f86ed625e40d0a Mon Sep 17 00:00:00 2001
+From: Alyssa Ross <hi@alyssa.is>
+Date: Fri, 17 Jan 2020 15:21:42 +0000
+Subject: [PATCH 2/2] 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 43e54ed4..195c2886 100644
+--- a/Documentation/public-inbox-config.pod
++++ b/Documentation/public-inbox-config.pod
+@@ -194,6 +194,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 2b4e69fe..e3aec9e6 100644
+--- a/lib/PublicInbox/WwwText.pm
++++ b/lib/PublicInbox/WwwText.pm
+@@ -302,6 +302,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};
+@@ -383,9 +398,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.35.1
+