summaryrefslogtreecommitdiffstats
path: root/users/views/activitypub.py
diff options
context:
space:
mode:
authorAndrew Godwin2022-12-16 19:42:48 -0700
committerAndrew Godwin2022-12-16 19:42:48 -0700
commit12567f6891ad591390cbd74c0e7b77a4a024a24e (patch)
tree39a6bab590d3f1bde3802854d4a1175780404276 /users/views/activitypub.py
parentc588567c8698700cd347d9b8f884a7967890aa58 (diff)
downloadtakahe-12567f6891ad591390cbd74c0e7b77a4a024a24e.tar.gz
takahe-12567f6891ad591390cbd74c0e7b77a4a024a24e.tar.bz2
takahe-12567f6891ad591390cbd74c0e7b77a4a024a24e.zip
Identity admin/moderation
Diffstat (limited to 'users/views/activitypub.py')
-rw-r--r--users/views/activitypub.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/users/views/activitypub.py b/users/views/activitypub.py
index b44edfb..d80a1c8 100644
--- a/users/views/activitypub.py
+++ b/users/views/activitypub.py
@@ -165,11 +165,12 @@ class Inbox(View):
f"Inbox error: cannot fetch actor {document['actor']}"
)
return HttpResponseBadRequest("Cannot retrieve actor")
- # See if it's from a blocked domain
- if identity.domain.blocked:
+
+ # See if it's from a blocked user or domain
+ if identity.blocked or identity.domain.blocked:
# I love to lie! Throw it away!
exceptions.capture_message(
- f"Inbox: Discarded message from {identity.domain}"
+ f"Inbox: Discarded message from {identity.actor_uri}"
)
return HttpResponse(status=202)
@@ -185,6 +186,7 @@ class Inbox(View):
except VerificationError:
exceptions.capture_message("Inbox error: Bad LD signature")
return HttpResponseUnauthorized("Bad signature")
+
# Otherwise, verify against the header (assuming it's the same actor)
else:
try:
@@ -200,6 +202,7 @@ class Inbox(View):
except VerificationError:
exceptions.capture_message("Inbox error: Bad HTTP signature")
return HttpResponseUnauthorized("Bad signature")
+
# Hand off the item to be processed by the queue
InboxMessage.objects.create(message=document)
return HttpResponse(status=202)