mirror of https://gitlab.com/bashrc2/epicyon
Three representations of public post
parent
dae314b806
commit
d863eb25e4
4
inbox.py
4
inbox.py
|
@ -822,7 +822,9 @@ def _inbox_post_recipients_add(base_dir: str, http_prefix: str, to_list: [],
|
||||||
handle + ' does not exist')
|
handle + ' does not exist')
|
||||||
else:
|
else:
|
||||||
if debug:
|
if debug:
|
||||||
if recipient.endswith('#Public'):
|
if recipient.endswith('#Public') or \
|
||||||
|
recipient == 'as:Public' or \
|
||||||
|
recipient == 'Public':
|
||||||
print('DEBUG: #Public recipient is too non-specific. ' +
|
print('DEBUG: #Public recipient is too non-specific. ' +
|
||||||
recipient + ' ' + domain_match)
|
recipient + ' ' + domain_match)
|
||||||
else:
|
else:
|
||||||
|
|
38
posts.py
38
posts.py
|
@ -456,7 +456,9 @@ def _is_public_feed_post(item: {}, person_posts: {}, debug: bool) -> bool:
|
||||||
if this_item.get('to'):
|
if this_item.get('to'):
|
||||||
is_public = False
|
is_public = False
|
||||||
for recipient in this_item['to']:
|
for recipient in this_item['to']:
|
||||||
if recipient.endswith('#Public'):
|
if recipient.endswith('#Public') or \
|
||||||
|
recipient == 'as:Public' or \
|
||||||
|
recipient == 'Public':
|
||||||
is_public = True
|
is_public = True
|
||||||
break
|
break
|
||||||
if not is_public:
|
if not is_public:
|
||||||
|
@ -465,7 +467,9 @@ def _is_public_feed_post(item: {}, person_posts: {}, debug: bool) -> bool:
|
||||||
if item.get('to'):
|
if item.get('to'):
|
||||||
is_public = False
|
is_public = False
|
||||||
for recipient in item['to']:
|
for recipient in item['to']:
|
||||||
if recipient.endswith('#Public'):
|
if recipient.endswith('#Public') or \
|
||||||
|
recipient == 'as:Public' or \
|
||||||
|
recipient == 'Public':
|
||||||
is_public = True
|
is_public = True
|
||||||
break
|
break
|
||||||
if not is_public:
|
if not is_public:
|
||||||
|
@ -1402,7 +1406,12 @@ def _create_post_mentions(cc_url: str, new_post: {},
|
||||||
to_cc = new_post['object']['cc']
|
to_cc = new_post['object']['cc']
|
||||||
if len(to_recipients) != 1:
|
if len(to_recipients) != 1:
|
||||||
return
|
return
|
||||||
if to_recipients[0].endswith('#Public') and \
|
to_public_recipient = False
|
||||||
|
if to_recipients[0].endswith('#Public') or \
|
||||||
|
to_recipients[0] == 'as:Public' or \
|
||||||
|
to_recipients[0] == 'Public':
|
||||||
|
to_public_recipient = True
|
||||||
|
if to_public_recipient and \
|
||||||
cc_url.endswith('/followers'):
|
cc_url.endswith('/followers'):
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
if tag['type'] != 'Mention':
|
if tag['type'] != 'Mention':
|
||||||
|
@ -1582,7 +1591,9 @@ def _create_post_base(base_dir: str,
|
||||||
|
|
||||||
is_public = False
|
is_public = False
|
||||||
for recipient in to_recipients:
|
for recipient in to_recipients:
|
||||||
if recipient.endswith('#Public'):
|
if recipient.endswith('#Public') or \
|
||||||
|
recipient == 'as:Public' or \
|
||||||
|
recipient == 'Public':
|
||||||
is_public = True
|
is_public = True
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -2834,7 +2845,9 @@ def _add_followers_to_public_post(post_json_object: {}) -> None:
|
||||||
if len(post_json_object['to']) == 0:
|
if len(post_json_object['to']) == 0:
|
||||||
return
|
return
|
||||||
if not post_json_object['to'][0].endswith('#Public'):
|
if not post_json_object['to'][0].endswith('#Public'):
|
||||||
return
|
if not post_json_object['to'][0] == 'as:Public':
|
||||||
|
if not post_json_object['to'][0] == 'Public':
|
||||||
|
return
|
||||||
if post_json_object.get('cc'):
|
if post_json_object.get('cc'):
|
||||||
return
|
return
|
||||||
post_json_object['cc'] = post_json_object['actor'] + '/followers'
|
post_json_object['cc'] = post_json_object['actor'] + '/followers'
|
||||||
|
@ -2846,7 +2859,9 @@ def _add_followers_to_public_post(post_json_object: {}) -> None:
|
||||||
if len(post_json_object['object']['to']) == 0:
|
if len(post_json_object['object']['to']) == 0:
|
||||||
return
|
return
|
||||||
if not post_json_object['object']['to'][0].endswith('#Public'):
|
if not post_json_object['object']['to'][0].endswith('#Public'):
|
||||||
return
|
if not post_json_object['object']['to'][0] == 'as:Public':
|
||||||
|
if not post_json_object['object']['to'][0] == 'Public':
|
||||||
|
return
|
||||||
if post_json_object['object'].get('cc'):
|
if post_json_object['object'].get('cc'):
|
||||||
return
|
return
|
||||||
post_json_object['object']['cc'] = \
|
post_json_object['object']['cc'] = \
|
||||||
|
@ -3222,7 +3237,9 @@ def _send_to_named_addresses(server, session, session_onion, session_i2p,
|
||||||
continue
|
continue
|
||||||
if '/' not in address:
|
if '/' not in address:
|
||||||
continue
|
continue
|
||||||
if address.endswith('#Public'):
|
if address.endswith('#Public') or \
|
||||||
|
address == 'as:Public' or \
|
||||||
|
address == 'Public':
|
||||||
continue
|
continue
|
||||||
if address.endswith('/followers'):
|
if address.endswith('/followers'):
|
||||||
continue
|
continue
|
||||||
|
@ -3231,7 +3248,9 @@ def _send_to_named_addresses(server, session, session_onion, session_i2p,
|
||||||
address = recipients_object[rtype]
|
address = recipients_object[rtype]
|
||||||
if address:
|
if address:
|
||||||
if '/' in address:
|
if '/' in address:
|
||||||
if address.endswith('#Public'):
|
if address.endswith('#Public') or \
|
||||||
|
address == 'as:Public' or \
|
||||||
|
address == 'Public':
|
||||||
continue
|
continue
|
||||||
if address.endswith('/followers'):
|
if address.endswith('/followers'):
|
||||||
continue
|
continue
|
||||||
|
@ -3900,7 +3919,8 @@ def _add_post_string_to_timeline(post_str: str, boxname: str,
|
||||||
('"Create"' in post_str or '"Update"' in post_str))):
|
('"Create"' in post_str or '"Update"' in post_str))):
|
||||||
|
|
||||||
if boxname == 'dm':
|
if boxname == 'dm':
|
||||||
if '#Public' in post_str or '/followers' in post_str:
|
if '#Public' in post_str or \
|
||||||
|
'/followers' in post_str:
|
||||||
return False
|
return False
|
||||||
elif boxname == 'tlreplies':
|
elif boxname == 'tlreplies':
|
||||||
if box_actor not in post_str:
|
if box_actor not in post_str:
|
||||||
|
|
12
utils.py
12
utils.py
|
@ -2096,7 +2096,9 @@ def is_dm(post_json_object: {}) -> bool:
|
||||||
if not post_json_object['object'].get(field_name):
|
if not post_json_object['object'].get(field_name):
|
||||||
continue
|
continue
|
||||||
for to_address in post_json_object['object'][field_name]:
|
for to_address in post_json_object['object'][field_name]:
|
||||||
if to_address.endswith('#Public'):
|
if to_address.endswith('#Public') or \
|
||||||
|
to_address == 'as:Public' or \
|
||||||
|
to_address == 'Public':
|
||||||
return False
|
return False
|
||||||
if to_address.endswith('followers'):
|
if to_address.endswith('followers'):
|
||||||
return False
|
return False
|
||||||
|
@ -2428,7 +2430,9 @@ def is_public_post(post_json_object: {}) -> bool:
|
||||||
if not post_json_object['object'].get('to'):
|
if not post_json_object['object'].get('to'):
|
||||||
return False
|
return False
|
||||||
for recipient in post_json_object['object']['to']:
|
for recipient in post_json_object['object']['to']:
|
||||||
if recipient.endswith('#Public'):
|
if recipient.endswith('#Public') or \
|
||||||
|
recipient == 'as:Public' or \
|
||||||
|
recipient == 'Public':
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -2471,7 +2475,9 @@ def is_unlisted_post(post_json_object: {}) -> bool:
|
||||||
if not has_followers:
|
if not has_followers:
|
||||||
return False
|
return False
|
||||||
for recipient in post_json_object['object']['cc']:
|
for recipient in post_json_object['object']['cc']:
|
||||||
if recipient.endswith('#Public'):
|
if recipient.endswith('#Public') or \
|
||||||
|
recipient == 'as:Public' or \
|
||||||
|
recipient == 'Public':
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -564,13 +564,17 @@ def post_contains_public(post_json_object: {}) -> bool:
|
||||||
return contains_public
|
return contains_public
|
||||||
|
|
||||||
for to_address in post_json_object['object']['to']:
|
for to_address in post_json_object['object']['to']:
|
||||||
if to_address.endswith('#Public'):
|
if to_address.endswith('#Public') or \
|
||||||
|
to_address == 'as:Public' or \
|
||||||
|
to_address == 'Public':
|
||||||
contains_public = True
|
contains_public = True
|
||||||
break
|
break
|
||||||
if not contains_public:
|
if not contains_public:
|
||||||
if post_json_object['object'].get('cc'):
|
if post_json_object['object'].get('cc'):
|
||||||
for to_address2 in post_json_object['object']['cc']:
|
for to_address2 in post_json_object['object']['cc']:
|
||||||
if to_address2.endswith('#Public'):
|
if to_address2.endswith('#Public') or \
|
||||||
|
to_address2 == 'as:Public' or \
|
||||||
|
to_address2 == 'Public':
|
||||||
contains_public = True
|
contains_public = True
|
||||||
break
|
break
|
||||||
return contains_public
|
return contains_public
|
||||||
|
|
Loading…
Reference in New Issue