Rename StripLocation to StripMetadata for temporal-proofing reasons

This commit is contained in:
timorl 2024-04-16 20:37:00 +02:00
parent 59d32c10d9
commit cd7af81896
No known key found for this signature in database
GPG key ID: 8E97CB9C0E7F3285
12 changed files with 31 additions and 31 deletions

View file

@ -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 - Uploadfilter `Pleroma.Upload.Filter.Exiftool.ReadDescription` returns description values to the FE so they can pre fill the image description field
## Changed ## 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 ## Fixed
- Issue preventing fetching anything from IPv6-only instances - Issue preventing fetching anything from IPv6-only instances

View file

@ -37,7 +37,7 @@ If any of the options are left unspecified, you will be prompted interactively.
- `--static-dir <path>` - the directory custom public files should be read from (custom emojis, frontend bundle overrides, robots.txt, etc.) - `--static-dir <path>` - the directory custom public files should be read from (custom emojis, frontend bundle overrides, robots.txt, etc.)
- `--listen-ip <ip>` - the ip the app should listen to, defaults to 127.0.0.1 - `--listen-ip <ip>` - the ip the app should listen to, defaults to 127.0.0.1
- `--listen-port <port>` - the port the app should listen to, defaults to 4000 - `--listen-port <port>` - the port the app should listen to, defaults to 4000
- `--strip-uploads-location <Y|N>` - use ExifTool to strip uploads of sensitive location data - `--strip-uploads-metadata <Y|N>` - use ExifTool to strip uploads of sensitive metadata
- `--read-uploads-description <Y|N>` - use ExifTool to read image descriptions from uploads - `--read-uploads-description <Y|N>` - use ExifTool to read image descriptions from uploads
- `--anonymize-uploads <Y|N>` - randomize uploaded filenames - `--anonymize-uploads <Y|N>` - randomize uploaded filenames
- `--dedupe-uploads <Y|N>` - store files based on their hash to reduce data storage requirements if duplicates are uploaded with different filenames - `--dedupe-uploads <Y|N>` - store files based on their hash to reduce data storage requirements if duplicates are uploaded with different filenames

View file

@ -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}`. * `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. This filter only strips the GPS and location metadata with Exiftool leaving color profiles and attributes intact.

View file

