Merge pull request 'Uploads: replace exiftool with the built-in exif_stripper' (#8028) from lambadalambda/pleroma:feature/exif-stripper into develop

Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8028
This commit is contained in:
lain 2026-10-31 07:48:00 +00:00
commit 3e9dc477c9
44 changed files with 518 additions and 381 deletions

View file

@ -0,0 +1,41 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2026 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Repo.Migrations.UploadFilterExiftoolToExif do
use Ecto.Migration
alias Pleroma.ConfigDB
@up %{
Pleroma.Upload.Filter.Exiftool => Pleroma.Upload.Filter.Exif.StripLocation,
Pleroma.Upload.Filter.Exiftool.StripLocation => Pleroma.Upload.Filter.Exif.StripLocation,
Pleroma.Upload.Filter.Exiftool.ReadDescription => Pleroma.Upload.Filter.Exif.ReadDescription
}
@down %{
Pleroma.Upload.Filter.Exif.StripLocation => Pleroma.Upload.Filter.Exiftool.StripLocation,
Pleroma.Upload.Filter.Exif.ReadDescription => Pleroma.Upload.Filter.Exiftool.ReadDescription
}
def up, do: rename_filters(@up)
def down, do: rename_filters(@down)
# Only touch configs that list filters: adding an empty list would hide the
# filters from the config file.
defp rename_filters(renames) do
with %{value: value} <- ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}),
filters when is_list(filters) <- value[:filters],
new_filters when new_filters != filters <-
filters |> Enum.map(&Map.get(renames, &1, &1)) |> Enum.uniq() do
ConfigDB.update_or_create(%{
group: :pleroma,
key: Pleroma.Upload,
value: Keyword.put(value, :filters, new_filters)
})
else
_ -> nil
end
end
end