Use the configured http client options for mediaproxy

This commit is contained in:
Mark Felder 2024-05-28 09:38:36 -04:00
parent f8ce639e3f
commit 18835bf701
1 changed files with 4 additions and 2 deletions

View File

@ -25,7 +25,7 @@ def missing_dependencies do
end
def image_resize(url, options) do
with {:ok, env} <- HTTP.get(url, [], pool: :media),
with {:ok, env} <- HTTP.get(url, [], http_client_opts()),
{:ok, resized} <-
Operation.thumbnail_buffer(env.body, options.max_width,
height: options.max_height,
@ -46,7 +46,7 @@ def image_resize(url, options) do
def video_framegrab(url) do
with executable when is_binary(executable) <- System.find_executable("ffmpeg"),
false <- @cachex.exists?(:failed_media_helper_cache, url),
{:ok, env} <- HTTP.get(url, [], pool: :media),
{:ok, env} <- HTTP.get(url, [], http_client_opts()),
{:ok, pid} <- StringIO.open(env.body) do
body_stream = IO.binstream(pid, 1)
@ -84,4 +84,6 @@ def video_framegrab(url) do
{:error, _} = error -> error
end
end
defp http_client_opts, do: Pleroma.Config.get([:media_proxy, :proxy_opts, :http], pool: :media)
end