RichMedia.Helpers: fix compile cycle on Application

This commit is contained in:
Alex Gleason 2021-08-08 11:57:40 -05:00
parent bef32d6e02
commit caefb0378a
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -16,7 +16,7 @@ defmodule Pleroma.Web.RichMedia.Helpers do
recv_timeout: 2_000 recv_timeout: 2_000
] ]
@headers [{"user-agent", Pleroma.Application.user_agent() <> "; Bot"}] defp headers, do: [{"user-agent", Pleroma.Application.user_agent() <> "; Bot"}]
@spec validate_page_url(URI.t() | binary()) :: :ok | :error @spec validate_page_url(URI.t() | binary()) :: :ok | :error
defp validate_page_url(page_url) when is_binary(page_url) do defp validate_page_url(page_url) when is_binary(page_url) do
@ -82,11 +82,11 @@ def fetch_data_for_activity(%Activity{data: %{"type" => "Create"}} = activity) d
def fetch_data_for_activity(_), do: %{} def fetch_data_for_activity(_), do: %{}
def oembed_get(url) do def oembed_get(url) do
Pleroma.HTTP.get(url, @headers, @options) Pleroma.HTTP.get(url, headers(), @options)
end end
def rich_media_get(url) do def rich_media_get(url) do
headers = @headers headers = headers()
head_check = head_check =
case Pleroma.HTTP.head(url, headers, @options) do case Pleroma.HTTP.head(url, headers, @options) do