forked from AkkomaGang/akkoma
Add debugging help.
This commit is contained in:
parent
1b67a59795
commit
312772df7c
2 changed files with 6 additions and 0 deletions
|
@ -140,6 +140,8 @@ def handle_note(entry, doc \\ nil) do
|
||||||
inReplyToHref = string_from_xpath("//thr:in-reply-to[1]/@href", entry)
|
inReplyToHref = string_from_xpath("//thr:in-reply-to[1]/@href", entry)
|
||||||
if inReplyToHref do
|
if inReplyToHref do
|
||||||
fetch_activity_from_html_url(inReplyToHref)
|
fetch_activity_from_html_url(inReplyToHref)
|
||||||
|
else
|
||||||
|
Logger.debug("Couldn't find a href link to #{inReplyTo}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -288,10 +290,13 @@ def get_atom_url(body) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_activity_from_html_url(url) do
|
def fetch_activity_from_html_url(url) do
|
||||||
|
Logger.debug("Trying to fetch #{url}")
|
||||||
with {:ok, %{body: body}} <- @httpoison.get(url, [], follow_redirect: true),
|
with {:ok, %{body: body}} <- @httpoison.get(url, [], follow_redirect: true),
|
||||||
{:ok, atom_url} <- get_atom_url(body),
|
{:ok, atom_url} <- get_atom_url(body),
|
||||||
{:ok, %{status_code: code, body: body}} when code in 200..299 <- @httpoison.get(atom_url, [], follow_redirect: true) do
|
{:ok, %{status_code: code, body: body}} when code in 200..299 <- @httpoison.get(atom_url, [], follow_redirect: true) do
|
||||||
|
Logger.debug("Got #{url}, handling...")
|
||||||
handle_incoming(body)
|
handle_incoming(body)
|
||||||
|
else e -> Logger.debug("Couldn't get #{url}: #{inspect(e)}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -39,6 +39,7 @@ def verify(subscription, getter \\ &@httpoison.get/3) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def publish(topic, user, activity) do
|
def publish(topic, user, activity) do
|
||||||
|
# TODO: Only send to still valid subscriptions.
|
||||||
query = from sub in WebsubServerSubscription,
|
query = from sub in WebsubServerSubscription,
|
||||||
where: sub.topic == ^topic and sub.state == "active"
|
where: sub.topic == ^topic and sub.state == "active"
|
||||||
subscriptions = Repo.all(query)
|
subscriptions = Repo.all(query)
|
||||||
|
|
Loading…
Reference in a new issue