mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 03:04:28 +00:00
Fix fetch_iri
This commit is contained in:
parent
781ed8efe2
commit
986edbd35e
3 changed files with 10 additions and 2 deletions
|
@ -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
|
||||
|
|
1
app.py
1
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
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue