diff --git a/lib/pleroma/application_requirements.ex b/lib/pleroma/application_requirements.ex index 6ef65b263..36e3cb550 100644 --- a/lib/pleroma/application_requirements.ex +++ b/lib/pleroma/application_requirements.ex @@ -162,7 +162,8 @@ defmodule Pleroma.ApplicationRequirements do filter_commands_statuses = [ check_filter(Pleroma.Upload.Filters.Exiftool, "exiftool"), check_filter(Pleroma.Upload.Filters.Mogrify, "mogrify"), - check_filter(Pleroma.Upload.Filters.Mogrifun, "mogrify") + check_filter(Pleroma.Upload.Filters.Mogrifun, "mogrify"), + check_filter(Pleroma.Upload.Filters.HeifToJpeg, "mogrify") ] preview_proxy_commands_status = @@ -213,6 +214,31 @@ defmodule Pleroma.ApplicationRequirements do defp check_repo_pool_size!(result), do: result + defp check_filter(:"Elixir.Pleroma.Upload.Filter.HeifToJpeg" = filter, command_required) do + filters = Config.get([Pleroma.Upload, :filters]) + + if filter in filters && Pleroma.Utils.command_available?(command_required) do + output = + String.to_charlist("#{command_required} --version") + |> :os.cmd() + |> String.Chars.to_string() + |> String.split() + + cond do + "heic" in output -> + true + + true -> + Logger.error( + "#{filter} is specified in the list of Pleroma.Upload filters, but the " <> + "#{command_required} does not support heic files." + ) + + false + end + end + end + defp check_filter(filter, command_required) do filters = Config.get([Pleroma.Upload, :filters])