main
Bob Mottram 2024-08-05 10:34:41 +01:00
parent b2201d33f1
commit 09c2df6be1
1 changed files with 31 additions and 30 deletions

View File

@ -5398,10 +5398,8 @@ def is_valid_date(date_str: str) -> bool:
def resembles_url(text: str) -> bool:
"""Does the given text look like a url?
"""
if '://' in text and \
'.' in text and \
' ' not in text and \
'<' not in text:
if '://' in text and '.' in text and \
' ' not in text and '<' not in text:
return True
return False
@ -5409,7 +5407,9 @@ def resembles_url(text: str) -> bool:
def local_only_is_local(message_json: {}, domain_full: str) -> bool:
"""Returns True if the given json post is verified as local only
"""
if message_json['object']['localOnly'] is True:
if message_json['object']['localOnly'] is not True:
return True
# check that the to addresses are local
if isinstance(message_json['object']['to'], list):
for to_actor in message_json['object']['to']:
@ -5424,6 +5424,7 @@ def local_only_is_local(message_json: {}, domain_full: str) -> bool:
"local only post isn't local " +
str(message_json))
return False
# check that the sender is local
attrib_field = message_json['object']['attributedTo']
local_actor = get_attributed_to(attrib_field)