Adjusted MediaProxyControllerTest to gracefully fail on missing dependencies. Installation docs update.
Added ffmpeg/imagemagick checks to launch checks (if media preview proxy is enabled). Added documentation on installing optional media / graphics packages (imagemagick, ffmpeg, exiftool).
This commit is contained in:
parent
7cd662f18c
commit
4e4f771082
14 changed files with 180 additions and 27 deletions
|
|
@ -268,7 +268,8 @@ defmodule Pleroma.Application do
|
|||
with true <- filter in filters,
|
||||
false <- Pleroma.Utils.command_available?(command_required) do
|
||||
Logger.error(
|
||||
"#{filter} is specified in list of Pleroma.Upload filters, but the #{command_required} command is not found"
|
||||
"#{filter} is specified in list of Pleroma.Upload filters, but the " <>
|
||||
"#{command_required} command is not found"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
@ -276,5 +277,20 @@ defmodule Pleroma.Application do
|
|||
check_filter.(Pleroma.Upload.Filters.Exiftool, "exiftool")
|
||||
check_filter.(Pleroma.Upload.Filters.Mogrify, "mogrify")
|
||||
check_filter.(Pleroma.Upload.Filters.Mogrifun, "mogrify")
|
||||
|
||||
with true <- Config.get([:media_preview_proxy, :enabled]),
|
||||
missing_graphics_tools = Pleroma.Helpers.MediaHelper.missing_dependencies(),
|
||||
[] <- missing_graphics_tools do
|
||||
:noop
|
||||
else
|
||||
false ->
|
||||
:noop
|
||||
|
||||
missing_graphics_tools ->
|
||||
Logger.error(
|
||||
"The following dependencies required by Media preview proxy " <>
|
||||
"(which is currently enabled) are not installed: #{inspect(missing_graphics_tools)}"
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,6 +9,18 @@ defmodule Pleroma.Helpers.MediaHelper do
|
|||
|
||||
alias Pleroma.HTTP
|
||||
|
||||
require Logger
|
||||
|
||||
def missing_dependencies do
|
||||
Enum.reduce([imagemagick: "convert", ffmpeg: "ffmpeg"], [], fn {sym, executable}, acc ->
|
||||
if Pleroma.Utils.command_available?(executable) do
|
||||
acc
|
||||
else
|
||||
[sym | acc]
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
def image_resize(url, options) do
|
||||
with executable when is_binary(executable) <- System.find_executable("convert"),
|
||||
{:ok, args} <- prepare_image_resize_args(options),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue