Pass dict through to html generation

merge-requests/30/head
Bob Mottram 2022-07-05 15:40:26 +01:00
parent d2a39c8b50
commit 542f0c6605
13 changed files with 212 additions and 129 deletions

109
daemon.py
View File

@ -1596,7 +1596,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.max_recent_posts, self.server.max_recent_posts,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
self.server.content_license_url) self.server.content_license_url,
self.server.dogwhistles)
def _get_outbox_thread_index(self, nickname: str, def _get_outbox_thread_index(self, nickname: str,
max_outbox_threads_per_account: int) -> int: max_outbox_threads_per_account: int) -> int:
@ -3183,7 +3184,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled, self.server.lists_enabled,
self.server.default_timeline, self.server.default_timeline,
reply_is_chat, reply_is_chat,
bold_reading).encode('utf-8') bold_reading,
self.server.dogwhistles).encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
cookie, calling_domain, False) cookie, calling_domain, False)
@ -3327,7 +3329,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled, self.server.lists_enabled,
self.server.default_timeline, self.server.default_timeline,
reply_is_chat, reply_is_chat,
bold_reading).encode('utf-8') bold_reading,
self.server.dogwhistles).encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
cookie, calling_domain, False) cookie, calling_domain, False)
@ -3889,7 +3892,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.signing_priv_key_pem, self.server.signing_priv_key_pem,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, bold_reading) timezone, bold_reading,
self.server.dogwhistles)
if hashtag_str: if hashtag_str:
msg = hashtag_str.encode('utf-8') msg = hashtag_str.encode('utf-8')
msglen = len(msg) msglen = len(msg)
@ -3994,7 +3998,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.signing_priv_key_pem, self.server.signing_priv_key_pem,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, bold_reading) timezone, bold_reading,
self.server.dogwhistles)
if history_str: if history_str:
msg = history_str.encode('utf-8') msg = history_str.encode('utf-8')
msglen = len(msg) msglen = len(msg)
@ -4074,7 +4079,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.signing_priv_key_pem, self.server.signing_priv_key_pem,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, bold_reading) timezone, bold_reading,
self.server.dogwhistles)
if bookmarks_str: if bookmarks_str:
msg = bookmarks_str.encode('utf-8') msg = bookmarks_str.encode('utf-8')
msglen = len(msg) msglen = len(msg)
@ -4244,7 +4250,8 @@ class PubServer(BaseHTTPRequestHandler):
timezone, timezone,
self.server.onion_domain, self.server.onion_domain,
self.server.i2p_domain, self.server.i2p_domain,
bold_reading) bold_reading,
self.server.dogwhistles)
if profile_str: if profile_str:
msg = profile_str.encode('utf-8') msg = profile_str.encode('utf-8')
msglen = len(msg) msglen = len(msg)
@ -8472,7 +8479,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.signing_priv_key_pem, self.server.signing_priv_key_pem,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, bold_reading) timezone, bold_reading,
self.server.dogwhistles)
if hashtag_str: if hashtag_str:
msg = hashtag_str.encode('utf-8') msg = hashtag_str.encode('utf-8')
msglen = len(msg) msglen = len(msg)
@ -8720,7 +8728,8 @@ class PubServer(BaseHTTPRequestHandler):
False, True, False, False, True, False,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, mitm, bold_reading) timezone, mitm, bold_reading,
self.server.dogwhistles)
actor_absolute = self._get_instance_url(calling_domain) + actor actor_absolute = self._get_instance_url(calling_domain) + actor
actor_path_str = \ actor_path_str = \
@ -9266,7 +9275,8 @@ class PubServer(BaseHTTPRequestHandler):
False, True, False, False, True, False,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, mitm, bold_reading) timezone, mitm, bold_reading,
self.server.dogwhistles)
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
@ -9451,7 +9461,8 @@ class PubServer(BaseHTTPRequestHandler):
False, True, False, False, True, False,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, mitm, bold_reading) timezone, mitm, bold_reading,
self.server.dogwhistles)
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
@ -9665,7 +9676,8 @@ class PubServer(BaseHTTPRequestHandler):
False, True, False, False, True, False,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, mitm, bold_reading) timezone, mitm, bold_reading,
self.server.dogwhistles)
else: else:
print('WARN: Emoji reaction post not found: ' + print('WARN: Emoji reaction post not found: ' +
reaction_post_filename) reaction_post_filename)
@ -9869,7 +9881,8 @@ class PubServer(BaseHTTPRequestHandler):
False, True, False, False, True, False,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, mitm, bold_reading) timezone, mitm, bold_reading,
self.server.dogwhistles)
else: else:
print('WARN: Unreaction post not found: ' + print('WARN: Unreaction post not found: ' +
reaction_post_filename) reaction_post_filename)
@ -9975,7 +9988,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timeline_str, page_number, timeline_str, page_number,
timezone, bold_reading) timezone, bold_reading,
self.server.dogwhistles)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -10117,7 +10131,8 @@ class PubServer(BaseHTTPRequestHandler):
False, True, False, False, True, False,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, mitm, bold_reading) timezone, mitm, bold_reading,
self.server.dogwhistles)
else: else:
print('WARN: Bookmarked post not found: ' + bookmark_filename) print('WARN: Bookmarked post not found: ' + bookmark_filename)
# self._post_to_outbox(bookmark_json, # self._post_to_outbox(bookmark_json,
@ -10266,7 +10281,8 @@ class PubServer(BaseHTTPRequestHandler):
False, True, False, False, True, False,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, mitm, bold_reading) timezone, mitm, bold_reading,
self.server.dogwhistles)
else: else:
print('WARN: Unbookmarked post not found: ' + print('WARN: Unbookmarked post not found: ' +
bookmark_filename) bookmark_filename)
@ -10376,7 +10392,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.max_like_count, self.server.max_like_count,
self.server.signing_priv_key_pem, self.server.signing_priv_key_pem,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled) self.server.lists_enabled,
self.server.dogwhistles)
if delete_str: if delete_str:
delete_str_len = len(delete_str) delete_str_len = len(delete_str)
self._set_headers('text/html', delete_str_len, self._set_headers('text/html', delete_str_len,
@ -10503,7 +10520,8 @@ class PubServer(BaseHTTPRequestHandler):
use_cache_only, use_cache_only,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, mitm, bold_reading) timezone, mitm, bold_reading,
self.server.dogwhistles)
else: else:
print('WARN: Muted post not found: ' + mute_filename) print('WARN: Muted post not found: ' + mute_filename)
@ -10630,7 +10648,8 @@ class PubServer(BaseHTTPRequestHandler):
use_cache_only, use_cache_only,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, mitm, bold_reading) timezone, mitm, bold_reading,
self.server.dogwhistles)
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:
@ -10759,7 +10778,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.signing_priv_key_pem, self.server.signing_priv_key_pem,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, bold_reading) timezone, bold_reading,
self.server.dogwhistles)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -10863,7 +10883,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.signing_priv_key_pem, self.server.signing_priv_key_pem,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, bold_reading) timezone, bold_reading,
self.server.dogwhistles)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -11317,7 +11338,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
'inbox', self.server.default_timeline, 'inbox', self.server.default_timeline,
bold_reading) bold_reading, self.server.dogwhistles)
if not msg: if not msg:
self._404() self._404()
return True return True
@ -11384,7 +11405,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
'inbox', self.server.default_timeline, 'inbox', self.server.default_timeline,
bold_reading, 'shares') bold_reading, self.server.dogwhistles,
'shares')
if not msg: if not msg:
self._404() self._404()
return True return True
@ -11473,7 +11495,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.signing_priv_key_pem, self.server.signing_priv_key_pem,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, mitm, bold_reading) timezone, mitm, bold_reading,
self.server.dogwhistles)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -11789,7 +11812,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.signing_priv_key_pem, self.server.signing_priv_key_pem,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, bold_reading) timezone, bold_reading,
self.server.dogwhistles)
if getreq_start_time: if getreq_start_time:
fitness_performance(getreq_start_time, fitness_performance(getreq_start_time,
self.server.fitness, self.server.fitness,
@ -11960,7 +11984,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.signing_priv_key_pem, self.server.signing_priv_key_pem,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, bold_reading) timezone, bold_reading,
self.server.dogwhistles)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -12120,7 +12145,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.signing_priv_key_pem, self.server.signing_priv_key_pem,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, bold_reading) timezone, bold_reading,
self.server.replies)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -12278,7 +12304,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.signing_priv_key_pem, self.server.signing_priv_key_pem,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, bold_reading) timezone, bold_reading,
self.server.dogwhistles)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -12436,7 +12463,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.signing_priv_key_pem, self.server.signing_priv_key_pem,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, bold_reading) timezone, bold_reading,
self.server.dogwhistles)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -12603,7 +12631,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.signing_priv_key_pem, self.server.signing_priv_key_pem,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, bold_reading) timezone, bold_reading,
self.server.dogwhistles)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -12773,7 +12802,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.signing_priv_key_pem, self.server.signing_priv_key_pem,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, bold_reading) timezone, bold_reading,
self.server.dogwhistles)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -12893,7 +12923,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.signing_priv_key_pem, self.server.signing_priv_key_pem,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, timezone, self.server.lists_enabled, timezone,
bold_reading) bold_reading, self.server.dogwhistles)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -12987,7 +13017,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.signing_priv_key_pem, self.server.signing_priv_key_pem,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, bold_reading) timezone, bold_reading,
self.server.dogwhistles)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -13124,7 +13155,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.signing_priv_key_pem, self.server.signing_priv_key_pem,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, bold_reading) timezone, bold_reading,
self.server.dogwhistles)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -13275,7 +13307,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.signing_priv_key_pem, self.server.signing_priv_key_pem,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, bold_reading) timezone, bold_reading,
self.server.dogwhistles)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -13423,7 +13456,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.signing_priv_key_pem, self.server.signing_priv_key_pem,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
timezone, bold_reading) timezone, bold_reading,
self.server.dogwhistles)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -14800,7 +14834,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled, self.server.lists_enabled,
self.server.default_timeline, self.server.default_timeline,
reply_is_chat, reply_is_chat,
bold_reading).encode('utf-8') bold_reading,
self.server.dogwhistles).encode('utf-8')
if not msg: if not msg:
print('Error replying to ' + in_reply_to_url) print('Error replying to ' + in_reply_to_url)
self._404() self._404()

