mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-02 16:21:32 -08:00
Make replay_inbox_request() a bit more consistent with shared_inbox()
This commit is contained in:
parent
a6b6b7cc8b
commit
921c2e78b1
1 changed files with 4 additions and 7 deletions
|
@ -513,21 +513,18 @@ def replay_inbox_request(request_json):
|
|||
log_incoming_ap('', APLOG_NOTYPE, APLOG_FAILURE, request_json, 'REPLAY: Missing minimum expected fields in JSON')
|
||||
return
|
||||
|
||||
id = request_json['id']
|
||||
if request_json['type'] == 'Announce' and isinstance(request_json['object'], dict):
|
||||
object = request_json['object']
|
||||
if not 'id' in object or not 'type' in object or not 'actor' in object or not 'object' in object:
|
||||
if object['type'] == 'Page':
|
||||
log_incoming_ap(request_json['id'], APLOG_ANNOUNCE, APLOG_IGNORED, request_json, 'REPLAY: Intended for Mastodon')
|
||||
elif object['type'] == 'Note': # Lemmy has Announced Note out from Mastodon, but will also announce Create/Note
|
||||
if 'type' in object and (object['type'] == 'Page' or object['type'] == 'Note'):
|
||||
log_incoming_ap(request_json['id'], APLOG_ANNOUNCE, APLOG_IGNORED, request_json, 'REPLAY: Intended for Mastodon')
|
||||
else:
|
||||
log_incoming_ap(request_json['id'], APLOG_ANNOUNCE, APLOG_FAILURE, request_json, 'REPLAY: Missing minimum expected fields in JSON Announce object')
|
||||
return
|
||||
|
||||
actor = User.query.filter_by(ap_profile_id=object['actor'].lower()).first()
|
||||
if actor and actor.is_local():
|
||||
log_incoming_ap(object['id'], APLOG_DUPLICATE, APLOG_IGNORED, request_json, 'REPLAY: Activity about local content which is already present')
|
||||
if object['actor'].startswith('https://' + current_app.config['SERVER_NAME']):
|
||||
log_incoming_ap(object['id'], APLOG_DUPLICATE, APLOG_IGNORED, request_json if store_ap_json else None, 'Activity about local content which is already present')
|
||||
return
|
||||
|
||||
# Ignore unutilised PeerTube activity
|
||||
if request_json['actor'].endswith('accounts/peertube'):
|
||||
|
|
Loading…
Add table
Reference in a new issue