diff --git a/relay/processors.py b/relay/processors.py index 69f8b59..b7f02c6 100644 --- a/relay/processors.py +++ b/relay/processors.py @@ -47,6 +47,22 @@ async def handle_forward(request, actor, data, software): request.app.cache.objects[data.id] = message.id +async def handle_passthrough(request, actor, data, software): + if data.id in request.app.cache.objects: + logging.verbose(f'already passed {data.id}') + return + + message = data + logging.verbose(f'Pass through post from {actor.id}') + logging.debug(f'>> Relay {data}') + + inboxes = misc.distill_inboxes(actor, data.id) + futures = [misc.request(inbox, data=message) for inbox in inboxes] + + asyncio.ensure_future(asyncio.gather(*futures)) + request.app.cache.objects[data.id] = message.id + + async def handle_follow(request, actor, data, software): if not request.app.database.add_inbox(actor.shared_inbox, data.id): request.app.database.set_followid(actor.id, data.id) @@ -97,7 +113,7 @@ async def handle_undo(request, actor, data, software): processors = { 'Announce': handle_relay, 'Create': handle_relay, - 'Delete': handle_forward, + 'Delete': handle_passthrough, 'Follow': handle_follow, 'Undo': handle_undo, 'Update': handle_forward,