View File

@ -131,6 +131,7 @@ from conversation import update_conversation
from webapp_hashtagswarm import html_hash_tag_swarm from webapp_hashtagswarm import html_hash_tag_swarm
from person import valid_sending_actor from person import valid_sending_actor
from fitnessFunctions import fitness_performance from fitnessFunctions import fitness_performance
from content import load_dogwhistles
from content import valid_url_lengths from content import valid_url_lengths
from content import remove_script from content import remove_script
@ -408,7 +409,8 @@ def _inbox_store_post_to_html_cache(recent_posts_cache: {},
lists_enabled: str, lists_enabled: str,
timezone: str, timezone: str,
mitm: bool, mitm: bool,
bold_reading: bool) -> None: bold_reading: bool,
dogwhistles: {}) -> 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
""" """
@ -434,7 +436,7 @@ def _inbox_store_post_to_html_cache(recent_posts_cache: {},
theme_name, system_language, max_like_count, theme_name, system_language, max_like_count,
not_dm, True, True, False, True, False, not_dm, True, True, False, True, False,
cw_lists, lists_enabled, timezone, mitm, cw_lists, lists_enabled, timezone, mitm,
bold_reading) bold_reading, dogwhistles)
def valid_inbox(base_dir: str, nickname: str, domain: str) -> bool: def valid_inbox(base_dir: str, nickname: str, domain: str) -> bool:
@ -1106,7 +1108,7 @@ def _receive_edit_to_post(recent_posts_cache: {}, message_json: {},
show_published_date_only: bool, show_published_date_only: bool,
peertube_instances: [], peertube_instances: [],
theme_name: str, max_like_count: int, theme_name: str, max_like_count: int,
cw_lists: {}) -> bool: cw_lists: {}, dogwhistles: {}) -> bool:
"""A post was edited """A post was edited
""" """
if not has_object_dict(message_json): if not has_object_dict(message_json):
@ -1230,7 +1232,7 @@ def _receive_edit_to_post(recent_posts_cache: {}, message_json: {},
manually_approve_followers, manually_approve_followers,
False, True, False, cw_lists, False, True, False, cw_lists,
lists_enabled, timezone, mitm, lists_enabled, timezone, mitm,
bold_reading) bold_reading, dogwhistles)
return True return True
@ -1250,7 +1252,7 @@ def _receive_update_activity(recent_posts_cache: {}, session, base_dir: str,
show_published_date_only: bool, show_published_date_only: bool,
peertube_instances: [], peertube_instances: [],
theme_name: str, max_like_count: int, theme_name: str, max_like_count: int,
cw_lists: {}) -> bool: cw_lists: {}, dogwhistles: {}) -> bool:
"""Receives an Update activity within the POST section of HTTPServer """Receives an Update activity within the POST section of HTTPServer
""" """
@ -1290,7 +1292,7 @@ def _receive_update_activity(recent_posts_cache: {}, session, base_dir: str,
show_published_date_only, show_published_date_only,
peertube_instances, peertube_instances,
theme_name, max_like_count, theme_name, max_like_count,
cw_lists): cw_lists, dogwhistles):
print('EDITPOST: received ' + message_json['object']['id']) print('EDITPOST: received ' + message_json['object']['id'])
return True return True
else: else:
@ -1340,7 +1342,7 @@ def _receive_like(recent_posts_cache: {},
theme_name: str, system_language: str, theme_name: str, system_language: str,
max_like_count: int, cw_lists: {}, max_like_count: int, cw_lists: {},
lists_enabled: str, lists_enabled: str,
bold_reading: bool) -> bool: bold_reading: bool, dogwhistles: {}) -> bool:
"""Receives a Like activity within the POST section of HTTPServer """Receives a Like activity within the POST section of HTTPServer
""" """
if message_json['type'] != 'Like': if message_json['type'] != 'Like':
@ -1449,7 +1451,7 @@ def _receive_like(recent_posts_cache: {},
manually_approve_followers, manually_approve_followers,
False, True, False, cw_lists, False, True, False, cw_lists,
lists_enabled, timezone, mitm, lists_enabled, timezone, mitm,
bold_reading) bold_reading, dogwhistles)
return True return True
@ -1469,7 +1471,7 @@ def _receive_undo_like(recent_posts_cache: {},
theme_name: str, system_language: str, theme_name: str, system_language: str,
max_like_count: int, cw_lists: {}, max_like_count: int, cw_lists: {},
lists_enabled: str, lists_enabled: str,
bold_reading: bool) -> bool: bold_reading: bool, dogwhistles: {}) -> bool:
"""Receives an undo like activity within the POST section of HTTPServer """Receives an undo like activity within the POST section of HTTPServer
""" """
if message_json['type'] != 'Undo': if message_json['type'] != 'Undo':
@ -1568,7 +1570,7 @@ def _receive_undo_like(recent_posts_cache: {},
manually_approve_followers, manually_approve_followers,
False, True, False, cw_lists, False, True, False, cw_lists,
lists_enabled, timezone, mitm, lists_enabled, timezone, mitm,
bold_reading) bold_reading, dogwhistles)
return True return True
@ -1588,7 +1590,8 @@ def _receive_reaction(recent_posts_cache: {},
allow_local_network_access: bool, allow_local_network_access: bool,
theme_name: str, system_language: str, theme_name: str, system_language: str,
max_like_count: int, cw_lists: {}, max_like_count: int, cw_lists: {},
lists_enabled: str, bold_reading: bool) -> bool: lists_enabled: str, bold_reading: bool,
dogwhistles: {}) -> bool:
"""Receives an emoji reaction within the POST section of HTTPServer """Receives an emoji reaction within the POST section of HTTPServer
""" """
if message_json['type'] != 'EmojiReact': if message_json['type'] != 'EmojiReact':
@ -1719,7 +1722,7 @@ def _receive_reaction(recent_posts_cache: {},
manually_approve_followers, manually_approve_followers,
False, True, False, cw_lists, False, True, False, cw_lists,
lists_enabled, timezone, mitm, lists_enabled, timezone, mitm,
bold_reading) bold_reading, dogwhistles)
return True return True
@ -1741,7 +1744,7 @@ def _receive_undo_reaction(recent_posts_cache: {},
theme_name: str, system_language: str, theme_name: str, system_language: str,
max_like_count: int, cw_lists: {}, max_like_count: int, cw_lists: {},
lists_enabled: str, lists_enabled: str,
bold_reading: bool) -> bool: bold_reading: bool, dogwhistles: {}) -> bool:
"""Receives an undo emoji reaction within the POST section of HTTPServer """Receives an undo emoji reaction within the POST section of HTTPServer
""" """
if message_json['type'] != 'Undo': if message_json['type'] != 'Undo':
@ -1858,7 +1861,7 @@ def _receive_undo_reaction(recent_posts_cache: {},
manually_approve_followers, manually_approve_followers,
False, True, False, cw_lists, False, True, False, cw_lists,
lists_enabled, timezone, mitm, lists_enabled, timezone, mitm,
bold_reading) bold_reading, dogwhistles)
return True return True
@ -1876,7 +1879,8 @@ def _receive_bookmark(recent_posts_cache: {},
allow_local_network_access: bool, allow_local_network_access: bool,
theme_name: str, system_language: str, theme_name: str, system_language: str,
max_like_count: int, cw_lists: {}, max_like_count: int, cw_lists: {},
lists_enabled: {}, bold_reading: bool) -> bool: lists_enabled: {}, bold_reading: bool,
dogwhistles: {}) -> bool:
"""Receives a bookmark activity within the POST section of HTTPServer """Receives a bookmark activity within the POST section of HTTPServer
""" """
if not message_json.get('type'): if not message_json.get('type'):
@ -1973,7 +1977,7 @@ def _receive_bookmark(recent_posts_cache: {},
manually_approve_followers, manually_approve_followers,
False, True, False, cw_lists, False, True, False, cw_lists,
lists_enabled, timezone, mitm, lists_enabled, timezone, mitm,
bold_reading) bold_reading, dogwhistles)
return True return True
@ -1993,7 +1997,8 @@ def _receive_undo_bookmark(recent_posts_cache: {},
allow_local_network_access: bool, allow_local_network_access: bool,
theme_name: str, system_language: str, theme_name: str, system_language: str,
max_like_count: int, cw_lists: {}, max_like_count: int, cw_lists: {},
lists_enabled: str, bold_reading: bool) -> bool: lists_enabled: str, bold_reading: bool,
dogwhistles: {}) -> bool:
"""Receives an undo bookmark activity within the POST section of HTTPServer """Receives an undo bookmark activity within the POST section of HTTPServer
""" """
if not message_json.get('type'): if not message_json.get('type'):
@ -2090,7 +2095,8 @@ def _receive_undo_bookmark(recent_posts_cache: {},
show_individual_post_icons, show_individual_post_icons,
manually_approve_followers, manually_approve_followers,
False, True, False, cw_lists, lists_enabled, False, True, False, cw_lists, lists_enabled,
timezone, mitm, bold_reading) timezone, mitm, bold_reading,
dogwhistles)
return True return True
@ -2186,7 +2192,8 @@ def _receive_announce(recent_posts_cache: {},
allow_deletion: bool, allow_deletion: bool,
peertube_instances: [], peertube_instances: [],
max_like_count: int, cw_lists: {}, max_like_count: int, cw_lists: {},
lists_enabled: str, bold_reading: bool) -> bool: lists_enabled: str, bold_reading: bool,
dogwhistles: {}) -> bool:
"""Receives an announce activity within the POST section of HTTPServer """Receives an announce activity within the POST section of HTTPServer
""" """
if message_json['type'] != 'Announce': if message_json['type'] != 'Announce':
@ -2309,7 +2316,7 @@ def _receive_announce(recent_posts_cache: {},
manually_approve_followers, manually_approve_followers,
False, True, False, cw_lists, False, True, False, cw_lists,
lists_enabled, timezone, mitm, lists_enabled, timezone, mitm,
bold_reading) bold_reading, dogwhistles)
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))
@ -3452,7 +3459,7 @@ def _receive_question_vote(server, base_dir: str, nickname: str, domain: str,
theme_name: str, system_language: str, theme_name: str, system_language: str,
max_like_count: int, max_like_count: int,
cw_lists: {}, lists_enabled: bool, cw_lists: {}, lists_enabled: bool,
bold_reading: bool) -> None: bold_reading: bool, dogwhistles: {}) -> None:
"""Updates the votes on a Question/poll """Updates the votes on a Question/poll
""" """
# if this is a reply to a question then update the votes # if this is a reply to a question then update the votes
@ -3505,7 +3512,7 @@ def _receive_question_vote(server, base_dir: str, nickname: str, domain: str,
manually_approve_followers, manually_approve_followers,
False, True, False, cw_lists, False, True, False, cw_lists,
lists_enabled, timezone, mitm, lists_enabled, timezone, mitm,
bold_reading) bold_reading, dogwhistles)
# add id to inbox index # add id to inbox index
inbox_update_index('inbox', base_dir, handle, inbox_update_index('inbox', base_dir, handle,
@ -3676,7 +3683,8 @@ def _inbox_after_initial(server, inbox_start_time,
cw_lists: {}, lists_enabled: str, cw_lists: {}, lists_enabled: str,
content_license_url: str, content_license_url: str,
languages_understood: [], languages_understood: [],
mitm: bool, bold_reading: bool) -> bool: mitm: bool, bold_reading: bool,
dogwhistles: {}) -> bool:
""" Anything which needs to be done after initial checks have passed """ Anything which needs to be done after initial checks have passed
""" """
# if this is a clearnet instance then replace any onion/i2p # if this is a clearnet instance then replace any onion/i2p
@ -3724,7 +3732,7 @@ def _inbox_after_initial(server, inbox_start_time,
allow_local_network_access, allow_local_network_access,
theme_name, system_language, theme_name, system_language,
max_like_count, cw_lists, lists_enabled, max_like_count, cw_lists, lists_enabled,
bold_reading): bold_reading, dogwhistles):
if debug: if debug:
print('DEBUG: Like accepted from ' + actor) print('DEBUG: Like accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness, fitness_performance(inbox_start_time, server.fitness,
@ -3749,7 +3757,7 @@ def _inbox_after_initial(server, inbox_start_time,
allow_local_network_access, allow_local_network_access,
theme_name, system_language, theme_name, system_language,
max_like_count, cw_lists, lists_enabled, max_like_count, cw_lists, lists_enabled,
bold_reading): bold_reading, dogwhistles):
if debug: if debug:
print('DEBUG: Undo like accepted from ' + actor) print('DEBUG: Undo like accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness, fitness_performance(inbox_start_time, server.fitness,
@ -3775,7 +3783,7 @@ def _inbox_after_initial(server, inbox_start_time,
allow_local_network_access, allow_local_network_access,
theme_name, system_language, theme_name, system_language,
max_like_count, cw_lists, lists_enabled, max_like_count, cw_lists, lists_enabled,
bold_reading): bold_reading, dogwhistles):
if debug: if debug:
print('DEBUG: Reaction accepted from ' + actor) print('DEBUG: Reaction accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness, fitness_performance(inbox_start_time, server.fitness,
@ -3802,7 +3810,7 @@ def _inbox_after_initial(server, inbox_start_time,
allow_local_network_access, allow_local_network_access,
theme_name, system_language, theme_name, system_language,
max_like_count, cw_lists, lists_enabled, max_like_count, cw_lists, lists_enabled,
bold_reading): bold_reading, dogwhistles):
if debug: if debug:
print('DEBUG: Undo reaction accepted from ' + actor) print('DEBUG: Undo reaction accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness, fitness_performance(inbox_start_time, server.fitness,
@ -3829,7 +3837,7 @@ def _inbox_after_initial(server, inbox_start_time,
allow_local_network_access, allow_local_network_access,
theme_name, system_language, theme_name, system_language,
max_like_count, cw_lists, lists_enabled, max_like_count, cw_lists, lists_enabled,
bold_reading): bold_reading, dogwhistles):
if debug: if debug:
print('DEBUG: Bookmark accepted from ' + actor) print('DEBUG: Bookmark accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness, fitness_performance(inbox_start_time, server.fitness,
@ -3856,7 +3864,7 @@ def _inbox_after_initial(server, inbox_start_time,
allow_local_network_access, allow_local_network_access,
theme_name, system_language, theme_name, system_language,
max_like_count, cw_lists, lists_enabled, max_like_count, cw_lists, lists_enabled,
bold_reading): bold_reading, dogwhistles):
if debug: if debug:
print('DEBUG: Undo bookmark accepted from ' + actor) print('DEBUG: Undo bookmark accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness, fitness_performance(inbox_start_time, server.fitness,
@ -3891,7 +3899,7 @@ def _inbox_after_initial(server, inbox_start_time,
allow_deletion, allow_deletion,
peertube_instances, peertube_instances,
max_like_count, cw_lists, lists_enabled, max_like_count, cw_lists, lists_enabled,
bold_reading): bold_reading, dogwhistles):
if debug: if debug:
print('DEBUG: Announce accepted from ' + actor) print('DEBUG: Announce accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness, fitness_performance(inbox_start_time, server.fitness,
@ -4033,7 +4041,7 @@ def _inbox_after_initial(server, inbox_start_time,
theme_name, system_language, theme_name, system_language,
max_like_count, max_like_count,
cw_lists, lists_enabled, cw_lists, lists_enabled,
bold_reading) bold_reading, dogwhistles)
fitness_performance(inbox_start_time, server.fitness, fitness_performance(inbox_start_time, server.fitness,
'INBOX', '_receive_question_vote', 'INBOX', '_receive_question_vote',
debug) debug)
@ -4277,7 +4285,8 @@ def _inbox_after_initial(server, inbox_start_time,
cw_lists, cw_lists,
lists_enabled, lists_enabled,
timezone, mitm, timezone, mitm,
bold_reading) bold_reading,
dogwhistles)
fitness_performance(inbox_start_time, fitness_performance(inbox_start_time,
server.fitness, server.fitness,
'INBOX', 'INBOX',
@ -5237,6 +5246,11 @@ def run_inbox_queue(server,
debug) debug)
inbox_start_time = time.time() inbox_start_time = time.time()
dogwhistles_filename = base_dir + '/accounts/dogwhistles.txt'
if not os.path.isfile(dogwhistles_filename):
dogwhistles_filename = base_dir + '/default_dogwhistles.txt'
dogwhistles = load_dogwhistles(dogwhistles_filename)
# set the id to the same as the post filename # set the id to the same as the post filename
# This makes the filename and the id consistent # This makes the filename and the id consistent
# if queue_json['post'].get('id'): # if queue_json['post'].get('id'):
@ -5328,7 +5342,7 @@ def run_inbox_queue(server,
show_published_date_only, show_published_date_only,
peertube_instances, peertube_instances,
theme_name, max_like_count, theme_name, max_like_count,
cw_lists): cw_lists, dogwhistles):
if debug: if debug:
print('Queue: Update accepted from ' + key_id) print('Queue: Update accepted from ' + key_id)
if os.path.isfile(queue_filename): if os.path.isfile(queue_filename):
@ -5456,7 +5470,7 @@ def run_inbox_queue(server,
cw_lists, lists_enabled, cw_lists, lists_enabled,
content_license_url, content_license_url,
languages_understood, mitm, languages_understood, mitm,
bold_reading) bold_reading, dogwhistles)
fitness_performance(inbox_start_time, server.fitness, fitness_performance(inbox_start_time, server.fitness,
'INBOX', 'handle_after_initial', 'INBOX', 'handle_after_initial',
debug) debug)

