Merge branch '1503-use-global-ssl-options-for-fetching-remote-media' into 'main'
Use RemoteMediaDownloaderClient, not Tesla directly to use global ssl options See merge request framasoft/mobilizon!1570
This commit is contained in:
commit
87dd2c09cd
|
@ -9,13 +9,9 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Media do
|
||||||
alias Mobilizon.Federation.ActivityStream
|
alias Mobilizon.Federation.ActivityStream
|
||||||
alias Mobilizon.Medias
|
alias Mobilizon.Medias
|
||||||
alias Mobilizon.Medias.Media, as: MediaModel
|
alias Mobilizon.Medias.Media, as: MediaModel
|
||||||
|
alias Mobilizon.Service.HTTP.RemoteMediaDownloaderClient
|
||||||
alias Mobilizon.Web.Upload
|
alias Mobilizon.Web.Upload
|
||||||
|
|
||||||
@http_options [
|
|
||||||
ssl: [{:versions, [:"tlsv1.2"]}]
|
|
||||||
]
|
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Convert a media struct to an ActivityStream representation.
|
Convert a media struct to an ActivityStream representation.
|
||||||
"""
|
"""
|
||||||
|
@ -65,7 +61,7 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Media do
|
||||||
defp upload_media(media_url, ""), do: upload_media(media_url, "unknown")
|
defp upload_media(media_url, ""), do: upload_media(media_url, "unknown")
|
||||||
|
|
||||||
defp upload_media(media_url, name) do
|
defp upload_media(media_url, name) do
|
||||||
case Tesla.get(media_url, opts: @http_options) do
|
case RemoteMediaDownloaderClient.get(media_url) do
|
||||||
{:ok, %{body: body}} ->
|
{:ok, %{body: body}} ->
|
||||||
case Upload.store(%{body: body, name: name}) do
|
case Upload.store(%{body: body, name: name}) do
|
||||||
{:ok, %{url: _url} = uploaded} ->
|
{:ok, %{url: _url} = uploaded} ->
|
||||||
|
|
Loading…
Reference in New Issue