diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a226aa71..497c7152b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Uploadfilter `Pleroma.Upload.Filter.Exiftool.ReadDescription` returns description values to the FE so they can pre fill the image description field ## Changed -- Uploadfilter `Pleroma.Upload.Filter.Exiftool` has been renamed to `Pleroma.Upload.Filter.Exiftool.StripLocation` +- Uploadfilter `Pleroma.Upload.Filter.Exiftool` has been renamed to `Pleroma.Upload.Filter.Exiftool.StripMetadata` ## Fixed - Issue preventing fetching anything from IPv6-only instances diff --git a/docs/docs/administration/CLI_tasks/instance.md b/docs/docs/administration/CLI_tasks/instance.md index 10872e5b3..1a3f8153e 100644 --- a/docs/docs/administration/CLI_tasks/instance.md +++ b/docs/docs/administration/CLI_tasks/instance.md @@ -37,7 +37,7 @@ If any of the options are left unspecified, you will be prompted interactively. - `--static-dir ` - the directory custom public files should be read from (custom emojis, frontend bundle overrides, robots.txt, etc.) - `--listen-ip ` - the ip the app should listen to, defaults to 127.0.0.1 - `--listen-port ` - the port the app should listen to, defaults to 4000 -- `--strip-uploads-location ` - use ExifTool to strip uploads of sensitive location data +- `--strip-uploads-metadata ` - use ExifTool to strip uploads of sensitive metadata - `--read-uploads-description ` - use ExifTool to read image descriptions from uploads - `--anonymize-uploads ` - randomize uploaded filenames - `--dedupe-uploads ` - store files based on their hash to reduce data storage requirements if duplicates are uploaded with different filenames diff --git a/docs/docs/configuration/cheatsheet.md b/docs/docs/configuration/cheatsheet.md index 004f6cf70..d2b699a51 100644 --- a/docs/docs/configuration/cheatsheet.md +++ b/docs/docs/configuration/cheatsheet.md @@ -654,7 +654,7 @@ This filter replaces the declared filename (not the path) of an upload. * `text`: Text to replace filenames in links. If empty, `{random}.extension` will be used. You can get the original filename extension by using `{extension}`, for example `custom-file-name.{extension}`. -#### Pleroma.Upload.Filter.Exiftool.StripLocation +#### Pleroma.Upload.Filter.Exiftool.StripMetadata This filter only strips the GPS and location metadata with Exiftool leaving color profiles and attributes intact. diff --git a/docs/docs/installation/optional/media_graphics_packages.md b/docs/docs/installation/optional/media_graphics_packages.md index cbde2a952..d79ac2a07 100644 --- a/docs/docs/installation/optional/media_graphics_packages.md +++ b/docs/docs/installation/optional/media_graphics_packages.md @@ -29,5 +29,5 @@ It is required for the following Akkoma features: `exiftool` is media files metadata reader/writer. It is required for the following Akkoma features: - * `Pleroma.Upload.Filters.Exiftool.StripLocation` upload filter (related config: `Plaroma.Upload/filters` in `config/config.exs`) + * `Pleroma.Upload.Filters.Exiftool.StripMetadata` upload filter (related config: `Plaroma.Upload/filters` in `config/config.exs`) * `Pleroma.Upload.Filters.Exiftool.ReadDescription` upload filter (related config: `Plaroma.Upload/filters` in `config/config.exs`) diff --git a/lib/mix/tasks/pleroma/instance.ex b/lib/mix/tasks/pleroma/instance.ex index 8f89ebe3e..45f3812c9 100644 --- a/lib/mix/tasks/pleroma/instance.ex +++ b/lib/mix/tasks/pleroma/instance.ex @@ -35,7 +35,7 @@ defmodule Mix.Tasks.Pleroma.Instance do static_dir: :string, listen_ip: :string, listen_port: :string, - strip_uploads_location: :string, + strip_uploads_metadata: :string, read_uploads_description: :string, anonymize_uploads: :string ], @@ -170,7 +170,7 @@ defmodule Mix.Tasks.Pleroma.Instance do ) |> Path.expand() - {strip_uploads_location_message, strip_uploads_location_default} = + {strip_uploads_metadata_message, strip_uploads_metadata_default} = if Pleroma.Utils.command_available?("exiftool") do {"Do you want to strip location (GPS) data from uploaded images? This requires exiftool, it was detected as installed. (y/n)", "y"} @@ -179,12 +179,12 @@ defmodule Mix.Tasks.Pleroma.Instance do "n"} end - strip_uploads_location = + strip_uploads_metadata = get_option( options, - :strip_uploads_location, - strip_uploads_location_message, - strip_uploads_location_default + :strip_uploads_metadata, + strip_uploads_metadata_message, + strip_uploads_metadata_default ) === "y" {read_uploads_description_message, read_uploads_description_default} = @@ -248,7 +248,7 @@ defmodule Mix.Tasks.Pleroma.Instance do listen_port: listen_port, upload_filters: upload_filters(%{ - strip_location: strip_uploads_location, + strip_metadata: strip_uploads_metadata, read_description: read_uploads_description, anonymize: anonymize_uploads }) @@ -325,8 +325,8 @@ defmodule Mix.Tasks.Pleroma.Instance do defp upload_filters(filters) when is_map(filters) do enabled_filters = - if filters.strip_location do - [Pleroma.Upload.Filter.Exiftool.StripLocation] + if filters.strip_metadata do + [Pleroma.Upload.Filter.Exiftool.StripMetadata] else [] end diff --git a/lib/pleroma/application_requirements.ex b/lib/pleroma/application_requirements.ex index ee9b1ef82..c3777d8f1 100644 --- a/lib/pleroma/application_requirements.ex +++ b/lib/pleroma/application_requirements.ex @@ -164,7 +164,7 @@ defmodule Pleroma.ApplicationRequirements do defp check_system_commands!(:ok) do filter_commands_statuses = [ - check_filter(Pleroma.Upload.Filter.Exiftool.StripLocation, "exiftool"), + check_filter(Pleroma.Upload.Filter.Exiftool.StripMetadata, "exiftool"), check_filter(Pleroma.Upload.Filter.Exiftool.ReadDescription, "exiftool"), check_filter(Pleroma.Upload.Filter.Mogrify, "mogrify"), check_filter(Pleroma.Upload.Filter.Mogrifun, "mogrify"), diff --git a/lib/pleroma/config/deprecation_warnings.ex b/lib/pleroma/config/deprecation_warnings.ex index 3858bf88e..b62532595 100644 --- a/lib/pleroma/config/deprecation_warnings.ex +++ b/lib/pleroma/config/deprecation_warnings.ex @@ -28,7 +28,7 @@ defmodule Pleroma.Config.DeprecationWarnings do if Pleroma.Upload.Filter.Exiftool in filters do Logger.warning(""" !!!DEPRECATION WARNING!!! - Your config is using Exiftool as a filter instead of Exiftool.StripLocation. This should work for now, but you are advised to change to the new configuration to prevent possible issues later: + Your config is using Exiftool as a filter instead of Exiftool.StripMetadata. This should work for now, but you are advised to change to the new configuration to prevent possible issues later: ``` config :pleroma, Pleroma.Upload, @@ -40,14 +40,14 @@ defmodule Pleroma.Config.DeprecationWarnings do ``` config :pleroma, Pleroma.Upload, - filters: [Pleroma.Upload.Filter.Exiftool.StripLocation] + filters: [Pleroma.Upload.Filter.Exiftool.StripMetadata] ``` """) new_config = filters |> Enum.map(fn - Pleroma.Upload.Filter.Exiftool -> Pleroma.Upload.Filter.Exiftool.StripLocation + Pleroma.Upload.Filter.Exiftool -> Pleroma.Upload.Filter.Exiftool.StripMetadata filter -> filter end) diff --git a/lib/pleroma/upload/filter/exiftool/strip_location.ex b/lib/pleroma/upload/filter/exiftool/strip_metadata.ex similarity index 95% rename from lib/pleroma/upload/filter/exiftool/strip_location.ex rename to lib/pleroma/upload/filter/exiftool/strip_metadata.ex index 9bb39f68c..178b595f3 100644 --- a/lib/pleroma/upload/filter/exiftool/strip_location.ex +++ b/lib/pleroma/upload/filter/exiftool/strip_metadata.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Upload.Filter.Exiftool.StripLocation do +defmodule Pleroma.Upload.Filter.Exiftool.StripMetadata do @moduledoc """ Strips GPS related EXIF tags and overwrites the file in place. Also strips or replaces filesystem metadata e.g., timestamps. diff --git a/priv/repo/migrations/20220220135625_upload_filter_exiftool_to_exiftool_strip_location.exs b/priv/repo/migrations/20220220135625_upload_filter_exiftool_to_exiftool_strip_location.exs index 0878b9699..0d68a0787 100644 --- a/priv/repo/migrations/20220220135625_upload_filter_exiftool_to_exiftool_strip_location.exs +++ b/priv/repo/migrations/20220220135625_upload_filter_exiftool_to_exiftool_strip_location.exs @@ -1,4 +1,4 @@ -defmodule Pleroma.Repo.Migrations.UploadFilterExiftoolToExiftoolStripLocation do +defmodule Pleroma.Repo.Migrations.UploadFilterExiftoolToExiftoolStripMetadata do use Ecto.Migration alias Pleroma.ConfigDB @@ -8,14 +8,14 @@ defmodule Pleroma.Repo.Migrations.UploadFilterExiftoolToExiftoolStripLocation do ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}) |> update_filtername( Pleroma.Upload.Filter.Exiftool, - Pleroma.Upload.Filter.Exiftool.StripLocation + Pleroma.Upload.Filter.Exiftool.StripMetadata ) def down, do: ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}) |> update_filtername( - Pleroma.Upload.Filter.Exiftool.StripLocation, + Pleroma.Upload.Filter.Exiftool.StripMetadata, Pleroma.Upload.Filter.Exiftool ) diff --git a/test/mix/tasks/pleroma/instance_test.exs b/test/mix/tasks/pleroma/instance_test.exs index d650bdf7c..98eac4459 100644 --- a/test/mix/tasks/pleroma/instance_test.exs +++ b/test/mix/tasks/pleroma/instance_test.exs @@ -69,7 +69,7 @@ defmodule Mix.Tasks.Pleroma.InstanceTest do "test/uploads", "--static-dir", "./test/../test/instance/static/", - "--strip-uploads-location", + "--strip-uploads-metadata", "y", "--read-uploads-description", "y", @@ -95,7 +95,7 @@ defmodule Mix.Tasks.Pleroma.InstanceTest do assert generated_config =~ "http: [ip: {127, 0, 0, 1}, port: 4000]" assert generated_config =~ - "filters: [Pleroma.Upload.Filter.Exiftool.StripLocation, Pleroma.Upload.Filter.Exiftool.ReadDescription]" + "filters: [Pleroma.Upload.Filter.Exiftool.StripMetadata, Pleroma.Upload.Filter.Exiftool.ReadDescription]" assert generated_config =~ "base_url: \"https://media.pleroma.social/media\"" assert File.read!(tmp_path() <> "setup.psql") == generated_setup_psql() diff --git a/test/pleroma/config/deprecation_warnings_test.exs b/test/pleroma/config/deprecation_warnings_test.exs index d1d80db8f..fd8a558ee 100644 --- a/test/pleroma/config/deprecation_warnings_test.exs +++ b/test/pleroma/config/deprecation_warnings_test.exs @@ -21,7 +21,7 @@ defmodule Pleroma.Config.DeprecationWarningsTest do assert capture_log(fn -> DeprecationWarnings.check_exiftool_filter() end) =~ """ !!!DEPRECATION WARNING!!! - Your config is using Exiftool as a filter instead of Exiftool.StripLocation. This should work for now, but you are advised to change to the new configuration to prevent possible issues later: + Your config is using Exiftool as a filter instead of Exiftool.StripMetadata. This should work for now, but you are advised to change to the new configuration to prevent possible issues later: ``` config :pleroma, Pleroma.Upload, @@ -33,19 +33,19 @@ defmodule Pleroma.Config.DeprecationWarningsTest do ``` config :pleroma, Pleroma.Upload, - filters: [Pleroma.Upload.Filter.Exiftool.StripLocation] + filters: [Pleroma.Upload.Filter.Exiftool.StripMetadata] ``` """ end - test "changes setting to exiftool strip location" do + test "changes setting to exiftool strip metadata" do clear_config( [Pleroma.Upload, :filters], [Pleroma.Upload.Filter.Exiftool, Pleroma.Upload.Filter.Exiftool.ReadDescription] ) expected_config = [ - Pleroma.Upload.Filter.Exiftool.StripLocation, + Pleroma.Upload.Filter.Exiftool.StripMetadata, Pleroma.Upload.Filter.Exiftool.ReadDescription ] @@ -58,7 +58,7 @@ defmodule Pleroma.Config.DeprecationWarningsTest do clear_config( [Pleroma.Upload, :filters], [ - Pleroma.Upload.Filter.Exiftool.StripLocation, + Pleroma.Upload.Filter.Exiftool.StripMetadata, Pleroma.Upload.Filter.Exiftool.ReadDescription ] ) diff --git a/test/pleroma/upload/filter/exiftool/strip_location_test.exs b/test/pleroma/upload/filter/exiftool/strip_location_test.exs index 1c9667e77..6f8178115 100644 --- a/test/pleroma/upload/filter/exiftool/strip_location_test.exs +++ b/test/pleroma/upload/filter/exiftool/strip_location_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Upload.Filter.Exiftool.StripLocationTest do +defmodule Pleroma.Upload.Filter.Exiftool.StripMetadataTest do use Pleroma.DataCase alias Pleroma.Upload.Filter @@ -21,7 +21,7 @@ defmodule Pleroma.Upload.Filter.Exiftool.StripLocationTest do tempfile: Path.absname("test/fixtures/DSCN0010_tmp.jpg") } - assert Filter.Exiftool.StripLocation.filter(upload) == {:ok, :filtered} + assert Filter.Exiftool.StripMetadata.filter(upload) == {:ok, :filtered} {exif_original, 0} = System.cmd("exiftool", ["test/fixtures/DSCN0010.jpg"]) {exif_filtered, 0} = System.cmd("exiftool", ["test/fixtures/DSCN0010_tmp.jpg"]) @@ -37,6 +37,6 @@ defmodule Pleroma.Upload.Filter.Exiftool.StripLocationTest do content_type: "image/webp" } - assert Filter.Exiftool.StripLocation.filter(upload) == {:ok, :noop} + assert Filter.Exiftool.StripMetadata.filter(upload) == {:ok, :noop} end end