From 9cb534599e2d271ce89fc195678bc4f243d383fe Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Tue, 8 Aug 2023 09:37:16 +0000 Subject: overlays/public-inbox: update for 1.9.0 --- ...iew-don-t-show-page-if-no-links-follow-it.patch | 27 --------- ...001-wwwtext-make-source-info-configurable.patch | 69 ++++++++++++++++++++++ ...002-wwwtext-make-source-info-configurable.patch | 69 ---------------------- overlays/patches/public-inbox/default.nix | 3 +- 4 files changed, 70 insertions(+), 98 deletions(-) delete mode 100644 overlays/patches/public-inbox/0001-view-don-t-show-page-if-no-links-follow-it.patch create mode 100644 overlays/patches/public-inbox/0001-wwwtext-make-source-info-configurable.patch delete mode 100644 overlays/patches/public-inbox/0002-wwwtext-make-source-info-configurable.patch (limited to 'overlays') diff --git a/overlays/patches/public-inbox/0001-view-don-t-show-page-if-no-links-follow-it.patch b/overlays/patches/public-inbox/0001-view-don-t-show-page-if-no-links-follow-it.patch deleted file mode 100644 index 50625a0f780c..000000000000 --- a/overlays/patches/public-inbox/0001-view-don-t-show-page-if-no-links-follow-it.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 43a7993ca9a6cf3b410adf4449580033ff19a4c9 Mon Sep 17 00:00:00 2001 -From: Alyssa Ross -Date: Thu, 16 Jan 2020 18:08:33 +0000 -Subject: [PATCH 1/2] view: don't show `page:' if no links follow it - ---- - lib/PublicInbox/View.pm | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm -index b90cb08b..193e9a48 100644 ---- a/lib/PublicInbox/View.pm -+++ b/lib/PublicInbox/View.pm -@@ -1189,7 +1189,9 @@ sub pagination_footer ($$) { - $next = $next ? "$next | " : ' | '; - $prev .= qq[ | latest]; - } -- "
page: $next$prev
"; -+ if ($prev || $next) { -+ "
page: $next$prev
"; -+ } - } - - sub paginate_recent ($$) { --- -2.35.1 - 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 +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 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 + 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 deleted file mode 100644 index 895b0925450c..000000000000 --- a/overlays/patches/public-inbox/0002-wwwtext-make-source-info-configurable.patch +++ /dev/null @@ -1,69 +0,0 @@ -From f930ec868a8596b0d30305ce76f86ed625e40d0a Mon Sep 17 00:00:00 2001 -From: Alyssa Ross -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 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 - diff --git a/overlays/patches/public-inbox/default.nix b/overlays/patches/public-inbox/default.nix index 37ee7ca4fab1..e2d53933132a 100644 --- a/overlays/patches/public-inbox/default.nix +++ b/overlays/patches/public-inbox/default.nix @@ -2,7 +2,6 @@ public-inbox.overrideAttrs ({ patches ? [], ... }: { patches = patches ++ [ - ./0001-view-don-t-show-page-if-no-links-follow-it.patch - ./0002-wwwtext-make-source-info-configurable.patch + ./0001-wwwtext-make-source-info-configurable.patch ]; }) -- cgit 1.4.1