1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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
|