View File

@ -213,7 +213,8 @@ def post_message_to_outbox(session, translate: {},
max_like_count: int, max_like_count: int,
max_recent_posts: int, cw_lists: {}, max_recent_posts: int, cw_lists: {},
lists_enabled: str, lists_enabled: str,
content_license_url: str) -> bool: content_license_url: str,
dogwhistles: {}) -> bool:
"""post is received by the outbox """post is received by the outbox
Client to server message post Client to server message post
https://www.w3.org/TR/activitypub/#client-to-server-outbox-delivery https://www.w3.org/TR/activitypub/#client-to-server-outbox-delivery
@ -513,7 +514,7 @@ def post_message_to_outbox(session, translate: {},
False, True, use_cache_only, False, True, use_cache_only,
cw_lists, lists_enabled, cw_lists, lists_enabled,
timezone, mitm, timezone, mitm,
bold_reading) bold_reading, dogwhistles)
if outbox_announce(recent_posts_cache, if outbox_announce(recent_posts_cache,
base_dir, message_json, debug): base_dir, message_json, debug):

View File

@ -142,7 +142,8 @@ def _update_post_schedule(base_dir: str, handle: str, httpd,
httpd.max_recent_posts, httpd.max_recent_posts,
httpd.cw_lists, httpd.cw_lists,
httpd.lists_enabled, httpd.lists_enabled,
httpd.content_license_url): httpd.content_license_url,
httpd.dogwhistles):
index_lines.remove(line) index_lines.remove(line)
try: try:
os.remove(post_filename) os.remove(post_filename)

