mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-03 00:31:25 -08:00
empty uri
This commit is contained in:
parent
f099380f72
commit
b911967168
2 changed files with 29 additions and 23 deletions
|
@ -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)
|
log.activity_json=json.dumps(body)
|
||||||
db.session.add(log)
|
db.session.add(log)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
if uri is None or uri == '':
|
||||||
|
log.result = 'failure'
|
||||||
|
log.exception_message = 'empty uri'
|
||||||
|
else:
|
||||||
try:
|
try:
|
||||||
result = HttpSignature.signed_request(uri, body, private_key, key_id, content_type, method, timeout)
|
result = HttpSignature.signed_request(uri, body, private_key, key_id, content_type, method, timeout)
|
||||||
if result.status_code != 200 and result.status_code != 202:
|
if result.status_code != 200 and result.status_code != 202:
|
||||||
|
|
|
@ -689,6 +689,7 @@ def send_to_remote_instance_task(instance_id: int, community_id: int, payload):
|
||||||
community = Community.query.get(community_id)
|
community = Community.query.get(community_id)
|
||||||
if community:
|
if community:
|
||||||
instance = Instance.query.get(instance_id)
|
instance = Instance.query.get(instance_id)
|
||||||
|
if instance.inbox:
|
||||||
if post_request(instance.inbox, payload, community.private_key, community.ap_profile_id + '#main-key'):
|
if post_request(instance.inbox, payload, community.private_key, community.ap_profile_id + '#main-key'):
|
||||||
instance.last_successful_send = utcnow()
|
instance.last_successful_send = utcnow()
|
||||||
instance.failures = 0
|
instance.failures = 0
|
||||||
|
|
Loading…
Add table
Reference in a new issue