From f713f543069469d095a645149e1b4540878771ae Mon Sep 17 00:00:00 2001 From: Izalia Mae Date: Sun, 6 Nov 2022 01:11:36 -0500 Subject: [PATCH] announce forwarded messages --- relay/processors.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/relay/processors.py b/relay/processors.py index b53ace6..0ca2358 100644 --- a/relay/processors.py +++ b/relay/processors.py @@ -44,15 +44,26 @@ async def handle_forward(actor, data, request): logging.verbose(f'already forwarded {object_id}') return + activity_id = f"https://{request.host}/activities/{uuid4()}" + + message = { + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Announce", + "to": [f"https://{request.host}/followers"], + "actor": f"https://{request.host}/actor", + "object": data, + "id": activity_id + } + logging.verbose(f'Forwarding post from {actor["id"]}') logging.debug(f'>> Relay {data}') inboxes = misc.distill_inboxes(actor, object_id) - futures = [misc.request(inbox, data=data) for inbox in inboxes] + futures = [misc.request(inbox, data=message) for inbox in inboxes] asyncio.ensure_future(asyncio.gather(*futures)) - cache[object_id] = object_id + cache[object_id] = activity_id async def handle_follow(actor, data, request):