View File

@ -38,7 +38,8 @@ def html_confirm_delete(server, css_cache: {},
allow_local_network_access: bool, allow_local_network_access: bool,
theme_name: str, system_language: str, theme_name: str, system_language: str,
max_like_count: int, signing_priv_key_pem: str, max_like_count: int, signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str) -> str: cw_lists: {}, lists_enabled: str,
dogwhistles: {}) -> str:
"""Shows a screen asking to confirm the deletion of a post """Shows a screen asking to confirm the deletion of a post
""" """
if '/statuses/' not in message_id: if '/statuses/' not in message_id:
@ -90,7 +91,7 @@ def html_confirm_delete(server, css_cache: {},
theme_name, system_language, max_like_count, theme_name, system_language, max_like_count,
False, False, False, False, False, False, False, False, False, False, False, False,
cw_lists, lists_enabled, timezone, mitm, cw_lists, lists_enabled, timezone, mitm,
bold_reading) bold_reading, dogwhistles)
delete_post_str += '<center>' delete_post_str += '<center>'
delete_post_str += \ delete_post_str += \
' <p class="followText">' + \ ' <p class="followText">' + \

View File

@ -224,7 +224,8 @@ def html_new_post(css_cache: {}, media_instance: bool, translate: {},
max_like_count: int, signing_priv_key_pem: str, max_like_count: int, signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str, cw_lists: {}, lists_enabled: str,
box_name: str, box_name: str,
reply_is_chat: bool, bold_reading: bool) -> str: reply_is_chat: bool, bold_reading: bool,
dogwhistles: {}) -> str:
"""New post screen """New post screen
""" """
reply_str = '' reply_str = ''
@ -303,7 +304,7 @@ def html_new_post(css_cache: {}, media_instance: bool, translate: {},
False, False, False, False, False, False,
cw_lists, lists_enabled, cw_lists, lists_enabled,
timezone, False, timezone, False,
bold_reading) bold_reading, dogwhistles)
reply_str = '<input type="hidden" ' + \ reply_str = '<input type="hidden" ' + \
'name="replyTo" value="' + in_reply_to + '">\n' 'name="replyTo" value="' + in_reply_to + '">\n'

View File

@ -38,7 +38,8 @@ def _html_front_screen_posts(recent_posts_cache: {}, max_recent_posts: int,
max_like_count: int, max_like_count: int,
signing_priv_key_pem: str, cw_lists: {}, signing_priv_key_pem: str, cw_lists: {},
lists_enabled: str, lists_enabled: str,
bold_reading: bool) -> str: bold_reading: bool,
dogwhistles: {}) -> str:
"""Shows posts on the front screen of a news instance """Shows posts on the front screen of a news instance
These should only be public blog posts from the features timeline These should only be public blog posts from the features timeline
which is the blog timeline of the news actor which is the blog timeline of the news actor
@ -89,7 +90,7 @@ def _html_front_screen_posts(recent_posts_cache: {}, max_recent_posts: int,
True, False, False, True, False, False,
cw_lists, lists_enabled, cw_lists, lists_enabled,
timezone, False, timezone, False,
bold_reading) bold_reading, dogwhistles)
if post_str: if post_str:
profile_str += post_str + separator_str profile_str += post_str + separator_str
ctr += 1 ctr += 1
@ -120,7 +121,8 @@ def html_front_screen(signing_priv_key_pem: str,
extra_json: {}, extra_json: {},
page_number: int, page_number: int,
max_items_per_page: int, max_items_per_page: int,
cw_lists: {}, lists_enabled: str) -> str: cw_lists: {}, lists_enabled: str,
dogwhistles: {}) -> str:
"""Show the news instance front screen """Show the news instance front screen
""" """
bold_reading = False bold_reading = False
@ -195,7 +197,7 @@ def html_front_screen(signing_priv_key_pem: str,
max_like_count, max_like_count,
signing_priv_key_pem, signing_priv_key_pem,
cw_lists, lists_enabled, cw_lists, lists_enabled,
bold_reading) + license_str bold_reading, dogwhistles) + license_str
# Footer which is only used for system accounts # Footer which is only used for system accounts
profile_footer_str = ' </td>\n' profile_footer_str = ' </td>\n'

View File

@ -41,7 +41,7 @@ def html_likers_of_post(base_dir: str, nickname: str,
max_like_count: int, signing_priv_key_pem: str, max_like_count: int, signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str, cw_lists: {}, lists_enabled: str,
box_name: str, default_timeline: str, box_name: str, default_timeline: str,
bold_reading: bool, bold_reading: bool, dogwhistles: {},
dict_name: str = 'likes') -> str: dict_name: str = 'likes') -> str:
"""Returns html for a screen showing who liked a post """Returns html for a screen showing who liked a post
""" """
@ -107,7 +107,8 @@ def html_likers_of_post(base_dir: str, nickname: str,
False, False, False, False, False, False,
False, False, False, False, False, False,
cw_lists, lists_enabled, cw_lists, lists_enabled,
timezone, mitm, bold_reading) timezone, mitm, bold_reading,
dogwhistles)
# show likers beneath the post # show likers beneath the post
obj = post_json_object obj = post_json_object

View File

