Avoid duplicate use of mutuals list within timeline

main
Bob Mottram 2025-11-26 20:27:19 +00:00
parent 205d0d4e79
commit 3e6b4c8251
19 changed files with 194 additions and 50 deletions

View File

@ -10,6 +10,7 @@ __status__ = "Production"
__module_group__ = "Daemon GET" __module_group__ = "Daemon GET"
import os import os
from utils import get_mutuals_of_person
from utils import delete_post from utils import delete_post
from utils import locate_post from utils import locate_post
from utils import is_dm from utils import is_dm
@ -228,6 +229,9 @@ def announce_button(self, calling_domain: str, path: str,
minimize_all_images = False minimize_all_images = False
if self.post_to_nickname in min_images_for_accounts: if self.post_to_nickname in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir,
self.post_to_nickname, domain)
individual_post_as_html(signing_priv_key_pem, False, individual_post_as_html(signing_priv_key_pem, False,
recent_posts_cache, recent_posts_cache,
max_recent_posts, max_recent_posts,
@ -263,7 +267,8 @@ def announce_button(self, calling_domain: str, path: str,
buy_sites, buy_sites,
auto_cw_cache, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
actor_absolute = \ actor_absolute = \
get_instance_url(calling_domain, get_instance_url(calling_domain,

View File

@ -10,6 +10,7 @@ __status__ = "Production"
__module_group__ = "Daemon GET" __module_group__ = "Daemon GET"
import os import os
from utils import get_mutuals_of_person
from utils import get_cached_post_filename from utils import get_cached_post_filename
from utils import load_json from utils import load_json
from utils import locate_post from utils import locate_post
@ -182,6 +183,9 @@ def bookmark_button(self, calling_domain: str, path: str,
minimize_all_images = False minimize_all_images = False
if self.post_to_nickname in min_images_for_accounts: if self.post_to_nickname in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = \
get_mutuals_of_person(base_dir, self.post_to_nickname, domain)
individual_post_as_html(signing_priv_key_pem, individual_post_as_html(signing_priv_key_pem,
False, False,
recent_posts_cache, recent_posts_cache,
@ -218,7 +222,8 @@ def bookmark_button(self, calling_domain: str, path: str,
buy_sites, buy_sites,
auto_cw_cache, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
else: else:
print('WARN: Bookmarked post not found: ' + bookmark_filename) print('WARN: Bookmarked post not found: ' + bookmark_filename)
actor_absolute = \ actor_absolute = \
@ -393,6 +398,9 @@ def bookmark_button_undo(self, calling_domain: str, path: str,
minimize_all_images = False minimize_all_images = False
if self.post_to_nickname in min_images_for_accounts: if self.post_to_nickname in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = \
get_mutuals_of_person(base_dir, self.post_to_nickname, domain)
individual_post_as_html(signing_priv_key_pem, individual_post_as_html(signing_priv_key_pem,
False, False,
recent_posts_cache, recent_posts_cache,
@ -429,7 +437,8 @@ def bookmark_button_undo(self, calling_domain: str, path: str,
buy_sites, buy_sites,
auto_cw_cache, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
else: else:
print('WARN: Unbookmarked post not found: ' + print('WARN: Unbookmarked post not found: ' +
bookmark_filename) bookmark_filename)

View File

@ -10,6 +10,7 @@ __status__ = "Production"
__module_group__ = "Daemon GET" __module_group__ = "Daemon GET"
import os import os
from utils import get_mutuals_of_person
from utils import is_dm from utils import is_dm
from utils import get_cached_post_filename from utils import get_cached_post_filename
from utils import load_json from utils import load_json
@ -229,6 +230,9 @@ def like_button(self, calling_domain: str, path: str,
minimize_all_images = False minimize_all_images = False
if self.post_to_nickname in min_images_for_accounts: if self.post_to_nickname in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = \
get_mutuals_of_person(base_dir, self.post_to_nickname, domain)
individual_post_as_html(signing_priv_key_pem, individual_post_as_html(signing_priv_key_pem,
False, False,
recent_posts_cache, recent_posts_cache,
@ -265,7 +269,8 @@ def like_button(self, calling_domain: str, path: str,
buy_sites, buy_sites,
auto_cw_cache, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
else: else:
print('WARN: Liked post not found: ' + liked_post_filename) print('WARN: Liked post not found: ' + liked_post_filename)
# clear the icon from the cache so that it gets updated # clear the icon from the cache so that it gets updated
@ -484,6 +489,9 @@ def like_button_undo(self, calling_domain: str, path: str,
minimize_all_images = False minimize_all_images = False
if self.post_to_nickname in min_images_for_accounts: if self.post_to_nickname in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = \
get_mutuals_of_person(base_dir, self.post_to_nickname, domain)
individual_post_as_html(signing_priv_key_pem, individual_post_as_html(signing_priv_key_pem,
False, False,
recent_posts_cache, recent_posts_cache,
@ -520,7 +528,8 @@ def like_button_undo(self, calling_domain: str, path: str,
buy_sites, buy_sites,
auto_cw_cache, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
else: else:
print('WARN: Unliked post not found: ' + liked_post_filename) print('WARN: Unliked post not found: ' + liked_post_filename)
# clear the icon from the cache so that it gets updated # clear the icon from the cache so that it gets updated

View File

@ -10,6 +10,7 @@ __status__ = "Production"
__module_group__ = "Daemon GET" __module_group__ = "Daemon GET"
import os import os
from utils import get_mutuals_of_person
from utils import is_dm from utils import is_dm
from utils import get_cached_post_filename from utils import get_cached_post_filename
from utils import load_json from utils import load_json
@ -144,6 +145,8 @@ def mute_button(self, calling_domain: str, path: str,
minimize_all_images = False minimize_all_images = False
if nickname in min_images_for_accounts: if nickname in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, nickname, domain)
individual_post_as_html(signing_priv_key_pem, individual_post_as_html(signing_priv_key_pem,
allow_downloads, allow_downloads,
recent_posts_cache, recent_posts_cache,
@ -181,7 +184,8 @@ def mute_button(self, calling_domain: str, path: str,
buy_sites, buy_sites,
auto_cw_cache, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
else: else:
print('WARN: Muted post not found: ' + mute_filename) print('WARN: Muted post not found: ' + mute_filename)
@ -322,6 +326,8 @@ def mute_button_undo(self, calling_domain: str, path: str,
minimize_all_images = False minimize_all_images = False
if nickname in min_images_for_accounts: if nickname in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, nickname, domain)
individual_post_as_html(signing_priv_key_pem, individual_post_as_html(signing_priv_key_pem,
allow_downloads, allow_downloads,
recent_posts_cache, recent_posts_cache,
@ -359,7 +365,8 @@ def mute_button_undo(self, calling_domain: str, path: str,
buy_sites, buy_sites,
auto_cw_cache, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
else: else:
print('WARN: Unmuted post not found: ' + mute_filename) print('WARN: Unmuted post not found: ' + mute_filename)
if calling_domain.endswith('.onion') and onion_domain: if calling_domain.endswith('.onion') and onion_domain:

View File

@ -11,6 +11,7 @@ __module_group__ = "Daemon GET"
import os import os
import urllib.parse import urllib.parse
from utils import get_mutuals_of_person
from utils import get_cached_post_filename from utils import get_cached_post_filename
from utils import load_json from utils import load_json
from utils import locate_post from utils import locate_post
@ -258,6 +259,9 @@ def reaction_button(self, calling_domain: str, path: str,
minimize_all_images = False minimize_all_images = False
if self.post_to_nickname in min_images_for_accounts: if self.post_to_nickname in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = \
get_mutuals_of_person(base_dir, self.post_to_nickname, domain)
individual_post_as_html(signing_priv_key_pem, individual_post_as_html(signing_priv_key_pem,
False, False,
recent_posts_cache, recent_posts_cache,
@ -294,7 +298,8 @@ def reaction_button(self, calling_domain: str, path: str,
buy_sites, buy_sites,
auto_cw_cache, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
else: else:
print('WARN: Emoji reaction post not found: ' + print('WARN: Emoji reaction post not found: ' +
reaction_post_filename) reaction_post_filename)
@ -535,6 +540,9 @@ def reaction_button_undo(self, calling_domain: str, path: str,
minimize_all_images = False minimize_all_images = False
if self.post_to_nickname in min_images_for_accounts: if self.post_to_nickname in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = \
get_mutuals_of_person(base_dir, self.post_to_nickname, domain)
individual_post_as_html(signing_priv_key_pem, individual_post_as_html(signing_priv_key_pem,
False, False,
recent_posts_cache, recent_posts_cache,
@ -571,7 +579,8 @@ def reaction_button_undo(self, calling_domain: str, path: str,
buy_sites, buy_sites,
auto_cw_cache, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
else: else:
print('WARN: Unreaction post not found: ' + print('WARN: Unreaction post not found: ' +
reaction_post_filename) reaction_post_filename)

View File

@ -14,6 +14,7 @@ from flags import is_public_post_from_url
from flags import is_public_post from flags import is_public_post
from flags import is_premium_account from flags import is_premium_account
from flags import can_reply_to from flags import can_reply_to
from utils import get_mutuals_of_person
from utils import get_instance_url from utils import get_instance_url
from utils import local_actor_url from utils import local_actor_url
from utils import locate_post from utils import locate_post
@ -136,6 +137,9 @@ def _show_post_from_file(self, post_filename: str, liked_by: str,
if bold_reading_nicknames.get(nickname): if bold_reading_nicknames.get(nickname):
bold_reading = True bold_reading = True
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, nickname, domain)
msg = \ msg = \
html_individual_post(recent_posts_cache, html_individual_post(recent_posts_cache,
max_recent_posts, max_recent_posts,
@ -168,7 +172,8 @@ def _show_post_from_file(self, post_filename: str, liked_by: str,
auto_cw_cache, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software, instance_software,
ua_str) ua_str,
mutuals_list)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
set_html_post_headers(self, msglen, set_html_post_headers(self, msglen,
@ -1014,6 +1019,8 @@ def show_replies_to_post(self, authorized: bool,
bold_reading = False bold_reading = False
if bold_reading_nicknames.get(nickname): if bold_reading_nicknames.get(nickname):
bold_reading = True bold_reading = True
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, nickname, domain)
msg = \ msg = \
html_post_replies(recent_posts_cache, html_post_replies(recent_posts_cache,
max_recent_posts, max_recent_posts,
@ -1045,7 +1052,8 @@ def show_replies_to_post(self, authorized: bool,
buy_sites, buy_sites,
auto_cw_cache, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
set_headers(self, 'text/html', msglen, set_headers(self, 'text/html', msglen,
@ -1128,6 +1136,8 @@ def show_replies_to_post(self, authorized: bool,
bold_reading = False bold_reading = False
if bold_reading_nicknames.get(nickname): if bold_reading_nicknames.get(nickname):
bold_reading = True bold_reading = True
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, nickname, domain)
msg = \ msg = \
html_post_replies(recent_posts_cache, html_post_replies(recent_posts_cache,
max_recent_posts, max_recent_posts,
@ -1159,7 +1169,8 @@ def show_replies_to_post(self, authorized: bool,
buy_sites, buy_sites,
auto_cw_cache, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
set_headers(self, 'text/html', msglen, set_headers(self, 'text/html', msglen,

View File

@ -29,6 +29,7 @@ from timeFunctions import date_utcnow
from timeFunctions import date_epoch from timeFunctions import date_epoch
from timeFunctions import get_account_timezone from timeFunctions import get_account_timezone
from timeFunctions import get_current_time_int from timeFunctions import get_current_time_int
from utils import get_mutuals_of_person
from utils import harmless_markup from utils import harmless_markup
from utils import lines_in_file from utils import lines_in_file
from utils import contains_statuses from utils import contains_statuses
@ -196,7 +197,8 @@ def _inbox_store_post_to_html_cache(recent_posts_cache: {},
buy_sites: {}, buy_sites: {},
auto_cw_cache: {}, auto_cw_cache: {},
mitm_servers: [], mitm_servers: [],
instance_software: {}) -> None: instance_software: {},
mutuals_list: []) -> None:
"""Converts the json post into html and stores it in a cache """Converts the json post into html and stores it in a cache
This enables the post to be quickly displayed later This enables the post to be quickly displayed later
""" """
@ -227,7 +229,8 @@ def _inbox_store_post_to_html_cache(recent_posts_cache: {},
cw_lists, lists_enabled, timezone, mitm, cw_lists, lists_enabled, timezone, mitm,
bold_reading, dogwhistles, minimize_all_images, bold_reading, dogwhistles, minimize_all_images,
None, buy_sites, auto_cw_cache, None, buy_sites, auto_cw_cache,
mitm_servers, instance_software) mitm_servers, instance_software,
mutuals_list)
def valid_inbox(base_dir: str, nickname: str, domain: str) -> bool: def valid_inbox(base_dir: str, nickname: str, domain: str) -> bool:
@ -1867,6 +1870,9 @@ def _inbox_after_initial(server, inbox_start_time,
handle_name = handle.split('@')[0] handle_name = handle.split('@')[0]
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, handle_name, domain)
if receive_actor_status(base_dir, person_cache, message_json, if receive_actor_status(base_dir, person_cache, message_json,
debug): debug):
if debug: if debug:
@ -2548,7 +2554,8 @@ def _inbox_after_initial(server, inbox_start_time,
buy_sites, buy_sites,
server.auto_cw_cache, server.auto_cw_cache,
server.mitm_servers, server.mitm_servers,
instance_software) instance_software,
mutuals_list)
fitness_performance(inbox_start_time, fitness_performance(inbox_start_time,
server.fitness, server.fitness,
'INBOX', 'INBOX',

View File

@ -14,6 +14,7 @@ from flags import is_quote_toot
from status import actor_status_expired from status import actor_status_expired
from quote import get_quote_toot_url from quote import get_quote_toot_url
from timeFunctions import get_account_timezone from timeFunctions import get_account_timezone
from utils import get_mutuals_of_person
from utils import get_actor_from_post_id from utils import get_actor_from_post_id
from utils import contains_invalid_actor_url_chars from utils import contains_invalid_actor_url_chars
from utils import get_attributed_to from utils import get_attributed_to
@ -501,6 +502,8 @@ def receive_edit_to_post(recent_posts_cache: {}, message_json: {},
minimize_all_images = False minimize_all_images = False
if nickname in min_images_for_accounts: if nickname in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, nickname, domain)
individual_post_as_html(signing_priv_key_pem, False, individual_post_as_html(signing_priv_key_pem, False,
recent_posts_cache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, page_number, base_dir, translate, page_number, base_dir,
@ -522,7 +525,8 @@ def receive_edit_to_post(recent_posts_cache: {}, message_json: {},
bold_reading, dogwhistles, bold_reading, dogwhistles,
minimize_all_images, None, minimize_all_images, None,
buy_sites, auto_cw_cache, buy_sites, auto_cw_cache,
mitm_servers, instance_software) mitm_servers, instance_software,
mutuals_list)
return True return True
@ -1061,6 +1065,8 @@ def receive_like(recent_posts_cache: {},
minimize_all_images = False minimize_all_images = False
if handle_name in min_images_for_accounts: if handle_name in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, handle_name, domain)
individual_post_as_html(signing_priv_key_pem, False, individual_post_as_html(signing_priv_key_pem, False,
recent_posts_cache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, page_number, base_dir, translate, page_number, base_dir,
@ -1083,7 +1089,7 @@ def receive_like(recent_posts_cache: {},
bold_reading, dogwhistles, bold_reading, dogwhistles,
minimize_all_images, None, buy_sites, minimize_all_images, None, buy_sites,
auto_cw_cache, mitm_servers, auto_cw_cache, mitm_servers,
instance_software) instance_software, mutuals_list)
return True return True
@ -1285,6 +1291,8 @@ def receive_reaction(recent_posts_cache: {},
minimize_all_images = False minimize_all_images = False
if handle_name in min_images_for_accounts: if handle_name in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, handle_name, domain)
individual_post_as_html(signing_priv_key_pem, False, individual_post_as_html(signing_priv_key_pem, False,
recent_posts_cache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, page_number, base_dir, translate, page_number, base_dir,
@ -1308,7 +1316,7 @@ def receive_reaction(recent_posts_cache: {},
bold_reading, dogwhistles, bold_reading, dogwhistles,
minimize_all_images, None, buy_sites, minimize_all_images, None, buy_sites,
auto_cw_cache, mitm_servers, auto_cw_cache, mitm_servers,
instance_software) instance_software, mutuals_list)
return True return True
@ -1474,6 +1482,8 @@ def receive_zot_reaction(recent_posts_cache: {},
minimize_all_images = False minimize_all_images = False
if handle_name in min_images_for_accounts: if handle_name in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, handle_name, domain)
individual_post_as_html(signing_priv_key_pem, False, individual_post_as_html(signing_priv_key_pem, False,
recent_posts_cache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, page_number, base_dir, translate, page_number, base_dir,
@ -1498,7 +1508,8 @@ def receive_zot_reaction(recent_posts_cache: {},
minimize_all_images, None, minimize_all_images, None,
buy_sites, auto_cw_cache, buy_sites, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
return True return True
@ -1605,6 +1616,8 @@ def receive_bookmark(recent_posts_cache: {},
minimize_all_images = False minimize_all_images = False
if nickname in min_images_for_accounts: if nickname in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, nickname, domain)
individual_post_as_html(signing_priv_key_pem, False, individual_post_as_html(signing_priv_key_pem, False,
recent_posts_cache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, page_number, base_dir, translate, page_number, base_dir,
@ -1628,7 +1641,8 @@ def receive_bookmark(recent_posts_cache: {},
minimize_all_images, None, minimize_all_images, None,
buy_sites, auto_cw_cache, buy_sites, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
return True return True
@ -1886,6 +1900,9 @@ def receive_announce(recent_posts_cache: {},
if os.path.isfile(show_vote_file): if os.path.isfile(show_vote_file):
show_vote_posts = False show_vote_posts = False
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, nickname, domain)
announce_html = \ announce_html = \
individual_post_as_html(signing_priv_key_pem, True, individual_post_as_html(signing_priv_key_pem, True,
recent_posts_cache, max_recent_posts, recent_posts_cache, max_recent_posts,
@ -1910,7 +1927,8 @@ def receive_announce(recent_posts_cache: {},
minimize_all_images, None, minimize_all_images, None,
buy_sites, auto_cw_cache, buy_sites, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
if not announce_html: if not announce_html:
print('WARN: Unable to generate html for announce ' + print('WARN: Unable to generate html for announce ' +
str(message_json)) str(message_json))
@ -2105,6 +2123,8 @@ def receive_question_vote(server, base_dir: str, nickname: str, domain: str,
minimize_all_images = False minimize_all_images = False
if nickname in min_images_for_accounts: if nickname in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, nickname, domain)
individual_post_as_html(signing_priv_key_pem, False, individual_post_as_html(signing_priv_key_pem, False,
recent_posts_cache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, page_number, base_dir, translate, page_number, base_dir,
@ -2128,7 +2148,8 @@ def receive_question_vote(server, base_dir: str, nickname: str, domain: str,
minimize_all_images, None, minimize_all_images, None,
buy_sites, auto_cw_cache, buy_sites, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
# add id to inbox index # add id to inbox index
inbox_update_index('inbox', base_dir, handle, inbox_update_index('inbox', base_dir, handle,

View File

@ -11,6 +11,7 @@ import os
from flags import has_group_type from flags import has_group_type
from timeFunctions import get_account_timezone from timeFunctions import get_account_timezone
from announce import undo_announce_collection_entry from announce import undo_announce_collection_entry
from utils import get_mutuals_of_person
from utils import has_object_dict from utils import has_object_dict
from utils import remove_domain_port from utils import remove_domain_port
from utils import remove_id_ending from utils import remove_id_ending
@ -259,6 +260,8 @@ def receive_undo_like(recent_posts_cache: {},
minimize_all_images = False minimize_all_images = False
if handle_name in min_images_for_accounts: if handle_name in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, handle_name, domain)
individual_post_as_html(signing_priv_key_pem, False, individual_post_as_html(signing_priv_key_pem, False,
recent_posts_cache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, page_number, base_dir, translate, page_number, base_dir,
@ -282,7 +285,8 @@ def receive_undo_like(recent_posts_cache: {},
minimize_all_images, None, minimize_all_images, None,
buy_sites, auto_cw_cache, buy_sites, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
return True return True
@ -406,6 +410,8 @@ def receive_undo_reaction(recent_posts_cache: {},
minimize_all_images = False minimize_all_images = False
if handle_name in min_images_for_accounts: if handle_name in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, handle_name, domain)
individual_post_as_html(signing_priv_key_pem, False, individual_post_as_html(signing_priv_key_pem, False,
recent_posts_cache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, page_number, base_dir, translate, page_number, base_dir,
@ -430,7 +436,8 @@ def receive_undo_reaction(recent_posts_cache: {},
minimize_all_images, None, minimize_all_images, None,
buy_sites, auto_cw_cache, buy_sites, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
return True return True
@ -539,6 +546,8 @@ def receive_undo_bookmark(recent_posts_cache: {},
minimize_all_images = False minimize_all_images = False
if nickname in min_images_for_accounts: if nickname in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, nickname, domain)
individual_post_as_html(signing_priv_key_pem, False, individual_post_as_html(signing_priv_key_pem, False,
recent_posts_cache, max_recent_posts, recent_posts_cache, max_recent_posts,
translate, page_number, base_dir, translate, page_number, base_dir,
@ -560,7 +569,8 @@ def receive_undo_bookmark(recent_posts_cache: {},
timezone, mitm, bold_reading, timezone, mitm, bold_reading,
dogwhistles, minimize_all_images, None, dogwhistles, minimize_all_images, None,
buy_sites, auto_cw_cache, buy_sites, auto_cw_cache,
mitm_servers, instance_software) mitm_servers, instance_software,
mutuals_list)
return True return True

View File

@ -19,6 +19,7 @@ from flags import is_featured_writer
from flags import is_quote_toot from flags import is_quote_toot
from quote import quote_toots_allowed from quote import quote_toots_allowed
from timeFunctions import get_account_timezone from timeFunctions import get_account_timezone
from utils import get_mutuals_of_person
from utils import data_dir from utils import data_dir
from utils import get_post_attachments from utils import get_post_attachments
from utils import get_attributed_to from utils import get_attributed_to
@ -665,6 +666,9 @@ def post_message_to_outbox(session, translate: {},
minimize_all_images = False minimize_all_images = False
if post_to_nickname in min_images_for_accounts: if post_to_nickname in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = \
get_mutuals_of_person(base_dir, post_to_nickname, domain)
individual_post_as_html(signing_priv_key_pem, individual_post_as_html(signing_priv_key_pem,
False, recent_posts_cache, False, recent_posts_cache,
max_recent_posts, max_recent_posts,
@ -694,7 +698,8 @@ def post_message_to_outbox(session, translate: {},
minimize_all_images, None, minimize_all_images, None,
buy_sites, auto_cw_cache, buy_sites, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
if is_edited_post: if is_edited_post:
message_json['type'] = 'Update' message_json['type'] = 'Update'

View File

@ -9,6 +9,7 @@ __module_group__ = "Web Interface"
import os import os
from shutil import copyfile from shutil import copyfile
from utils import get_mutuals_of_person
from utils import data_dir from utils import data_dir
from utils import get_full_domain from utils import get_full_domain
from utils import get_nickname_from_actor from utils import get_nickname_from_actor
@ -89,6 +90,8 @@ def html_confirm_delete(server,
minimize_all_images = False minimize_all_images = False
if nickname in min_images_for_accounts: if nickname in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, nickname, domain)
delete_post_str += \ delete_post_str += \
individual_post_as_html(signing_priv_key_pem, individual_post_as_html(signing_priv_key_pem,
True, recent_posts_cache, max_recent_posts, True, recent_posts_cache, max_recent_posts,
@ -108,7 +111,7 @@ def html_confirm_delete(server,
bold_reading, dogwhistles, bold_reading, dogwhistles,
minimize_all_images, None, buy_sites, minimize_all_images, None, buy_sites,
auto_cw_cache, mitm_servers, auto_cw_cache, mitm_servers,
instance_software) instance_software, mutuals_list)
delete_post_str += '<center>' delete_post_str += '<center>'
delete_post_str += \ delete_post_str += \
' <p class="followText">' + \ ' <p class="followText">' + \

View File

@ -11,6 +11,7 @@ __module_group__ = "Timeline"
import os import os
from conversation import download_conversation_posts from conversation import download_conversation_posts
from flags import is_public_post from flags import is_public_post
from utils import get_mutuals_of_person
from utils import remove_id_ending from utils import remove_id_ending
from utils import get_config_param from utils import get_config_param
from utils import get_nickname_from_actor from utils import get_nickname_from_actor
@ -131,6 +132,8 @@ def html_conversation_view(authorized: bool, post_id: str,
blocked_cache, block_federated): blocked_cache, block_federated):
show_individual_post_icons = False show_individual_post_icons = False
allow_deletion = False allow_deletion = False
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, nickname, domain)
post_str = \ post_str = \
individual_post_as_html(signing_priv_key_pem, individual_post_as_html(signing_priv_key_pem,
True, recent_posts_cache, True, recent_posts_cache,
@ -159,7 +162,8 @@ def html_conversation_view(authorized: bool, post_id: str,
minimize_all_images, None, minimize_all_images, None,
buy_sites, auto_cw_cache, buy_sites, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
if post_str: if post_str:
conv_str += \ conv_str += \
current_reading_str + text_mode_separator + \ current_reading_str + text_mode_separator + \

View File

@ -10,6 +10,7 @@ __module_group__ = "Web Interface"
import os import os
from flags import is_public_post_from_url from flags import is_public_post_from_url
from flags import is_premium_account from flags import is_premium_account
from utils import get_mutuals_of_person
from utils import get_event_categories from utils import get_event_categories
from utils import data_dir from utils import data_dir
from utils import dangerous_markup from utils import dangerous_markup
@ -432,6 +433,9 @@ def html_new_post(edit_post_params: {},
minimize_all_images = False minimize_all_images = False
if nickname in min_images_for_accounts: if nickname in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = \
get_mutuals_of_person(base_dir, nickname, domain)
replied_to_post = \ replied_to_post = \
individual_post_as_html(signing_priv_key_pem, individual_post_as_html(signing_priv_key_pem,
True, recent_posts_cache, True, recent_posts_cache,
@ -461,7 +465,8 @@ def html_new_post(edit_post_params: {},
minimize_all_images, None, minimize_all_images, None,
buy_sites, auto_cw_cache, buy_sites, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
new_post_text += \ new_post_text += \
open_content_warning(replied_to_post, translate) open_content_warning(replied_to_post, translate)
# about the author # about the author

View File

@ -9,6 +9,7 @@ __module_group__ = "Timeline"
import os import os
from flags import is_system_account from flags import is_system_account
from utils import get_mutuals_of_person
from utils import get_domain_from_actor from utils import get_domain_from_actor
from utils import get_config_param from utils import get_config_param
from timeFunctions import get_account_timezone from timeFunctions import get_account_timezone
@ -76,6 +77,9 @@ def _html_front_screen_posts(recent_posts_cache: {}, max_recent_posts: int,
minimize_all_images = False minimize_all_images = False
if nickname in min_images_for_accounts: if nickname in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = \
get_mutuals_of_person(base_dir, nickname, domain)
post_str = \ post_str = \
individual_post_as_html(signing_priv_key_pem, individual_post_as_html(signing_priv_key_pem,
True, recent_posts_cache, True, recent_posts_cache,
@ -103,7 +107,8 @@ def _html_front_screen_posts(recent_posts_cache: {}, max_recent_posts: int,
minimize_all_images, None, minimize_all_images, None,
buy_sites, auto_cw_cache, buy_sites, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
if post_str: if post_str:
profile_str += post_str + separator_str profile_str += post_str + separator_str
ctr += 1 ctr += 1

View File

@ -97,6 +97,8 @@ def html_likers_of_post(base_dir: str, nickname: str,
minimize_all_images = False minimize_all_images = False
if nickname in min_images_for_accounts: if nickname in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, nickname, domain)
html_str += \ html_str += \
individual_post_as_html(signing_priv_key_pem, individual_post_as_html(signing_priv_key_pem,
True, recent_posts_cache, True, recent_posts_cache,
@ -126,7 +128,8 @@ def html_likers_of_post(base_dir: str, nickname: str,
minimize_all_images, None, minimize_all_images, None,
buy_sites, auto_cw_cache, buy_sites, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
# show likers beneath the post # show likers beneath the post
obj = post_json_object obj = post_json_object

View File

@ -2326,7 +2326,8 @@ def individual_post_as_html(signing_priv_key_pem: str,
buy_sites: {}, buy_sites: {},
auto_cw_cache: {}, auto_cw_cache: {},
mitm_servers: [], mitm_servers: [],
instance_software: {}) -> str: instance_software: {},
mutuals_list: []) -> str:
""" Shows a single post as html """ Shows a single post as html
""" """
if not post_json_object: if not post_json_object:
@ -2656,9 +2657,6 @@ def individual_post_as_html(signing_priv_key_pem: str,
if mitm or actor_domain in mitm_servers: if mitm or actor_domain in mitm_servers:
mitm_str = ' ' + mitm_warning_html(translate) mitm_str = ' ' + mitm_warning_html(translate)
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, nickname, domain)
# add mutual icon to the display name # add mutual icon to the display name
mutual_prefix = '' mutual_prefix = ''
if actor_handle in mutuals_list: if actor_handle in mutuals_list:
@ -3443,7 +3441,8 @@ def html_individual_post(recent_posts_cache: {}, max_recent_posts: int,
buy_sites: {}, buy_sites: {},
auto_cw_cache: {}, mitm_servers: [], auto_cw_cache: {}, mitm_servers: [],
instance_software: {}, instance_software: {},
ua_str: str) -> str: ua_str: str,
mutuals_list: []) -> str:
"""Show an individual post as html """Show an individual post as html
""" """
original_post_json = post_json_object original_post_json = post_json_object
@ -3541,7 +3540,7 @@ def html_individual_post(recent_posts_cache: {}, max_recent_posts: int,
bold_reading, dogwhistles, bold_reading, dogwhistles,
minimize_all_images, None, buy_sites, minimize_all_images, None, buy_sites,
auto_cw_cache, mitm_servers, auto_cw_cache, mitm_servers,
instance_software) instance_software, mutuals_list)
message_id = remove_id_ending(post_json_object['id']) message_id = remove_id_ending(post_json_object['id'])
# show the previous posts # show the previous posts
@ -3595,7 +3594,8 @@ def html_individual_post(recent_posts_cache: {}, max_recent_posts: int,
None, buy_sites, None, buy_sites,
auto_cw_cache, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) + post_str instance_software,
mutuals_list) + post_str
# show the following posts # show the following posts
post_filename = locate_post(base_dir, nickname, domain, message_id) post_filename = locate_post(base_dir, nickname, domain, message_id)
@ -3637,7 +3637,8 @@ def html_individual_post(recent_posts_cache: {}, max_recent_posts: int,
bold_reading, dogwhistles, bold_reading, dogwhistles,
minimize_all_images, None, minimize_all_images, None,
buy_sites, auto_cw_cache, buy_sites, auto_cw_cache,
mitm_servers, instance_software) mitm_servers, instance_software,
mutuals_list)
css_filename = base_dir + '/epicyon-profile.css' css_filename = base_dir + '/epicyon-profile.css'
if os.path.isfile(base_dir + '/epicyon.css'): if os.path.isfile(base_dir + '/epicyon.css'):
css_filename = base_dir + '/epicyon.css' css_filename = base_dir + '/epicyon.css'
@ -3691,7 +3692,8 @@ def html_post_replies(recent_posts_cache: {}, max_recent_posts: int,
buy_sites: {}, buy_sites: {},
auto_cw_cache: {}, auto_cw_cache: {},
mitm_servers: [], mitm_servers: [],
instance_software: {}) -> str: instance_software: {},
mutuals_list: []) -> str:
"""Show the replies to an individual post as html """Show the replies to an individual post as html
""" """
replies_str = '' replies_str = ''
@ -3725,7 +3727,8 @@ def html_post_replies(recent_posts_cache: {}, max_recent_posts: int,
minimize_all_images, None, minimize_all_images, None,
buy_sites, auto_cw_cache, buy_sites, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
css_filename = base_dir + '/epicyon-profile.css' css_filename = base_dir + '/epicyon-profile.css'
if os.path.isfile(base_dir + '/epicyon.css'): if os.path.isfile(base_dir + '/epicyon.css'):
@ -3768,6 +3771,8 @@ def html_emoji_reaction_picker(recent_posts_cache: {}, max_recent_posts: int,
minimize_all_images = False minimize_all_images = False
if nickname in min_images_for_accounts: if nickname in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, nickname, domain)
reacted_to_post_str = \ reacted_to_post_str = \
'<br><center><label class="followText">' + \ '<br><center><label class="followText">' + \
translate['Select reaction'].title() + '</label></center>\n' + \ translate['Select reaction'].title() + '</label></center>\n' + \
@ -3792,7 +3797,7 @@ def html_emoji_reaction_picker(recent_posts_cache: {}, max_recent_posts: int,
bold_reading, dogwhistles, bold_reading, dogwhistles,
minimize_all_images, None, buy_sites, minimize_all_images, None, buy_sites,
auto_cw_cache, mitm_servers, auto_cw_cache, mitm_servers,
instance_software) instance_software, mutuals_list)
reactions_filename = base_dir + '/emoji/reactions.json' reactions_filename = base_dir + '/emoji/reactions.json'
if not os.path.isfile(reactions_filename): if not os.path.isfile(reactions_filename):

View File

@ -23,6 +23,7 @@ from textmode import text_mode_removals
from unicodetext import uninvert_text from unicodetext import uninvert_text
from unicodetext import standardize_text from unicodetext import standardize_text
from occupation import get_occupation_name from occupation import get_occupation_name
from utils import get_mutuals_of_person
from utils import get_person_icon from utils import get_person_icon
from utils import replace_strings from utils import replace_strings
from utils import data_dir from utils import data_dir
@ -609,6 +610,9 @@ def html_profile_after_search(authorized: bool,
str(item)) str(item))
continue continue
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, nickname, domain)
profile_post_html = \ profile_post_html = \
individual_post_as_html(signing_priv_key_pem, individual_post_as_html(signing_priv_key_pem,
True, recent_posts_cache, True, recent_posts_cache,
@ -635,7 +639,8 @@ def html_profile_after_search(authorized: bool,
minimize_all_images, None, minimize_all_images, None,
buy_sites, auto_cw_cache, buy_sites, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
if not profile_post_html: if not profile_post_html:
if debug: if debug:
print('DEBUG: no html produced for profile post: ' + print('DEBUG: no html produced for profile post: ' +
@ -1705,6 +1710,9 @@ def html_profile(signing_priv_key_pem: str,
max_profile_posts = \ max_profile_posts = \
get_max_profile_posts(base_dir, nickname, domain, 20) get_max_profile_posts(base_dir, nickname, domain, 20)
min_images_for_accounts: list[str] = [] min_images_for_accounts: list[str] = []
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir,
nickname, domain)
profile_str += \ profile_str += \
_html_profile_posts(recent_posts_cache, max_profile_posts, _html_profile_posts(recent_posts_cache, max_profile_posts,
translate, translate,
@ -1727,7 +1735,8 @@ def html_profile(signing_priv_key_pem: str,
buy_sites, buy_sites,
auto_cw_cache, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) + license_str instance_software,
mutuals_list) + license_str
if not is_group: if not is_group:
if selected == 'following': if selected == 'following':
profile_str += \ profile_str += \
@ -1839,7 +1848,8 @@ def _html_profile_posts(recent_posts_cache: {}, max_recent_posts: int,
buy_sites: {}, buy_sites: {},
auto_cw_cache: {}, auto_cw_cache: {},
mitm_servers: [], mitm_servers: [],
instance_software: {}) -> str: instance_software: {},
mutuals_list: []) -> str:
"""Shows posts on the profile screen """Shows posts on the profile screen
These should only be public posts These should only be public posts
""" """
@ -1900,7 +1910,8 @@ def _html_profile_posts(recent_posts_cache: {}, max_recent_posts: int,
minimize_all_images, None, minimize_all_images, None,
buy_sites, auto_cw_cache, buy_sites, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
if post_str and item_id not in shown_items: if post_str and item_id not in shown_items:
profile_str += post_str + separator_str profile_str += post_str + separator_str
shown_items.append(item_id) shown_items.append(item_id)

View File

@ -14,6 +14,7 @@ from flags import is_editor
from flags import is_public_post from flags import is_public_post
from searchable import search_box_posts from searchable import search_box_posts
from timeFunctions import date_from_string_format from timeFunctions import date_from_string_format
from utils import get_mutuals_of_person
from utils import get_person_icon from utils import get_person_icon
from utils import data_dir from utils import data_dir
from utils import get_post_attachments from utils import get_post_attachments
@ -827,6 +828,8 @@ def html_history_search(translate: {}, base_dir: str,
continue continue
show_individual_post_icons = True show_individual_post_icons = True
allow_deletion = False allow_deletion = False
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, nickname, domain)
post_str = \ post_str = \
individual_post_as_html(signing_priv_key_pem, individual_post_as_html(signing_priv_key_pem,
True, recent_posts_cache, True, recent_posts_cache,
@ -855,7 +858,8 @@ def html_history_search(translate: {}, base_dir: str,
minimize_all_images, None, minimize_all_images, None,
buy_sites, auto_cw_cache, buy_sites, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
if post_str: if post_str:
history_search_form += separator_str + post_str history_search_form += separator_str + post_str
index += 1 index += 1
@ -1059,6 +1063,8 @@ def html_hashtag_search(nickname: str, domain: str, port: int,
minimize_all_images = False minimize_all_images = False
if nickname in min_images_for_accounts: if nickname in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, nickname, domain)
post_str = \ post_str = \
individual_post_as_html(signing_priv_key_pem, individual_post_as_html(signing_priv_key_pem,
allow_downloads, recent_posts_cache, allow_downloads, recent_posts_cache,
@ -1088,7 +1094,8 @@ def html_hashtag_search(nickname: str, domain: str, port: int,
minimize_all_images, None, minimize_all_images, None,
buy_sites, auto_cw_cache, buy_sites, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
if post_str: if post_str:
hashtag_search_form += \ hashtag_search_form += \
text_mode_separator + separator_str + post_str text_mode_separator + separator_str + post_str
@ -1270,6 +1277,8 @@ def html_hashtag_search_remote(nickname: str, domain: str, port: int,
minimize_all_images = False minimize_all_images = False
if nickname in min_images_for_accounts: if nickname in min_images_for_accounts:
minimize_all_images = True minimize_all_images = True
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, nickname, domain)
post_str = \ post_str = \
individual_post_as_html(signing_priv_key_pem, individual_post_as_html(signing_priv_key_pem,
allow_downloads, recent_posts_cache, allow_downloads, recent_posts_cache,
@ -1299,7 +1308,8 @@ def html_hashtag_search_remote(nickname: str, domain: str, port: int,
minimize_all_images, None, minimize_all_images, None,
buy_sites, auto_cw_cache, buy_sites, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
if post_str: if post_str:
hashtag_search_form += \ hashtag_search_form += \
text_mode_separator + separator_str + post_str text_mode_separator + separator_str + post_str

View File

@ -14,6 +14,7 @@ from flags import is_editor
from flags import is_artist from flags import is_artist
from flags import is_float from flags import is_float
from flags import is_moderator from flags import is_moderator
from utils import get_mutuals_of_person
from utils import data_dir from utils import data_dir
from utils import dangerous_markup from utils import dangerous_markup
from utils import get_config_param from utils import get_config_param
@ -1016,6 +1017,9 @@ def html_timeline(default_timeline: str,
if os.path.isfile(no_seen_posts_filename): if os.path.isfile(no_seen_posts_filename):
no_seen_posts = True no_seen_posts = True
# get the list of mutuals for the current account
mutuals_list = get_mutuals_of_person(base_dir, nickname, domain)
# show each post in the timeline # show each post in the timeline
tl_items_str = '' tl_items_str = ''
for item in timeline_json['orderedItems']: for item in timeline_json['orderedItems']:
@ -1098,7 +1102,8 @@ def html_timeline(default_timeline: str,
first_post_id, buy_sites, first_post_id, buy_sites,
auto_cw_cache, auto_cw_cache,
mitm_servers, mitm_servers,
instance_software) instance_software,
mutuals_list)
_log_timeline_timing(enable_timing_log, _log_timeline_timing(enable_timing_log,
timeline_start_time, box_name, '12') timeline_start_time, box_name, '12')