mobilizon/lib/service/http/rich_media_preview_client.ex
Thomas Citharel baa11c18b0
feat(http): allow to provide self-signed certificates
Allow for the MOBILIZON_CA_CERT_PATH to be used to provide your own root certificates. The CAStore
and certify certificates stores should be always already be used as fallback instead of the system
store.

Closes 

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2024-02-09 13:51:59 +01:00

22 lines
581 B
Elixir

defmodule Mobilizon.Service.HTTP.RichMediaPreviewClient do
@moduledoc """
Tesla HTTP Basic Client that fetches HTML to extract metadata preview
"""
use Tesla
alias Mobilizon.Config
import Mobilizon.Service.HTTP.Utils, only: [get_tls_config: 0]
@default_opts [
recv_timeout: 20_000
]
adapter(Tesla.Adapter.Hackney, Keyword.merge([ssl_options: get_tls_config()], @default_opts))
plug(Tesla.Middleware.FollowRedirects)
plug(Tesla.Middleware.Timeout, timeout: 10_000)
plug(Tesla.Middleware.Headers, [{"User-Agent", Config.instance_user_agent()}])
end