From 08fe53bdbdbaa9f88c336b3b90fea1d144f91ff4 Mon Sep 17 00:00:00 2001 From: kjwon15 Date: Wed, 8 May 2019 17:27:01 +0900 Subject: [PATCH] Implement handle_delete to forward delete --- relay/actor.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/relay/actor.py b/relay/actor.py index ad09ecb..c6d17df 100644 --- a/relay/actor.py +++ b/relay/actor.py @@ -209,6 +209,22 @@ async def handle_relay(actor, data, request): CACHE[object_id] = activity_id +async def handle_delete(actor, data, request): + object_id = distill_object_id(data) + + logging.debug('>> Relay %r', data) + + inboxes = distill_inboxes(actor, object_id) + + futures = [ + push_message_to_actor( + {'inbox': inbox}, + data, + 'https://{}/actor#main-key'.format(request.host)) + for inbox in inboxes] + asyncio.ensure_future(asyncio.gather(*futures)) + + async def handle_follow(actor, data, request): global DATABASE @@ -265,6 +281,7 @@ async def handle_undo(actor, data, request): processors = { 'Announce': handle_relay, 'Create': handle_relay, + 'Delete': handle_delete, 'Follow': handle_follow, 'Undo': handle_undo }