empty uri

This commit is contained in:
rimu 2024-05-22 06:29:28 +12:00
parent f099380f72
commit b911967168
2 changed files with 29 additions and 23 deletions

View file

@ -94,6 +94,11 @@ def post_request(uri: str, body: dict | None, private_key: str, key_id: str, con
log.activity_json=json.dumps(body)
db.session.add(log)
db.session.commit()
if uri is None or uri == '':
log.result = 'failure'
log.exception_message = 'empty uri'
else:
try:
result = HttpSignature.signed_request(uri, body, private_key, key_id, content_type, method, timeout)
if result.status_code != 200 and result.status_code != 202:

View file

@ -689,6 +689,7 @@ def send_to_remote_instance_task(instance_id: int, community_id: int, payload):
community = Community.query.get(community_id)
if community:
instance = Instance.query.get(instance_id)
if instance.inbox:
if post_request(instance.inbox, payload, community.private_key, community.ap_profile_id + '#main-key'):
instance.last_successful_send = utcnow()
instance.failures = 0