parent
004a4007a2
commit
0c19934bbe
|
@ -45,6 +45,7 @@ defmodule Mobilizon.Federation.ActivityPub do
|
||||||
alias Mobilizon.Federation.HTTPSignatures.Signature
|
alias Mobilizon.Federation.HTTPSignatures.Signature
|
||||||
alias Mobilizon.Federation.WebFinger
|
alias Mobilizon.Federation.WebFinger
|
||||||
|
|
||||||
|
alias Mobilizon.Service.HTTP.ActivityPub, as: APClient
|
||||||
alias Mobilizon.Service.Notifications.Scheduler
|
alias Mobilizon.Service.Notifications.Scheduler
|
||||||
alias Mobilizon.Storage.Page
|
alias Mobilizon.Storage.Page
|
||||||
|
|
||||||
|
@ -771,16 +772,17 @@ defmodule Mobilizon.Federation.ActivityPub do
|
||||||
date: date
|
date: date
|
||||||
})
|
})
|
||||||
|
|
||||||
Tesla.post(
|
client =
|
||||||
inbox,
|
APClient.client(
|
||||||
json,
|
headers: [
|
||||||
headers: [
|
{"Content-Type", "application/activity+json"},
|
||||||
{"Content-Type", "application/activity+json"},
|
{"signature", signature},
|
||||||
{"signature", signature},
|
{"digest", digest},
|
||||||
{"digest", digest},
|
{"date", date}
|
||||||
{"date", date}
|
]
|
||||||
]
|
)
|
||||||
)
|
|
||||||
|
APClient.post(client, inbox, json)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Fetching a remote actor's information through its AP ID
|
# Fetching a remote actor's information through its AP ID
|
||||||
|
@ -790,13 +792,7 @@ defmodule Mobilizon.Federation.ActivityPub do
|
||||||
Logger.debug(inspect(url))
|
Logger.debug(inspect(url))
|
||||||
|
|
||||||
res =
|
res =
|
||||||
with {:ok, %{status: 200, body: body}} <-
|
with {:ok, %{status: 200, body: data}} <- Fetcher.fetch(url) do
|
||||||
Tesla.get(url,
|
|
||||||
headers: [{"Accept", "application/activity+json"}],
|
|
||||||
follow_redirect: true
|
|
||||||
),
|
|
||||||
:ok <- Logger.debug("response okay, now decoding json"),
|
|
||||||
{:ok, data} <- Jason.decode(body) do
|
|
||||||
Logger.debug("Got activity+json response at actor's endpoint, now converting data")
|
Logger.debug("Got activity+json response at actor's endpoint, now converting data")
|
||||||
{:ok, Converter.Actor.as_to_model_data(data)}
|
{:ok, Converter.Actor.as_to_model_data(data)}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue