From 3a0cd6452cc1f0f33b6b68e857b169da17e76ac9 Mon Sep 17 00:00:00 2001 From: jesopo Date: Fri, 2 Aug 2019 17:15:16 +0100 Subject: [PATCH] support pleroma-style outbox `first` --- modules/fediverse.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/fediverse.py b/modules/fediverse.py index 6b659c6c..878a6446 100644 --- a/modules/fediverse.py +++ b/modules/fediverse.py @@ -44,11 +44,17 @@ class Module(ModuleManager.BaseModule): outbox = utils.http.request(outbox_url, headers=ACTIVITY_HEADERS, json=True) + items = None if "first" in outbox.data: - outbox = utils.http.request(outbox.data["first"], - headers=ACTIVITY_HEADERS, json=True) + if type(outbox.data["first"]) == dict: + items = outbox.data["first"]["orderedItems"] + else: + first = utils.http.request(outbox.data["first"], + headers=ACTIVITY_HEADERS, json=True) + items = first.data["orderedItems"] + else: + items = outbox.data["orderedItems"] - items = outbox.data["orderedItems"] if items: first_item = items[0] if first_item["type"] == "Announce":