@ -29,5 +29,5 @@ It is required for the following Akkoma features:
`exiftool` is media files metadata reader/writer. `exiftool` is media files metadata reader/writer.
It is required for the following Akkoma features: 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`) * `Pleroma.Upload.Filters.Exiftool.ReadDescription` upload filter (related config: `Plaroma.Upload/filters` in `config/config.exs`)

View file

@ -35,7 +35,7 @@ defmodule Mix.Tasks.Pleroma.Instance do
static_dir: :string, static_dir: :string,
listen_ip: :string, listen_ip: :string,
listen_port: :string, listen_port: :string,
strip_uploads_location: :string, strip_uploads_metadata: :string,
read_uploads_description: :string, read_uploads_description: :string,
anonymize_uploads: :string anonymize_uploads: :string
], ],
@ -170,7 +170,7 @@ defmodule Mix.Tasks.Pleroma.Instance do
) )
|> Path.expand() |> 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 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)", {"Do you want to strip location (GPS) data from uploaded images? This requires exiftool, it was detected as installed. (y/n)",
"y"} "y"}
@ -179,12 +179,12 @@ defmodule Mix.Tasks.Pleroma.Instance do
"n"} "n"}
end end
strip_uploads_location = strip_uploads_metadata =
get_option( get_option(
options, options,
:strip_uploads_location, :strip_uploads_metadata,
strip_uploads_location_message, strip_uploads_metadata_message,
strip_uploads_location_default strip_uploads_metadata_default
) === "y" ) === "y"
{read_uploads_description_message, read_uploads_description_default} = {read_uploads_description_message, read_uploads_description_default} =
@ -248,7 +248,7 @@ defmodule Mix.Tasks.Pleroma.Instance do
listen_port: listen_port, listen_port: listen_port,
upload_filters: upload_filters:
upload_filters(%{ upload_filters(%{
strip_location: strip_uploads_location, strip_metadata: strip_uploads_metadata,
read_description: read_uploads_description, read_description: read_uploads_description,
anonymize: anonymize_uploads anonymize: anonymize_uploads
}) })
@ -325,8 +325,8 @@ defmodule Mix.Tasks.Pleroma.Instance do
defp upload_filters(filters) when is_map(filters) do defp upload_filters(filters) when is_map(filters) do
enabled_filters = enabled_filters =
if filters.strip_location do if filters.strip_metadata do
[Pleroma.Upload.Filter.Exiftool.StripLocation] [Pleroma.Upload.Filter.Exiftool.StripMetadata]
else else
[] []
end end

View file

@ -164,7 +164,7 @@ defmodule Pleroma.ApplicationRequirements do
defp check_system_commands!(:ok) do defp check_system_commands!(:ok) do
filter_commands_statuses = [ 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.Exiftool.ReadDescription, "exiftool"),
check_filter(Pleroma.Upload.Filter.Mogrify, "mogrify"), check_filter(Pleroma.Upload.Filter.Mogrify, "mogrify"),
check_filter(Pleroma.Upload.Filter.Mogrifun, "mogrify"), check_filter(Pleroma.Upload.Filter.Mogrifun, "mogrify"),

View file

@ -28,7 +28,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
if Pleroma.Upload.Filter.Exiftool in filters do if Pleroma.Upload.Filter.Exiftool in filters do
Logger.warning(""" Logger.warning("""
!!!DEPRECATION 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, config :pleroma, Pleroma.Upload,
@ -40,14 +40,14 @@ defmodule Pleroma.Config.DeprecationWarnings do
``` ```
config :pleroma, Pleroma.Upload, config :pleroma, Pleroma.Upload,
filters: [Pleroma.Upload.Filter.Exiftool.StripLocation] filters: [Pleroma.Upload.Filter.Exiftool.StripMetadata]
``` ```
""") """)
new_config = new_config =
filters filters
|> Enum.map(fn |> Enum.map(fn
Pleroma.Upload.Filter.Exiftool -> Pleroma.Upload.Filter.Exiftool.StripLocation Pleroma.Upload.Filter.Exiftool -> Pleroma.Upload.Filter.Exiftool.StripMetadata
filter -> filter filter -> filter
end) end)

View file

@ -2,7 +2,7 @@
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/> # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Upload.Filter.Exiftool.StripLocation do defmodule Pleroma.Upload.Filter.Exiftool.StripMetadata do
@moduledoc """ @moduledoc """
Strips GPS related EXIF tags and overwrites the file in place. Strips GPS related EXIF tags and overwrites the file in place.
Also strips or replaces filesystem metadata e.g., timestamps. Also strips or replaces filesystem metadata e.g., timestamps.

View file

@ -1,4 +1,4 @@
defmodule Pleroma.Repo.Migrations.UploadFilterExiftoolToExiftoolStripLocation do defmodule Pleroma.Repo.Migrations.UploadFilterExiftoolToExiftoolStripMetadata do
use Ecto.Migration use Ecto.Migration
alias Pleroma.ConfigDB alias Pleroma.ConfigDB
@ -8,14 +8,14 @@ defmodule Pleroma.Repo.Migrations.UploadFilterExiftoolToExiftoolStripLocation do
ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}) ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload})
|> update_filtername( |> update_filtername(
Pleroma.Upload.Filter.Exiftool, Pleroma.Upload.Filter.Exiftool,
Pleroma.Upload.Filter.Exiftool.StripLocation Pleroma.Upload.Filter.Exiftool.StripMetadata
) )
def down, def down,
do: do:
ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}) ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload})
|> update_filtername( |> update_filtername(
Pleroma.Upload.Filter.Exiftool.StripLocation, Pleroma.Upload.Filter.Exiftool.StripMetadata,
Pleroma.Upload.Filter.Exiftool Pleroma.Upload.Filter.Exiftool
) )

View file

@ -69,7 +69,7 @@ defmodule Mix.Tasks.Pleroma.InstanceTest do
"test/uploads", "test/uploads",
"--static-dir", "--static-dir",
"./test/../test/instance/static/", "./test/../test/instance/static/",
"--strip-uploads-location", "--strip-uploads-metadata",
"y", "y",
"--read-uploads-description", "--read-uploads-description",
"y", "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 =~ "http: [ip: {127, 0, 0, 1}, port: 4000]"
assert generated_config =~ 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 generated_config =~ "base_url: \"https://media.pleroma.social/media\""
assert File.read!(tmp_path() <> "setup.psql") == generated_setup_psql() assert File.read!(tmp_path() <> "setup.psql") == generated_setup_psql()

View file

@ -21,7 +21,7 @@ defmodule Pleroma.Config.DeprecationWarningsTest do
assert capture_log(fn -> DeprecationWarnings.check_exiftool_filter() end) =~ assert capture_log(fn -> DeprecationWarnings.check_exiftool_filter() end) =~
""" """
!!!DEPRECATION 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, config :pleroma, Pleroma.Upload,
@ -33,19 +33,19 @@ defmodule Pleroma.Config.DeprecationWarningsTest do
``` ```
config :pleroma, Pleroma.Upload, config :pleroma, Pleroma.Upload,
filters: [Pleroma.Upload.Filter.Exiftool.StripLocation] filters: [Pleroma.Upload.Filter.Exiftool.StripMetadata]
``` ```
""" """
end end
test "changes setting to exiftool strip location" do test "changes setting to exiftool strip metadata" do
clear_config( clear_config(
[Pleroma.Upload, :filters], [Pleroma.Upload, :filters],
[Pleroma.Upload.Filter.Exiftool, Pleroma.Upload.Filter.Exiftool.ReadDescription] [Pleroma.Upload.Filter.Exiftool, Pleroma.Upload.Filter.Exiftool.ReadDescription]
) )
expected_config = [ expected_config = [
Pleroma.Upload.Filter.Exiftool.StripLocation, Pleroma.Upload.Filter.Exiftool.StripMetadata,
Pleroma.Upload.Filter.Exiftool.ReadDescription Pleroma.Upload.Filter.Exiftool.ReadDescription
] ]
@ -58,7 +58,7 @@ defmodule Pleroma.Config.DeprecationWarningsTest do
clear_config( clear_config(
[Pleroma.Upload, :filters], [Pleroma.Upload, :filters],
[ [
Pleroma.Upload.Filter.Exiftool.StripLocation, Pleroma.Upload.Filter.Exiftool.StripMetadata,
Pleroma.Upload.Filter.Exiftool.ReadDescription Pleroma.Upload.Filter.Exiftool.ReadDescription
] ]
) )

View file

@ -2,7 +2,7 @@
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/> # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Upload.Filter.Exiftool.StripLocationTest do defmodule Pleroma.Upload.Filter.Exiftool.StripMetadataTest do
use Pleroma.DataCase use Pleroma.DataCase
alias Pleroma.Upload.Filter alias Pleroma.Upload.Filter
@ -21,7 +21,7 @@ defmodule Pleroma.Upload.Filter.Exiftool.StripLocationTest do
tempfile: Path.absname("test/fixtures/DSCN0010_tmp.jpg") 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_original, 0} = System.cmd("exiftool", ["test/fixtures/DSCN0010.jpg"])
{exif_filtered, 0} = System.cmd("exiftool", ["test/fixtures/DSCN0010_tmp.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" content_type: "image/webp"
} }
assert Filter.Exiftool.StripLocation.filter(upload) == {:ok, :noop} assert Filter.Exiftool.StripMetadata.filter(upload) == {:ok, :noop}
end end
end end