@ -57,7 +57,8 @@ def html_moderation(css_cache: {}, default_timeline: str,
shared_items_federated_domains: [], shared_items_federated_domains: [],
signing_priv_key_pem: str, signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str, cw_lists: {}, lists_enabled: str,
timezone: str, bold_reading: bool) -> str: timezone: str, bold_reading: bool,
dogwhistles: {}) -> str:
"""Show the moderation feed as html """Show the moderation feed as html
This is what you see when selecting the "mod" timeline This is what you see when selecting the "mod" timeline
""" """
@ -83,7 +84,7 @@ def html_moderation(css_cache: {}, default_timeline: str,
text_mode_banner, access_keys, system_language, text_mode_banner, access_keys, system_language,
max_like_count, shared_items_federated_domains, max_like_count, shared_items_federated_domains,
signing_priv_key_pem, cw_lists, lists_enabled, signing_priv_key_pem, cw_lists, lists_enabled,
timezone, bold_reading) timezone, bold_reading, dogwhistles)
def html_account_info(css_cache: {}, translate: {}, def html_account_info(css_cache: {}, translate: {},

View File

@ -1583,7 +1583,8 @@ def individual_post_as_html(signing_priv_key_pem: str,
cw_lists: {}, cw_lists: {},
lists_enabled: str, lists_enabled: str,
timezone: str, timezone: str,
mitm: bool, bold_reading: bool) -> str: mitm: bool, bold_reading: bool,
dogwhistles: {}) -> str:
""" Shows a single post as html """ Shows a single post as html
""" """
if not post_json_object: if not post_json_object:
@ -2378,7 +2379,7 @@ def html_individual_post(recent_posts_cache: {}, max_recent_posts: int,
max_like_count: int, signing_priv_key_pem: str, max_like_count: int, signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str, cw_lists: {}, lists_enabled: str,
timezone: str, mitm: bool, timezone: str, mitm: bool,
bold_reading: bool) -> str: bold_reading: bool, dogwhistles: {}) -> 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
@ -2447,7 +2448,7 @@ def html_individual_post(recent_posts_cache: {}, max_recent_posts: int,
system_language, max_like_count, system_language, max_like_count,
False, authorized, False, False, False, False, False, authorized, False, False, False, False,
cw_lists, lists_enabled, timezone, mitm, cw_lists, lists_enabled, timezone, mitm,
bold_reading) bold_reading, dogwhistles)
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
@ -2488,7 +2489,8 @@ def html_individual_post(recent_posts_cache: {}, max_recent_posts: int,
False, False, False, False, False, False, False, False,
cw_lists, lists_enabled, cw_lists, lists_enabled,
timezone, mitm, timezone, mitm,
bold_reading) + post_str bold_reading,
dogwhistles) + 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)
@ -2527,7 +2529,7 @@ def html_individual_post(recent_posts_cache: {}, max_recent_posts: int,
False, False, False, False, False, False, False, False,
cw_lists, lists_enabled, cw_lists, lists_enabled,
timezone, False, timezone, False,
bold_reading) bold_reading, dogwhistles)
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'
@ -2555,7 +2557,8 @@ def html_post_replies(recent_posts_cache: {}, max_recent_posts: int,
max_like_count: int, max_like_count: int,
signing_priv_key_pem: str, cw_lists: {}, signing_priv_key_pem: str, cw_lists: {},
lists_enabled: str, lists_enabled: str,
timezone: str, bold_reading: bool) -> str: timezone: str, bold_reading: bool,
dogwhistles: {}) -> str:
"""Show the replies to an individual post as html """Show the replies to an individual post as html
""" """
replies_str = '' replies_str = ''
@ -2582,7 +2585,7 @@ def html_post_replies(recent_posts_cache: {}, max_recent_posts: int,
False, False, False, False,
cw_lists, lists_enabled, cw_lists, lists_enabled,
timezone, False, timezone, False,
bold_reading) bold_reading, dogwhistles)
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'):
@ -2611,7 +2614,8 @@ def html_emoji_reaction_picker(recent_posts_cache: {}, max_recent_posts: int,
max_like_count: int, signing_priv_key_pem: str, max_like_count: int, signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str, cw_lists: {}, lists_enabled: str,
box_name: str, page_number: int, box_name: str, page_number: int,
timezone: str, bold_reading: bool) -> str: timezone: str, bold_reading: bool,
dogwhistles: {}) -> str:
"""Returns the emoji picker screen """Returns the emoji picker screen
""" """
reacted_to_post_str = \ reacted_to_post_str = \
@ -2635,7 +2639,7 @@ def html_emoji_reaction_picker(recent_posts_cache: {}, max_recent_posts: int,
max_like_count, max_like_count,
False, False, False, False, False, False, False, False, False, False, False, False,
cw_lists, lists_enabled, timezone, False, cw_lists, lists_enabled, timezone, False,
bold_reading) bold_reading, dogwhistles)
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

@ -148,7 +148,7 @@ def html_profile_after_search(recent_posts_cache: {}, max_recent_posts: int,
cw_lists: {}, lists_enabled: str, cw_lists: {}, lists_enabled: str,
timezone: str, timezone: str,
onion_domain: str, i2p_domain: str, onion_domain: str, i2p_domain: str,
bold_reading: bool) -> str: bold_reading: bool, dogwhistles: {}) -> str:
"""Show a profile page after a search for a fediverse address """Show a profile page after a search for a fediverse address
""" """
http = False http = False
@ -388,7 +388,7 @@ def html_profile_after_search(recent_posts_cache: {}, max_recent_posts: int,
False, False, False, False, False, False,
cw_lists, lists_enabled, cw_lists, lists_enabled,
timezone, False, timezone, False,
bold_reading) bold_reading, dogwhistles)
i += 1 i += 1
if i >= 8: if i >= 8:
break break
@ -636,7 +636,7 @@ def html_profile(signing_priv_key_pem: str,
system_language, max_like_count, system_language, max_like_count,
shared_items_federated_domains, None, shared_items_federated_domains, None,
page_number, max_items_per_page, cw_lists, page_number, max_items_per_page, cw_lists,
lists_enabled) lists_enabled, {})
domain, port = get_domain_from_actor(profile_json['id']) domain, port = get_domain_from_actor(profile_json['id'])
if not domain: if not domain:
@ -1031,7 +1031,7 @@ def html_profile(signing_priv_key_pem: str,
max_like_count, max_like_count,
signing_priv_key_pem, signing_priv_key_pem,
cw_lists, lists_enabled, cw_lists, lists_enabled,
timezone, bold_reading) + license_str timezone, bold_reading, {}) + license_str
if not is_group: if not is_group:
if selected == 'following': if selected == 'following':
profile_str += \ profile_str += \
@ -1104,7 +1104,8 @@ def _html_profile_posts(recent_posts_cache: {}, max_recent_posts: int,
max_like_count: int, max_like_count: int,
signing_priv_key_pem: str, signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str, cw_lists: {}, lists_enabled: str,
timezone: str, bold_reading: bool) -> str: timezone: str, bold_reading: bool,
dogwhistles: {}) -> 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
""" """
@ -1154,7 +1155,7 @@ def _html_profile_posts(recent_posts_cache: {}, max_recent_posts: int,
True, False, False, True, False, False,
cw_lists, lists_enabled, cw_lists, lists_enabled,
timezone, False, timezone, False,
bold_reading) bold_reading, dogwhistles)
if post_str: if post_str:
profile_str += post_str + separator_str profile_str += post_str + separator_str
ctr += 1 ctr += 1

View File

