Rename the new module

This commit is contained in:
Ilja 2022-02-20 12:59:42 +01:00
parent cd316d7269
commit 551721e41a
9 changed files with 23 additions and 23 deletions

View File

@ -633,9 +633,9 @@ This filter only strips the GPS and location metadata with Exiftool leaving colo
No specific configuration.
#### Pleroma.Upload.Filter.ExiftoolReadData
#### Pleroma.Upload.Filter.Exiftool.ReadDescription
This filter only reads metadata with Exiftool so clients can prefill the media description field.
This filter reads the ImageDescription and iptc:Caption-Abstract fields with Exiftool so clients can prefill the media description field.
No specific configuration.

View File

@ -30,4 +30,4 @@ It is required for the following Pleroma features:
It is required for the following Pleroma features:
* `Pleroma.Upload.Filters.Exiftool` upload filter (related config: `Plaroma.Upload/filters` in `config/config.exs`)
* `Pleroma.Upload.Filters.ExiftoolReadData` 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
listen_ip: :string,
listen_port: :string,
strip_uploads: :string,
read_uploads_data: :string,
read_uploads_description: :string,
anonymize_uploads: :string,
dedupe_uploads: :string
],
@ -179,7 +179,7 @@ defmodule Mix.Tasks.Pleroma.Instance do
strip_uploads_default
) === "y"
{read_uploads_data_message, read_uploads_data_default} =
{read_uploads_description_message, read_uploads_description_default} =
if Pleroma.Utils.command_available?("exiftool") do
{"Do you want to read data from uploaded files so clients can use it to prefill fields like image description? This requires exiftool, it was detected as installed. (y/n)",
"y"}
@ -188,12 +188,12 @@ defmodule Mix.Tasks.Pleroma.Instance do
"n"}
end
read_uploads_data =
read_uploads_description =
get_option(
options,
:read_uploads_data,
read_uploads_data_message,
read_uploads_data_default
:read_uploads_description,
read_uploads_description_message,
read_uploads_description_default
) === "y"
anonymize_uploads =
@ -248,7 +248,7 @@ defmodule Mix.Tasks.Pleroma.Instance do
upload_filters:
upload_filters(%{
strip: strip_uploads,
read_data: read_uploads_data,
read_description: read_uploads_description,
anonymize: anonymize_uploads,
dedupe: dedupe_uploads
})
@ -323,8 +323,8 @@ defmodule Mix.Tasks.Pleroma.Instance do
end
enabled_filters =
if filters.read_data do
enabled_filters ++ [Pleroma.Upload.Filter.ExiftoolReadData]
if filters.read_description do
enabled_filters ++ [Pleroma.Upload.Filter.Exiftool.ReadDescription]
else
enabled_filters
end

View File

@ -165,7 +165,7 @@ defmodule Pleroma.ApplicationRequirements do
defp check_system_commands!(:ok) do
filter_commands_statuses = [
check_filter(Pleroma.Upload.Filter.Exiftool, "exiftool"),
check_filter(Pleroma.Upload.Filter.ExiftoolReadData, "exiftool"),
check_filter(Pleroma.Upload.Filter.Exiftool.ReadDescription, "exiftool"),
check_filter(Pleroma.Upload.Filter.Mogrify, "mogrify"),
check_filter(Pleroma.Upload.Filter.Mogrifun, "mogrify"),
check_filter(Pleroma.Upload.Filter.AnalyzeMetadata, "mogrify"),

View File

@ -2,7 +2,7 @@
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Upload.Filter.ExiftoolReadData do
defmodule Pleroma.Upload.Filter.Exiftool.ReadDescription do
@moduledoc """
Gets the description from the related EXIF tags and provides them in the response if no description is provided yet.
It will first check ImageDescription, when that's too long or empty, it will check iptc:Caption-Abstract.

View File

@ -69,7 +69,7 @@ defmodule Mix.Tasks.Pleroma.InstanceTest do
"./test/../test/instance/static/",
"--strip-uploads",
"y",
"--read-uploads-data",
"--read-uploads-description",
"y",
"--dedupe-uploads",
"n",
@ -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, Pleroma.Upload.Filter.ExiftoolReadData]"
"filters: [Pleroma.Upload.Filter.Exiftool, Pleroma.Upload.Filter.Exiftool.ReadDescription]"
assert File.read!(tmp_path() <> "setup.psql") == generated_setup_psql()
assert File.exists?(Path.expand("./test/instance/static/robots.txt"))

View File

@ -2,7 +2,7 @@
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Upload.Filter.ExiftoolReadDataTest do
defmodule Pleroma.Upload.Filter.Exiftool.ReadDescriptionTest do
use Pleroma.DataCase, async: true
alias Pleroma.Upload.Filter
@ -29,7 +29,7 @@ defmodule Pleroma.Upload.Filter.ExiftoolReadDataTest do
description: "Eight different owls"
}
assert Filter.ExiftoolReadData.filter(uploads) ==
assert Filter.Exiftool.ReadDescription.filter(uploads) ==
{:ok, :noop}
end
@ -46,7 +46,7 @@ defmodule Pleroma.Upload.Filter.ExiftoolReadDataTest do
description: "Pictures of eight different owls"
}
assert Filter.ExiftoolReadData.filter(@uploads) ==
assert Filter.Exiftool.ReadDescription.filter(@uploads) ==
{:ok, :filtered, uploads_after}
end
@ -67,7 +67,7 @@ defmodule Pleroma.Upload.Filter.ExiftoolReadDataTest do
description: "Pictures of eight different owls - iptc"
}
assert Filter.ExiftoolReadData.filter(upload) ==
assert Filter.Exiftool.ReadDescription.filter(upload) ==
{:ok, :filtered, upload_after}
end
@ -80,14 +80,14 @@ defmodule Pleroma.Upload.Filter.ExiftoolReadDataTest do
description: nil
}
assert Filter.ExiftoolReadData.filter(uploads) ==
assert Filter.Exiftool.ReadDescription.filter(uploads) ==
{:ok, :filtered, uploads}
end
test "Return nil when image description from EXIF data exceeds the maximum length" do
clear_config([:instance, :description_limit], 5)
assert Filter.ExiftoolReadData.filter(@uploads) ==
assert Filter.Exiftool.ReadDescription.filter(@uploads) ==
{:ok, :filtered, @uploads}
end
@ -100,7 +100,7 @@ defmodule Pleroma.Upload.Filter.ExiftoolReadDataTest do
description: nil
}
assert Filter.ExiftoolReadData.filter(uploads) ==
assert Filter.Exiftool.ReadDescription.filter(uploads) ==
{:ok, :filtered, uploads}
end
end