From 986edbd35e8491124e19614d4329f68e11bbddc8 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sun, 17 Jun 2018 22:05:38 +0200 Subject: [PATCH] Fix fetch_iri --- activitypub.py | 7 ++++++- app.py | 1 + config.py | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/activitypub.py b/activitypub.py index d7e55a1..bf09f64 100644 --- a/activitypub.py +++ b/activitypub.py @@ -21,7 +21,6 @@ from little_boxes import activitypub as ap from little_boxes.backend import Backend from little_boxes.collection import parse_collection as ap_parse_collection from little_boxes.errors import Error -from little_boxes.errors import ActivityNotFoundError logger = logging.getLogger(__name__) @@ -91,8 +90,14 @@ class MicroblogPubBackend(Backend): # Check if the activity is owned by this server if iri.startswith(BASE_URL): + is_a_note = False + if iri.endswith('/activity'): + iri = iri.replace('/activity', '') + is_a_note = True data = DB.outbox.find_one({"remote_id": iri}) if data: + if is_a_note: + return data['activity']['object'] return data["activity"] else: # Check if the activity is stored in the inbox diff --git a/app.py b/app.py index 0e3461d..1f7f0af 100644 --- a/app.py +++ b/app.py @@ -60,6 +60,7 @@ from little_boxes.errors import ActivityNotFoundError from little_boxes.errors import Error from little_boxes.errors import NotFromOutboxError from little_boxes.httpsig import HTTPSigAuth + # from little_boxes.httpsig import verify_request from little_boxes.webfinger import get_actor_url from little_boxes.webfinger import get_remote_follow_template diff --git a/config.py b/config.py index 44bca9c..f552f63 100644 --- a/config.py +++ b/config.py @@ -84,7 +84,9 @@ JWT = JSONWebSignatureSerializer(JWT_SECRET) def _admin_jwt_token() -> str: - return JWT.dumps({"me": "ADMIN", "ts": datetime.now().timestamp()}).decode( # type: ignore + return JWT.dumps( + {"me": "ADMIN", "ts": datetime.now().timestamp()} + ).decode( # type: ignore "utf-8" )