@ -621,7 +621,8 @@ def html_history_search(translate: {}, base_dir: str,
signing_priv_key_pem: str, signing_priv_key_pem: str,
cw_lists: {}, cw_lists: {},
lists_enabled: str, lists_enabled: str,
timezone: str, bold_reading: bool) -> str: timezone: str, bold_reading: bool,
dogwhistles: {}) -> str:
"""Show a page containing search results for your post history """Show a page containing search results for your post history
""" """
if historysearch.startswith("'"): if historysearch.startswith("'"):
@ -709,7 +710,8 @@ def html_history_search(translate: {}, base_dir: str,
show_individual_post_icons, show_individual_post_icons,
False, False, False, False, False, False, False, False,
cw_lists, lists_enabled, cw_lists, lists_enabled,
timezone, False, bold_reading) timezone, False, bold_reading,
dogwhistles)
if post_str: if post_str:
history_search_form += separator_str + post_str history_search_form += separator_str + post_str
index += 1 index += 1
@ -734,7 +736,8 @@ def html_hashtag_search(nickname: str, domain: str, port: int,
max_like_count: int, max_like_count: int,
signing_priv_key_pem: str, signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str, cw_lists: {}, lists_enabled: str,
timezone: str, bold_reading: bool) -> str: timezone: str, bold_reading: bool,
dogwhistles: {}) -> str:
"""Show a page containing search results for a hashtag """Show a page containing search results for a hashtag
or after selecting a hashtag from the swarm or after selecting a hashtag from the swarm
""" """
@ -897,7 +900,7 @@ def html_hashtag_search(nickname: str, domain: str, port: int,
show_public_only, show_public_only,
store_to_sache, False, cw_lists, store_to_sache, False, cw_lists,
lists_enabled, timezone, False, lists_enabled, timezone, False,
bold_reading) bold_reading, dogwhistles)
if post_str: if post_str:
hashtag_search_form += separator_str + post_str hashtag_search_form += separator_str + post_str
index += 1 index += 1

View File

