diff options
author | Alyssa Ross <hi@alyssa.is> | 2022-12-06 19:57:55 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-02-08 13:48:30 +0000 |
commit | bf3aadfdd39aa197e18bade671fab6726349ffa4 (patch) | |
tree | 698567af766ed441d757b57a7b21e68d4a342a2b /overlays | |
parent | f4afc5a01d9539ce09e47494e679c51f80723d07 (diff) | |
parent | 99665eb45f58d959d2cb9e49ddb960c79d596f33 (diff) | |
download | nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.gz nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.bz2 nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.lz nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.xz nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.zst nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.zip |
Merge commit '99665eb45f58d959d2cb9e49ddb960c79d596f33'
Diffstat (limited to 'overlays')
7 files changed, 74 insertions, 186 deletions
diff --git a/overlays/patches/default.nix b/overlays/patches/default.nix index 4f648dad6c42..f452516291cb 100644 --- a/overlays/patches/default.nix +++ b/overlays/patches/default.nix @@ -12,8 +12,6 @@ self: super: { llvmPackages = self.llvmPackages_latest; }; - gh = self.callPackage ./gh { inherit (super) gh; }; - gnupg = self.callPackage ./gnupg { inherit (super) gnupg; }; public-inbox = self.callPackage ./public-inbox { diff --git a/overlays/patches/gh/Support-reading-auth-token-from-file-descriptor.patch b/overlays/patches/gh/Support-reading-auth-token-from-file-descriptor.patch deleted file mode 100644 index 007f056a4673..000000000000 --- a/overlays/patches/gh/Support-reading-auth-token-from-file-descriptor.patch +++ /dev/null @@ -1,76 +0,0 @@ -From ffca80c699d1705dd9d6efd774b7467aa5945836 Mon Sep 17 00:00:00 2001 -From: Alyssa Ross <hi@alyssa.is> -Date: Mon, 29 Mar 2021 14:12:17 +0000 -Subject: [PATCH] Support reading auth token from file descriptor - -This is a quick hack: - -* It would make more sense to use a command line argument than an - environment variable, because there's not really any sense - propagating this to children. -* `gh auth status' doesn't work. ---- - internal/config/from_env.go | 25 ++++++++++++++++++++++++- - 1 file changed, 24 insertions(+), 1 deletion(-) - -diff --git a/internal/config/from_env.go b/internal/config/from_env.go -index ad31537f..5f3fb82f 100644 ---- a/internal/config/from_env.go -+++ b/internal/config/from_env.go -@@ -2,6 +2,7 @@ package config - - import ( - "fmt" -+ "io" - "os" - "strconv" - -@@ -10,6 +11,7 @@ import ( - - const ( - GH_HOST = "GH_HOST" -+ GH_TOKEN_FD = "GH_TOKEN_FD" - GH_TOKEN = "GH_TOKEN" - GITHUB_TOKEN = "GITHUB_TOKEN" - GH_ENTERPRISE_TOKEN = "GH_ENTERPRISE_TOKEN" -@@ -86,7 +88,27 @@ func (c *envConfig) CheckWriteable(hostname, key string) error { - return c.Config.CheckWriteable(hostname, key) - } - -+var tokenFromFd string -+ - func AuthTokenFromEnv(hostname string) (string, string) { -+ if tokenFromFd != "" { -+ return tokenFromFd, GH_TOKEN_FD -+ } -+ -+ if fd := os.Getenv(GH_TOKEN_FD); fd != "" { -+ if fd, err := strconv.ParseUint(fd, 10, 32); err == nil { -+ bytes := make([]byte, 40) -+ f := os.NewFile(uintptr(fd), "token") -+ defer f.Close() -+ if _, err := io.ReadFull(f, bytes); err == nil { -+ tokenFromFd = string(bytes) -+ return tokenFromFd, GH_TOKEN_FD -+ } -+ } -+ -+ return "", GH_TOKEN_FD -+ } -+ - if ghinstance.IsEnterprise(hostname) { - if token := os.Getenv(GH_ENTERPRISE_TOKEN); token != "" { - return token, GH_ENTERPRISE_TOKEN -@@ -111,7 +133,8 @@ func AuthTokenFromEnv(hostname string) (string, string) { - } - - func AuthTokenProvidedFromEnv() bool { -- return os.Getenv(GH_ENTERPRISE_TOKEN) != "" || -+ return os.Getenv(GH_TOKEN_FD) != "" || -+ os.Getenv(GH_ENTERPRISE_TOKEN) != "" || - os.Getenv(GITHUB_ENTERPRISE_TOKEN) != "" || - os.Getenv(GH_TOKEN) != "" || - os.Getenv(GITHUB_TOKEN) != "" --- -2.33.0 - diff --git a/overlays/patches/gh/default.nix b/overlays/patches/gh/default.nix deleted file mode 100644 index e4e3548ab5cf..000000000000 --- a/overlays/patches/gh/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ gh, ... } @ args: - -(gh.override (builtins.removeAttrs args [ "gh" ])).overrideGoAttrs ( - { patches ? [], ... }: { - patches = patches ++ [ - ./Support-reading-auth-token-from-file-descriptor.patch - ]; - } -) 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 index 866974532a85..50625a0f780c 100644 --- 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 @@ -1,4 +1,4 @@ -From 7678ad7f23347a40125055702bfa357a12260ff6 Mon Sep 17 00:00:00 2001 +From 43a7993ca9a6cf3b410adf4449580033ff19a4c9 Mon Sep 17 00:00:00 2001 From: Alyssa Ross <hi@alyssa.is> Date: Thu, 16 Jan 2020 18:08:33 +0000 Subject: [PATCH 1/2] view: don't show `page:' if no links follow it @@ -8,10 +8,10 @@ Subject: [PATCH 1/2] view: don't show `page:' if no links follow it 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm -index 1d5119cd..78998113 100644 +index b90cb08b..193e9a48 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm -@@ -1179,7 +1179,9 @@ sub pagination_footer ($$) { +@@ -1189,7 +1189,9 @@ sub pagination_footer ($$) { $next = $next ? "$next | " : ' | '; $prev .= qq[ | <a\nhref="$latest">latest</a>]; } @@ -23,5 +23,5 @@ index 1d5119cd..78998113 100644 sub paginate_recent ($$) { -- -2.30.0 +2.35.1 diff --git a/overlays/patches/public-inbox/0002-wwwstream-make-source-info-configurable.patch b/overlays/patches/public-inbox/0002-wwwstream-make-source-info-configurable.patch deleted file mode 100644 index e212a23809ed..000000000000 --- a/overlays/patches/public-inbox/0002-wwwstream-make-source-info-configurable.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 49ae6aacb43963af273e6011a6d9191caa3c7846 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] wwwstream: make source info configurable - ---- - Documentation/public-inbox-config.pod | 6 ++++++ - lib/PublicInbox/WwwListing.pm | 2 +- - lib/PublicInbox/WwwStream.pm | 27 +++++++++++++++++++++++---- - 3 files changed, 30 insertions(+), 5 deletions(-) - -diff --git a/Documentation/public-inbox-config.pod b/Documentation/public-inbox-config.pod -index 2d845f16..d04b14ad 100644 ---- a/Documentation/public-inbox-config.pod -+++ b/Documentation/public-inbox-config.pod -@@ -178,6 +178,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/WwwListing.pm b/lib/PublicInbox/WwwListing.pm -index bda2761c..5438bfe4 100644 ---- a/lib/PublicInbox/WwwListing.pm -+++ b/lib/PublicInbox/WwwListing.pm -@@ -99,7 +99,7 @@ sub psgi_triple { - $gzf->zmore('no inboxes, yet'); - } - my $out = $gzf->zflush('</pre><hr><pre>'. -- PublicInbox::WwwStream::code_footer($ctx->{env}) . -+ PublicInbox::WwwStream::code_footer($ctx->{www}->{pi_config}, $ctx->{env}) . - '</pre></body></html>'); - $h->[3] = bytes::length($out); - [ $code, $h, [ $out ] ]; -diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm -index 638f4e27..2af8e900 100644 ---- a/lib/PublicInbox/WwwStream.pm -+++ b/lib/PublicInbox/WwwStream.pm -@@ -96,10 +96,29 @@ EOF - @ret; # may be empty - } - --sub code_footer ($) { -- my ($env) = @_; -+sub get_user_source_info ($) { -+ my ($pi_config) = @_; -+ -+ local $/; -+ my $path = $pi_config->{'publicinbox.sourceinfo'}; -+ if (!defined($path)) { -+ return; -+ } -+ open my $fh, '<', $path or do { -+ warn "Failed to open publicinbox.sourceinfo=$path: $!\n"; -+ return; -+ }; -+ <$fh>; -+} -+ -+sub code_footer ($$) { -+ my ($pi_config, $env) = @_; - my $u = prurl($env, $CODE_URL); -- qq(AGPL code for this site: git clone <a\nhref="$u">$u</a>) -+ my $default_info = qq(git clone <a\n href="$u">$u</a>); -+ -+ my $info = get_user_source_info($pi_config) || $default_info; -+ -+ "AGPL code for this site: $info" - } - - sub _html_end { -@@ -174,7 +193,7 @@ EOF - $desc, - $urls, - coderepos($ctx), -- code_footer($ctx->{env}) -+ code_footer($ctx->{www}->{pi_config}, $ctx->{env}) - ).'</pre></body></html>'; - } - --- -2.30.0 - 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 + diff --git a/overlays/patches/public-inbox/default.nix b/overlays/patches/public-inbox/default.nix index 873af1f61e10..37ee7ca4fab1 100644 --- a/overlays/patches/public-inbox/default.nix +++ b/overlays/patches/public-inbox/default.nix @@ -3,10 +3,6 @@ public-inbox.overrideAttrs ({ patches ? [], ... }: { patches = patches ++ [ ./0001-view-don-t-show-page-if-no-links-follow-it.patch - ./0002-wwwstream-make-source-info-configurable.patch - (fetchpatch { - url = "https://public-inbox.org/meta/20210622120920.2756569-1-hi@alyssa.is/raw"; - sha256 = "0plpav4l5zkl14wjmc6qr54kcjch296ynawrbbyk4m6i54dyhfbw"; - }) + ./0002-wwwtext-make-source-info-configurable.patch ]; }) |