projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ignore duplicate create activities.
[akkoma]
/
lib
/
pleroma
/
web
/
activity_pub
/
activity_pub_controller.ex
diff --git
a/lib/pleroma/web/activity_pub/activity_pub_controller.ex
b/lib/pleroma/web/activity_pub/activity_pub_controller.ex
index 8080a2b1e5afcd8f5e566ca0345c650a4e378f4c..835e8bd9de586cb206a115a9cdc9751d48d99c69 100644
(file)
--- a/
lib/pleroma/web/activity_pub/activity_pub_controller.ex
+++ b/
lib/pleroma/web/activity_pub/activity_pub_controller.ex
@@
-1,9
+1,11
@@
defmodule Pleroma.Web.ActivityPub.ActivityPubController do
use Pleroma.Web, :controller
defmodule Pleroma.Web.ActivityPub.ActivityPubController do
use Pleroma.Web, :controller
- alias Pleroma.{User, Repo, Object}
+ alias Pleroma.{User, Repo, Object
, Activity
}
alias Pleroma.Web.ActivityPub.{ObjectView, UserView, Transmogrifier}
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.{ObjectView, UserView, Transmogrifier}
alias Pleroma.Web.ActivityPub.ActivityPub
+ require Logger
+
action_fallback :errors
def user(conn, %{"nickname" => nickname}) do
action_fallback :errors
def user(conn, %{"nickname" => nickname}) do
@@
-23,14
+25,29
@@
defmodule Pleroma.Web.ActivityPub.ActivityPubController do
# TODO: Ensure that this inbox is a recipient of the message
def inbox(%{assigns: %{valid_signature: true}} = conn, params) do
# File.write("/tmp/incoming.json", Poison.encode!(params))
# TODO: Ensure that this inbox is a recipient of the message
def inbox(%{assigns: %{valid_signature: true}} = conn, params) do
# File.write("/tmp/incoming.json", Poison.encode!(params))
+ # Logger.info(Poison.encode!(params, [pretty: 2]))
with {:ok, _user} <- ap_enabled_actor(params["actor"]),
with {:ok, _user} <- ap_enabled_actor(params["actor"]),
+ nil <- Activity.get_by_ap_id(params["id"]),
{:ok, activity} <- Transmogrifier.handle_incoming(params) do
json(conn, "ok")
else
{:ok, activity} <- Transmogrifier.handle_incoming(params) do
json(conn, "ok")
else
- e -> IO.inspect(e)
+ %Activity{} ->
+ Logger.info("Already had #{params["id"]}")
+ json(conn, "ok")
+ e ->
+ # Just drop those for now
+ Logger.info("Unhandled activity")
+ Logger.info(Poison.encode!(params, [pretty: 2]))
+ json(conn, "ok")
end
end
end
end
+ def inbox(conn, params) do
+ Logger.info("Signature error.")
+ Logger.info(inspect(conn.req_headers))
+ json(conn, "ok")
+ end
+
def ap_enabled_actor(id) do
user = User.get_by_ap_id(id)
if User.ap_enabled?(user) do
def ap_enabled_actor(id) do
user = User.get_by_ap_id(id)
if User.ap_enabled?(user) do