@ -493,7 +493,8 @@ def html_timeline(css_cache: {}, default_timeline: str,
shared_items_federated_domains: [], shared_items_federated_domains: [],
signing_priv_key_pem: str, signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str, cw_lists: {}, lists_enabled: str,
timezone: str, bold_reading: bool) -> str: timezone: str, bold_reading: bool,
dogwhistles: {}) -> str:
"""Show the timeline as html """Show the timeline as html
""" """
enable_timing_log = False enable_timing_log = False
@ -1000,7 +1001,7 @@ def html_timeline(css_cache: {}, default_timeline: str,
False, True, use_cache_only, False, True, use_cache_only,
cw_lists, lists_enabled, cw_lists, lists_enabled,
timezone, mitm, timezone, mitm,
bold_reading) bold_reading, dogwhistles)
_log_timeline_timing(enable_timing_log, _log_timeline_timing(enable_timing_log,
timeline_start_time, box_name, '12') timeline_start_time, box_name, '12')
@ -1238,7 +1239,8 @@ def html_shares(css_cache: {}, default_timeline: str,
shared_items_federated_domains: [], shared_items_federated_domains: [],
signing_priv_key_pem: str, signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str, cw_lists: {}, lists_enabled: str,
timezone: str, bold_reading: bool) -> str: timezone: str, bold_reading: bool,
dogwhistles: {}) -> str:
"""Show the shares timeline as html """Show the shares timeline as html
""" """
manually_approve_followers = \ manually_approve_followers = \
@ -1269,7 +1271,7 @@ def html_shares(css_cache: {}, default_timeline: str,
shared_items_federated_domains, shared_items_federated_domains,
signing_priv_key_pem, signing_priv_key_pem,
cw_lists, lists_enabled, timezone, cw_lists, lists_enabled, timezone,
bold_reading) bold_reading, dogwhistles)
def html_wanted(css_cache: {}, default_timeline: str, def html_wanted(css_cache: {}, default_timeline: str,
@ -1298,7 +1300,8 @@ def html_wanted(css_cache: {}, default_timeline: str,
shared_items_federated_domains: [], shared_items_federated_domains: [],
signing_priv_key_pem: str, signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str, cw_lists: {}, lists_enabled: str,
timezone: str, bold_reading: bool) -> str: timezone: str, bold_reading: bool,
dogwhistles: {}) -> str:
"""Show the wanted timeline as html """Show the wanted timeline as html
""" """
manually_approve_followers = \ manually_approve_followers = \
@ -1329,7 +1332,7 @@ def html_wanted(css_cache: {}, default_timeline: str,
shared_items_federated_domains, shared_items_federated_domains,
signing_priv_key_pem, signing_priv_key_pem,
cw_lists, lists_enabled, timezone, cw_lists, lists_enabled, timezone,
bold_reading) bold_reading, dogwhistles)
def html_inbox(css_cache: {}, default_timeline: str, def html_inbox(css_cache: {}, default_timeline: str,
@ -1359,7 +1362,8 @@ def html_inbox(css_cache: {}, default_timeline: str,
shared_items_federated_domains: [], shared_items_federated_domains: [],
signing_priv_key_pem: str, signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str, cw_lists: {}, lists_enabled: str,
timezone: str, bold_reading: bool) -> str: timezone: str, bold_reading: bool,
dogwhistles: {}) -> str:
"""Show the inbox as html """Show the inbox as html
""" """
manually_approve_followers = \ manually_approve_followers = \
@ -1390,7 +1394,7 @@ def html_inbox(css_cache: {}, default_timeline: str,
shared_items_federated_domains, shared_items_federated_domains,
signing_priv_key_pem, signing_priv_key_pem,
cw_lists, lists_enabled, timezone, cw_lists, lists_enabled, timezone,
bold_reading) bold_reading, dogwhistles)
def html_bookmarks(css_cache: {}, default_timeline: str, def html_bookmarks(css_cache: {}, default_timeline: str,
@ -1420,7 +1424,8 @@ def html_bookmarks(css_cache: {}, default_timeline: str,
shared_items_federated_domains: [], shared_items_federated_domains: [],
signing_priv_key_pem: str, signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str, cw_lists: {}, lists_enabled: str,
timezone: str, bold_reading: bool) -> str: timezone: str, bold_reading: bool,
dogwhistles: {}) -> str:
"""Show the bookmarks as html """Show the bookmarks as html
""" """
manually_approve_followers = \ manually_approve_followers = \
@ -1450,7 +1455,7 @@ def html_bookmarks(css_cache: {}, default_timeline: str,
access_keys, system_language, max_like_count, access_keys, system_language, max_like_count,
shared_items_federated_domains, signing_priv_key_pem, shared_items_federated_domains, signing_priv_key_pem,
cw_lists, lists_enabled, timezone, cw_lists, lists_enabled, timezone,
bold_reading) bold_reading, dogwhistles)
def html_inbox_dms(css_cache: {}, default_timeline: str, def html_inbox_dms(css_cache: {}, default_timeline: str,
@ -1480,7 +1485,8 @@ def html_inbox_dms(css_cache: {}, default_timeline: str,
shared_items_federated_domains: [], shared_items_federated_domains: [],
signing_priv_key_pem: str, signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str, cw_lists: {}, lists_enabled: str,
timezone: str, bold_reading: bool) -> str: timezone: str, bold_reading: bool,
dogwhistles: {}) -> str:
"""Show the DM timeline as html """Show the DM timeline as html
""" """
artist = is_artist(base_dir, nickname) artist = is_artist(base_dir, nickname)
@ -1506,7 +1512,7 @@ def html_inbox_dms(css_cache: {}, default_timeline: str,
shared_items_federated_domains, shared_items_federated_domains,
signing_priv_key_pem, signing_priv_key_pem,
cw_lists, lists_enabled, timezone, cw_lists, lists_enabled, timezone,
bold_reading) bold_reading, dogwhistles)
def html_inbox_replies(css_cache: {}, default_timeline: str, def html_inbox_replies(css_cache: {}, default_timeline: str,
@ -1536,7 +1542,8 @@ def html_inbox_replies(css_cache: {}, default_timeline: str,
shared_items_federated_domains: [], shared_items_federated_domains: [],
signing_priv_key_pem: str, signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str, cw_lists: {}, lists_enabled: str,
timezone: str, bold_reading: bool) -> str: timezone: str, bold_reading: bool,
dogwhistles: {}) -> str:
"""Show the replies timeline as html """Show the replies timeline as html
""" """
artist = is_artist(base_dir, nickname) artist = is_artist(base_dir, nickname)
@ -1560,7 +1567,8 @@ def html_inbox_replies(css_cache: {}, default_timeline: str,
allow_local_network_access, text_mode_banner, allow_local_network_access, text_mode_banner,
access_keys, system_language, max_like_count, access_keys, system_language, max_like_count,
shared_items_federated_domains, signing_priv_key_pem, shared_items_federated_domains, signing_priv_key_pem,
cw_lists, lists_enabled, timezone, bold_reading) cw_lists, lists_enabled, timezone, bold_reading,
dogwhistles)
def html_inbox_media(css_cache: {}, default_timeline: str, def html_inbox_media(css_cache: {}, default_timeline: str,
@ -1590,7 +1598,8 @@ def html_inbox_media(css_cache: {}, default_timeline: str,
shared_items_federated_domains: [], shared_items_federated_domains: [],
signing_priv_key_pem: str, signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str, cw_lists: {}, lists_enabled: str,
timezone: str, bold_reading: bool) -> str: timezone: str, bold_reading: bool,
dogwhistles: {}) -> str:
"""Show the media timeline as html """Show the media timeline as html
""" """
artist = is_artist(base_dir, nickname) artist = is_artist(base_dir, nickname)
@ -1614,7 +1623,8 @@ def html_inbox_media(css_cache: {}, default_timeline: str,
allow_local_network_access, text_mode_banner, allow_local_network_access, text_mode_banner,
access_keys, system_language, max_like_count, access_keys, system_language, max_like_count,
shared_items_federated_domains, signing_priv_key_pem, shared_items_federated_domains, signing_priv_key_pem,
cw_lists, lists_enabled, timezone, bold_reading) cw_lists, lists_enabled, timezone, bold_reading,
dogwhistles)
def html_inbox_blogs(css_cache: {}, default_timeline: str, def html_inbox_blogs(css_cache: {}, default_timeline: str,
@ -1644,7 +1654,8 @@ def html_inbox_blogs(css_cache: {}, default_timeline: str,
shared_items_federated_domains: [], shared_items_federated_domains: [],
signing_priv_key_pem: str, signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str, cw_lists: {}, lists_enabled: str,
timezone: str, bold_reading: bool) -> str: timezone: str, bold_reading: bool,
dogwhistles: {}) -> str:
"""Show the blogs timeline as html """Show the blogs timeline as html
""" """
artist = is_artist(base_dir, nickname) artist = is_artist(base_dir, nickname)
@ -1668,7 +1679,8 @@ def html_inbox_blogs(css_cache: {}, default_timeline: str,
allow_local_network_access, text_mode_banner, allow_local_network_access, text_mode_banner,
access_keys, system_language, max_like_count, access_keys, system_language, max_like_count,
shared_items_federated_domains, signing_priv_key_pem, shared_items_federated_domains, signing_priv_key_pem,
cw_lists, lists_enabled, timezone, bold_reading) cw_lists, lists_enabled, timezone, bold_reading,
dogwhistles)
def html_inbox_features(css_cache: {}, default_timeline: str, def html_inbox_features(css_cache: {}, default_timeline: str,
@ -1699,7 +1711,8 @@ def html_inbox_features(css_cache: {}, default_timeline: str,
shared_items_federated_domains: [], shared_items_federated_domains: [],
signing_priv_key_pem: str, signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str, cw_lists: {}, lists_enabled: str,
timezone: str, bold_reading: bool) -> str: timezone: str, bold_reading: bool,
dogwhistles: {}) -> str:
"""Show the features timeline as html """Show the features timeline as html
""" """
return html_timeline(css_cache, default_timeline, return html_timeline(css_cache, default_timeline,
@ -1722,7 +1735,8 @@ def html_inbox_features(css_cache: {}, default_timeline: str,
allow_local_network_access, text_mode_banner, allow_local_network_access, text_mode_banner,
access_keys, system_language, max_like_count, access_keys, system_language, max_like_count,
shared_items_federated_domains, signing_priv_key_pem, shared_items_federated_domains, signing_priv_key_pem,
cw_lists, lists_enabled, timezone, bold_reading) cw_lists, lists_enabled, timezone, bold_reading,
dogwhistles)
def html_inbox_news(css_cache: {}, default_timeline: str, def html_inbox_news(css_cache: {}, default_timeline: str,
@ -1752,7 +1766,8 @@ def html_inbox_news(css_cache: {}, default_timeline: str,
shared_items_federated_domains: [], shared_items_federated_domains: [],
signing_priv_key_pem: str, signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str, cw_lists: {}, lists_enabled: str,
timezone: str, bold_reading: bool) -> str: timezone: str, bold_reading: bool,
dogwhistles: {}) -> str:
"""Show the news timeline as html """Show the news timeline as html
""" """
return html_timeline(css_cache, default_timeline, return html_timeline(css_cache, default_timeline,
@ -1775,7 +1790,8 @@ def html_inbox_news(css_cache: {}, default_timeline: str,
allow_local_network_access, text_mode_banner, allow_local_network_access, text_mode_banner,
access_keys, system_language, max_like_count, access_keys, system_language, max_like_count,
shared_items_federated_domains, signing_priv_key_pem, shared_items_federated_domains, signing_priv_key_pem,
cw_lists, lists_enabled, timezone, bold_reading) cw_lists, lists_enabled, timezone, bold_reading,
dogwhistles)
def html_outbox(css_cache: {}, default_timeline: str, def html_outbox(css_cache: {}, default_timeline: str,
@ -1805,7 +1821,8 @@ def html_outbox(css_cache: {}, default_timeline: str,
shared_items_federated_domains: [], shared_items_federated_domains: [],
signing_priv_key_pem: str, signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str, cw_lists: {}, lists_enabled: str,
timezone: str, bold_reading: bool) -> str: timezone: str, bold_reading: bool,
dogwhistles: {}) -> str:
"""Show the Outbox as html """Show the Outbox as html
""" """
manually_approve_followers = \ manually_approve_followers = \
@ -1831,4 +1848,5 @@ def html_outbox(css_cache: {}, default_timeline: str,
allow_local_network_access, text_mode_banner, allow_local_network_access, text_mode_banner,
access_keys, system_language, max_like_count, access_keys, system_language, max_like_count,
shared_items_federated_domains, signing_priv_key_pem, shared_items_federated_domains, signing_priv_key_pem,
cw_lists, lists_enabled, timezone, bold_reading) cw_lists, lists_enabled, timezone, bold_reading,
dogwhistles)