mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-10 02:17:59 +00:00
relay: add additional assertion proving that a message is never relayed back to it's origin
This commit is contained in:
parent
c9cd9a8337
commit
e44544d22e
|
@ -161,8 +161,10 @@ def distill_inboxes(actor, object_id):
|
||||||
inbox = get_actor_inbox(actor)
|
inbox = get_actor_inbox(actor)
|
||||||
targets = [target for target in DATABASE.get('relay-list', []) if target != inbox]
|
targets = [target for target in DATABASE.get('relay-list', []) if target != inbox]
|
||||||
targets = [target for target in targets if urlsplit(target).hostname != origin_hostname]
|
targets = [target for target in targets if urlsplit(target).hostname != origin_hostname]
|
||||||
|
hostnames = [urlsplit(target).hostname for target in targets]
|
||||||
|
|
||||||
assert inbox not in targets
|
assert inbox not in targets
|
||||||
|
assert origin_hostname not in hostnames
|
||||||
|
|
||||||
return targets
|
return targets
|
||||||
|
|
||||||
|
@ -186,10 +188,6 @@ async def handle_relay(actor, data, request):
|
||||||
logging.debug('>> already relayed %r as %r', object_id, CACHE[object_id])
|
logging.debug('>> already relayed %r as %r', object_id, CACHE[object_id])
|
||||||
return
|
return
|
||||||
|
|
||||||
# don't relay mastodon announces -- causes LRP fake direction issues
|
|
||||||
if data['type'] == 'Announce' and len(data.get('cc', [])) > 0:
|
|
||||||
return
|
|
||||||
|
|
||||||
activity_id = "https://{}/activities/{}".format(request.host, uuid.uuid4())
|
activity_id = "https://{}/activities/{}".format(request.host, uuid.uuid4())
|
||||||
|
|
||||||
message = {
|
message = {
|
||||||
|
|
Loading…
Reference in a new issue