From 602e5a378057f3cd5ca355fd3ed2a17fcc147c72 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sat, 10 Dec 2022 13:24:49 -0700 Subject: Add system actor and shared inbox --- users/models/identity.py | 4 ++++ users/models/system_actor.py | 3 +++ users/views/activitypub.py | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'users') diff --git a/users/models/identity.py b/users/models/identity.py index 21ac0fd..fe85d41 100644 --- a/users/models/identity.py +++ b/users/models/identity.py @@ -296,6 +296,10 @@ class Identity(StatorModel): "mediaType": media_type_from_filename(self.image.name), "url": self.image.url, } + if self.local: + response["endpoints"] = { + "sharedInbox": f"https://{self.domain.uri_domain}/inbox/", + } return response ### ActivityPub (inbound) ### diff --git a/users/models/system_actor.py b/users/models/system_actor.py index c4319b9..fb5a9e1 100644 --- a/users/models/system_actor.py +++ b/users/models/system_actor.py @@ -43,6 +43,9 @@ class SystemActor: "id": self.actor_uri, "type": "Application", "inbox": self.actor_uri + "inbox/", + "endpoints": { + "sharedInbox": f"https://{settings.MAIN_DOMAIN}/inbox/", + }, "preferredUsername": self.username, "url": self.profile_uri, "as:manuallyApprovesFollowers": True, diff --git a/users/views/activitypub.py b/users/views/activitypub.py index 93a6eae..b44edfb 100644 --- a/users/views/activitypub.py +++ b/users/views/activitypub.py @@ -138,7 +138,7 @@ class Inbox(View): AP Inbox endpoint """ - def post(self, request, handle): + def post(self, request, handle=None): # Load the LD document = canonicalise(json.loads(request.body), include_security=True) # Find the Identity by the actor on the incoming item -- cgit v1.2.3