From 7ce18b8ed65267440399375480cd11c22f75e5ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Sun, 19 Mar 2023 07:27:00 +0100 Subject: [PATCH] make uploads private --- akkoma/default.nix | 1 + akkoma/make-uploads-private.patch | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 akkoma/make-uploads-private.patch diff --git a/akkoma/default.nix b/akkoma/default.nix index a4fe82c..1477068 100644 --- a/akkoma/default.nix +++ b/akkoma/default.nix @@ -26,6 +26,7 @@ ./block-invalid-datetime-mrf.patch ./require-image-description.patch ./change-twitter-preview.patch + ./make-uploads-private.patch ]; }; in diff --git a/akkoma/make-uploads-private.patch b/akkoma/make-uploads-private.patch new file mode 100644 index 0000000..63c7f8d --- /dev/null +++ b/akkoma/make-uploads-private.patch @@ -0,0 +1,21 @@ +diff --git a/lib/pleroma/uploaders/s3.ex b/lib/pleroma/uploaders/s3.ex +index 481153fe8..cae92cf2c 100644 +--- a/lib/pleroma/uploaders/s3.ex ++++ b/lib/pleroma/uploaders/s3.ex +@@ -33,14 +33,14 @@ def put_file(%Pleroma.Upload{} = upload) do + upload.tempfile + |> ExAws.S3.Upload.stream_file() + |> ExAws.S3.upload(bucket, s3_name, [ +- {:acl, :public_read}, ++ {:acl, :private}, + {:content_type, upload.content_type} + ]) + else + {:ok, file_data} = File.read(upload.tempfile) + + ExAws.S3.put_object(bucket, s3_name, file_data, [ +- {:acl, :public_read}, ++ {:acl, :private}, + {:content_type, upload.content_type} + ]) + end