alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.{WebFinger, Websub}
alias Pleroma.Web.OStatus.{FollowHandler, NoteHandler, DeleteHandler}
+ alias Pleroma.Web.ActivityPub.Transmogrifier
def feed_path(user) do
"#{user.ap_id}/feed.atom"
[[_, match]] = Regex.scan(@gs_classic_regex, body)
{:ok, match}
true ->
- Logger.debug(fn -> "Couldn't find atom link in #{inspect(body)}" end)
- {:error, "Couldn't find the atom link"}
+ Logger.debug(fn -> "Couldn't find Atom link in #{inspect(body)}" end)
+ {:error, "Couldn't find the Atom link"}
end
end
def fetch_activity_from_atom_url(url) do
- with {:ok, %{body: body, status_code: code}} when code in 200..299 <- @httpoison.get(url, [Accept: "application/atom+xml"], follow_redirect: true, timeout: 10000, recv_timeout: 20000) do
+ with true <- String.starts_with?(url, "http"),
+ {:ok, %{body: body, status_code: code}} when code in 200..299 <- @httpoison.get(url, [Accept: "application/atom+xml"], follow_redirect: true, timeout: 10000, recv_timeout: 20000) do
Logger.debug("Got document from #{url}, handling...")
handle_incoming(body)
else
def fetch_activity_from_html_url(url) do
Logger.debug("Trying to fetch #{url}")
- with {:ok, %{body: body}} <- @httpoison.get(url, [], follow_redirect: true, timeout: 10000, recv_timeout: 20000),
+ with true <- String.starts_with?(url, "http"),
+ {:ok, %{body: body}} <- @httpoison.get(url, [], follow_redirect: true, timeout: 10000, recv_timeout: 20000),
{:ok, atom_url} <- get_atom_url(body) do
fetch_activity_from_atom_url(atom_url)
else