Merge branch 'main' of gitlab.com:bashrc2/epicyon

merge-requests/30/head
Bob Mottram 2022-11-13 21:50:24 +00:00
commit 988daa3e1f
5213 changed files with 956 additions and 579 deletions

View File

@ -269,6 +269,7 @@ def _html_blog_post_content(debug: bool, session, authorized: bool,
languages_understood = get_actor_languages_list(actor_json) languages_understood = get_actor_languages_list(actor_json)
json_content = get_content_from_post(post_json_object, system_language, json_content = get_content_from_post(post_json_object, system_language,
languages_understood) languages_understood)
minimize_all_images = False
attachment_str, _ = \ attachment_str, _ = \
get_post_attachments_as_html(base_dir, nickname, domain, get_post_attachments_as_html(base_dir, nickname, domain,
domain_full, post_json_object, domain_full, post_json_object,
@ -277,7 +278,8 @@ def _html_blog_post_content(debug: bool, session, authorized: bool,
reply_str, announce_str, reply_str, announce_str,
like_str, bookmark_str, like_str, bookmark_str,
delete_str, mute_str, delete_str, mute_str,
json_content) json_content,
minimize_all_images)
if attachment_str: if attachment_str:
blog_str += '<br><center>' + attachment_str + '</center>' blog_str += '<br><center>' + attachment_str + '</center>'
if json_content: if json_content:

193
daemon.py
View File

@ -264,6 +264,8 @@ from languages import set_actor_languages
from languages import get_understood_languages from languages import get_understood_languages
from like import update_likes_collection from like import update_likes_collection
from reaction import update_reaction_collection from reaction import update_reaction_collection
from utils import load_min_images_for_accounts
from utils import set_minimize_all_images
from utils import get_json_content_from_accept from utils import get_json_content_from_accept
from utils import remove_eol from utils import remove_eol
from utils import text_in_file from utils import text_in_file
@ -1730,7 +1732,8 @@ class PubServer(BaseHTTPRequestHandler):
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) self.server.dogwhistles,
self.server.min_images_for_accounts)
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:
@ -3337,7 +3340,8 @@ class PubServer(BaseHTTPRequestHandler):
if self.server.bold_reading.get(chooser_nickname): if self.server.bold_reading.get(chooser_nickname):
bold_reading = True bold_reading = True
msg = html_new_post(False, self.server.translate, msg = \
html_new_post(False, self.server.translate,
base_dir, base_dir,
http_prefix, http_prefix,
report_path, None, report_path, None,
@ -3373,7 +3377,10 @@ class PubServer(BaseHTTPRequestHandler):
self.server.default_timeline, self.server.default_timeline,
reply_is_chat, reply_is_chat,
bold_reading, bold_reading,
self.server.dogwhistles).encode('utf-8') self.server.dogwhistles,
self.server.min_images_for_accounts)
if msg:
msg = msg.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)
@ -3480,7 +3487,8 @@ class PubServer(BaseHTTPRequestHandler):
if self.server.bold_reading.get(chooser_nickname): if self.server.bold_reading.get(chooser_nickname):
bold_reading = True bold_reading = True
msg = html_new_post(False, self.server.translate, msg = \
html_new_post(False, self.server.translate,
base_dir, base_dir,
http_prefix, http_prefix,
report_path, None, [], report_path, None, [],
@ -3515,7 +3523,10 @@ class PubServer(BaseHTTPRequestHandler):
self.server.default_timeline, self.server.default_timeline,
reply_is_chat, reply_is_chat,
bold_reading, bold_reading,
self.server.dogwhistles).encode('utf-8') self.server.dogwhistles,
self.server.min_images_for_accounts)
if msg:
msg = msg.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)
@ -4086,7 +4097,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.dogwhistles, self.server.dogwhistles,
self.server.map_format, self.server.map_format,
self.server.access_keys, self.server.access_keys,
'search') 'search',
self.server.min_images_for_accounts)
if hashtag_str: if hashtag_str:
msg = hashtag_str.encode('utf-8') msg = hashtag_str.encode('utf-8')
msglen = len(msg) msglen = len(msg)
@ -4196,7 +4208,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled, self.server.lists_enabled,
timezone, bold_reading, timezone, bold_reading,
self.server.dogwhistles, self.server.dogwhistles,
self.server.access_keys) self.server.access_keys,
self.server.min_images_for_accounts)
if history_str: if history_str:
msg = history_str.encode('utf-8') msg = history_str.encode('utf-8')
msglen = len(msg) msglen = len(msg)
@ -4278,7 +4291,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled, self.server.lists_enabled,
timezone, bold_reading, timezone, bold_reading,
self.server.dogwhistles, self.server.dogwhistles,
self.server.access_keys) self.server.access_keys,
self.server.min_images_for_accounts)
if bookmarks_str: if bookmarks_str:
msg = bookmarks_str.encode('utf-8') msg = bookmarks_str.encode('utf-8')
msglen = len(msg) msglen = len(msg)
@ -4416,6 +4430,8 @@ class PubServer(BaseHTTPRequestHandler):
if self.server.bold_reading.get(nickname): if self.server.bold_reading.get(nickname):
bold_reading = True bold_reading = True
min_images_for_accounts = \
self.server.min_images_for_accounts
profile_str = \ profile_str = \
html_profile_after_search(recent_posts_cache, html_profile_after_search(recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
@ -4449,7 +4465,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.onion_domain, self.server.onion_domain,
self.server.i2p_domain, self.server.i2p_domain,
bold_reading, bold_reading,
self.server.dogwhistles) self.server.dogwhistles,
min_images_for_accounts)
if profile_str: if profile_str:
msg = profile_str.encode('utf-8') msg = profile_str.encode('utf-8')
msglen = len(msg) msglen = len(msg)
@ -6946,6 +6963,25 @@ class PubServer(BaseHTTPRequestHandler):
'unable to delete ' + 'unable to delete ' +
hide_like_button_file) hide_like_button_file)
# Minimize all images from edit profile screen
minimize_all_images = False
if fields.get('minimizeAllImages'):
if fields['minimizeAllImages'] == 'on':
minimize_all_images = True
min_img_acct = self.server.min_images_for_accounts
set_minimize_all_images(base_dir,
nickname, domain,
True, min_img_acct)
print('min_images_for_accounts: ' +
str(min_img_acct))
if not minimize_all_images:
min_img_acct = self.server.min_images_for_accounts
set_minimize_all_images(base_dir,
nickname, domain,
False, min_img_acct)
print('min_images_for_accounts: ' +
str(min_img_acct))
# hide Reaction button # hide Reaction button
hide_reaction_button_file = \ hide_reaction_button_file = \
acct_dir(base_dir, nickname, domain) + \ acct_dir(base_dir, nickname, domain) + \
@ -8701,7 +8737,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.dogwhistles, self.server.dogwhistles,
self.server.map_format, self.server.map_format,
self.server.access_keys, self.server.access_keys,
'search') 'search',
self.server.min_images_for_accounts)
if hashtag_str: if hashtag_str:
msg = hashtag_str.encode('utf-8') msg = hashtag_str.encode('utf-8')
msglen = len(msg) msglen = len(msg)
@ -8923,6 +8960,9 @@ class PubServer(BaseHTTPRequestHandler):
bold_reading = False bold_reading = False
if self.server.bold_reading.get(self.post_to_nickname): if self.server.bold_reading.get(self.post_to_nickname):
bold_reading = True bold_reading = True
minimize_all_images = False
if self.post_to_nickname in self.server.min_images_for_accounts:
minimize_all_images = True
individual_post_as_html(self.server.signing_priv_key_pem, False, individual_post_as_html(self.server.signing_priv_key_pem, False,
self.server.recent_posts_cache, self.server.recent_posts_cache,
self.server.max_recent_posts, self.server.max_recent_posts,
@ -8952,7 +8992,8 @@ class PubServer(BaseHTTPRequestHandler):
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) self.server.dogwhistles,
minimize_all_images)
actor_absolute = self._get_instance_url(calling_domain) + actor actor_absolute = self._get_instance_url(calling_domain) + actor
actor_path_str = \ actor_path_str = \
@ -9461,6 +9502,10 @@ class PubServer(BaseHTTPRequestHandler):
bold_reading = False bold_reading = False
if self.server.bold_reading.get(self.post_to_nickname): if self.server.bold_reading.get(self.post_to_nickname):
bold_reading = True bold_reading = True
minimize_all_images = False
if self.post_to_nickname in \
self.server.min_images_for_accounts:
minimize_all_images = True
individual_post_as_html(self.server.signing_priv_key_pem, individual_post_as_html(self.server.signing_priv_key_pem,
False, False,
self.server.recent_posts_cache, self.server.recent_posts_cache,
@ -9492,7 +9537,8 @@ class PubServer(BaseHTTPRequestHandler):
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) self.server.dogwhistles,
minimize_all_images)
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
@ -9649,6 +9695,10 @@ class PubServer(BaseHTTPRequestHandler):
bold_reading = False bold_reading = False
if self.server.bold_reading.get(self.post_to_nickname): if self.server.bold_reading.get(self.post_to_nickname):
bold_reading = True bold_reading = True
minimize_all_images = False
if self.post_to_nickname in \
self.server.min_images_for_accounts:
minimize_all_images = True
individual_post_as_html(self.server.signing_priv_key_pem, individual_post_as_html(self.server.signing_priv_key_pem,
False, False,
self.server.recent_posts_cache, self.server.recent_posts_cache,
@ -9680,7 +9730,8 @@ class PubServer(BaseHTTPRequestHandler):
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) self.server.dogwhistles,
minimize_all_images)
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
@ -9866,6 +9917,10 @@ class PubServer(BaseHTTPRequestHandler):
bold_reading = False bold_reading = False
if self.server.bold_reading.get(self.post_to_nickname): if self.server.bold_reading.get(self.post_to_nickname):
bold_reading = True bold_reading = True
minimize_all_images = False
if self.post_to_nickname in \
self.server.min_images_for_accounts:
minimize_all_images = True
individual_post_as_html(self.server.signing_priv_key_pem, individual_post_as_html(self.server.signing_priv_key_pem,
False, False,
self.server.recent_posts_cache, self.server.recent_posts_cache,
@ -9897,7 +9952,8 @@ class PubServer(BaseHTTPRequestHandler):
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) self.server.dogwhistles,
minimize_all_images)
else: else:
print('WARN: Emoji reaction post not found: ' + print('WARN: Emoji reaction post not found: ' +
reaction_post_filename) reaction_post_filename)
@ -10073,6 +10129,10 @@ class PubServer(BaseHTTPRequestHandler):
bold_reading = False bold_reading = False
if self.server.bold_reading.get(self.post_to_nickname): if self.server.bold_reading.get(self.post_to_nickname):
bold_reading = True bold_reading = True
minimize_all_images = False
if self.post_to_nickname in \
self.server.min_images_for_accounts:
minimize_all_images = True
individual_post_as_html(self.server.signing_priv_key_pem, individual_post_as_html(self.server.signing_priv_key_pem,
False, False,
self.server.recent_posts_cache, self.server.recent_posts_cache,
@ -10104,7 +10164,8 @@ class PubServer(BaseHTTPRequestHandler):
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) self.server.dogwhistles,
minimize_all_images)
else: else:
print('WARN: Unreaction post not found: ' + print('WARN: Unreaction post not found: ' +
reaction_post_filename) reaction_post_filename)
@ -10210,7 +10271,8 @@ class PubServer(BaseHTTPRequestHandler):
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) self.server.dogwhistles,
self.server.min_images_for_accounts)
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,
@ -10324,6 +10386,10 @@ class PubServer(BaseHTTPRequestHandler):
bold_reading = False bold_reading = False
if self.server.bold_reading.get(self.post_to_nickname): if self.server.bold_reading.get(self.post_to_nickname):
bold_reading = True bold_reading = True
minimize_all_images = False
if self.post_to_nickname in \
self.server.min_images_for_accounts:
minimize_all_images = True
individual_post_as_html(self.server.signing_priv_key_pem, individual_post_as_html(self.server.signing_priv_key_pem,
False, False,
self.server.recent_posts_cache, self.server.recent_posts_cache,
@ -10355,7 +10421,8 @@ class PubServer(BaseHTTPRequestHandler):
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) self.server.dogwhistles,
minimize_all_images)
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,
@ -10476,6 +10543,10 @@ class PubServer(BaseHTTPRequestHandler):
bold_reading = False bold_reading = False
if self.server.bold_reading.get(self.post_to_nickname): if self.server.bold_reading.get(self.post_to_nickname):
bold_reading = True bold_reading = True
minimize_all_images = False
if self.post_to_nickname in \
self.server.min_images_for_accounts:
minimize_all_images = True
individual_post_as_html(self.server.signing_priv_key_pem, individual_post_as_html(self.server.signing_priv_key_pem,
False, False,
self.server.recent_posts_cache, self.server.recent_posts_cache,
@ -10507,7 +10578,8 @@ class PubServer(BaseHTTPRequestHandler):
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) self.server.dogwhistles,
minimize_all_images)
else: else:
print('WARN: Unbookmarked post not found: ' + print('WARN: Unbookmarked post not found: ' +
bookmark_filename) bookmark_filename)
@ -10618,7 +10690,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,
self.server.dogwhistles) self.server.dogwhistles,
self.server.min_images_for_accounts)
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,
@ -10714,6 +10787,9 @@ class PubServer(BaseHTTPRequestHandler):
bold_reading = False bold_reading = False
if self.server.bold_reading.get(nickname): if self.server.bold_reading.get(nickname):
bold_reading = True bold_reading = True
minimize_all_images = False
if nickname in self.server.min_images_for_accounts:
minimize_all_images = True
individual_post_as_html(self.server.signing_priv_key_pem, individual_post_as_html(self.server.signing_priv_key_pem,
allow_downloads, allow_downloads,
self.server.recent_posts_cache, self.server.recent_posts_cache,
@ -10746,7 +10822,8 @@ class PubServer(BaseHTTPRequestHandler):
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) self.server.dogwhistles,
minimize_all_images)
else: else:
print('WARN: Muted post not found: ' + mute_filename) print('WARN: Muted post not found: ' + mute_filename)
@ -10842,6 +10919,9 @@ class PubServer(BaseHTTPRequestHandler):
bold_reading = False bold_reading = False
if self.server.bold_reading.get(nickname): if self.server.bold_reading.get(nickname):
bold_reading = True bold_reading = True
minimize_all_images = False
if nickname in self.server.min_images_for_accounts:
minimize_all_images = True
individual_post_as_html(self.server.signing_priv_key_pem, individual_post_as_html(self.server.signing_priv_key_pem,
allow_downloads, allow_downloads,
self.server.recent_posts_cache, self.server.recent_posts_cache,
@ -10874,7 +10954,8 @@ class PubServer(BaseHTTPRequestHandler):
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) self.server.dogwhistles,
minimize_all_images)
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:
@ -11001,7 +11082,8 @@ class PubServer(BaseHTTPRequestHandler):
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) self.server.dogwhistles,
self.server.min_images_for_accounts)
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,
@ -11107,7 +11189,8 @@ class PubServer(BaseHTTPRequestHandler):
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) self.server.dogwhistles,
self.server.min_images_for_accounts)
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,
@ -11547,7 +11630,9 @@ 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, self.server.dogwhistles) bold_reading,
self.server.dogwhistles,
self.server.min_images_for_accounts)
if not msg: if not msg:
self._404() self._404()
return True return True
@ -11612,6 +11697,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled, self.server.lists_enabled,
'inbox', self.server.default_timeline, 'inbox', self.server.default_timeline,
bold_reading, self.server.dogwhistles, bold_reading, self.server.dogwhistles,
self.server.min_images_for_accounts,
'shares') 'shares')
if not msg: if not msg:
self._404() self._404()
@ -11700,7 +11786,8 @@ class PubServer(BaseHTTPRequestHandler):
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) self.server.dogwhistles,
self.server.min_images_for_accounts)
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,
@ -11972,7 +12059,8 @@ class PubServer(BaseHTTPRequestHandler):
bold_reading = False bold_reading = False
if self.server.bold_reading.get(nickname): if self.server.bold_reading.get(nickname):
bold_reading = True bold_reading = True
msg = html_inbox(default_timeline, msg = \
html_inbox(default_timeline,
recent_posts_cache, recent_posts_cache,
max_recent_posts, max_recent_posts,
translate, translate,
@ -12013,7 +12101,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled, self.server.lists_enabled,
timezone, bold_reading, timezone, bold_reading,
self.server.dogwhistles, self.server.dogwhistles,
ua_str) ua_str,
self.server.min_images_for_accounts)
if getreq_start_time: if getreq_start_time:
fitness_performance(getreq_start_time, fitness_performance(getreq_start_time,
self.server.fitness, self.server.fitness,
@ -12184,7 +12273,8 @@ class PubServer(BaseHTTPRequestHandler):
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, ua_str) self.server.dogwhistles, ua_str,
self.server.min_images_for_accounts)
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,
@ -12346,7 +12436,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled, self.server.lists_enabled,
timezone, bold_reading, timezone, bold_reading,
self.server.dogwhistles, self.server.dogwhistles,
ua_str) ua_str,
self.server.min_images_for_accounts)
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,
@ -12504,7 +12595,8 @@ class PubServer(BaseHTTPRequestHandler):
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, ua_str) self.server.dogwhistles, ua_str,
self.server.min_images_for_accounts)
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,
@ -12662,7 +12754,8 @@ class PubServer(BaseHTTPRequestHandler):
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, ua_str) self.server.dogwhistles, ua_str,
self.server.min_images_for_accounts)
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,
@ -12828,7 +12921,8 @@ class PubServer(BaseHTTPRequestHandler):
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, ua_str) self.server.dogwhistles, ua_str,
self.server.min_images_for_accounts)
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,
@ -12954,6 +13048,8 @@ class PubServer(BaseHTTPRequestHandler):
bold_reading = False bold_reading = False
if self.server.bold_reading.get(nickname): if self.server.bold_reading.get(nickname):
bold_reading = True bold_reading = True
min_images_for_accounts = \
self.server.min_images_for_accounts
msg = \ msg = \
html_inbox_features(self.server.default_timeline, html_inbox_features(self.server.default_timeline,
self.server.recent_posts_cache, self.server.recent_posts_cache,
@ -12996,7 +13092,8 @@ class PubServer(BaseHTTPRequestHandler):
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, ua_str) self.server.dogwhistles, ua_str,
min_images_for_accounts)
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,
@ -13117,7 +13214,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, timezone, self.server.lists_enabled, timezone,
bold_reading, self.server.dogwhistles, bold_reading, self.server.dogwhistles,
ua_str) ua_str,
self.server.min_images_for_accounts)
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,
@ -13211,7 +13309,8 @@ class PubServer(BaseHTTPRequestHandler):
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, ua_str) self.server.dogwhistles, ua_str,
self.server.min_images_for_accounts)
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,
@ -13346,7 +13445,8 @@ class PubServer(BaseHTTPRequestHandler):
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, ua_str) self.server.dogwhistles, ua_str,
self.server.min_images_for_accounts)
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,
@ -13499,7 +13599,8 @@ class PubServer(BaseHTTPRequestHandler):
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, ua_str) self.server.dogwhistles, ua_str,
self.server.min_images_for_accounts)
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,
@ -13606,6 +13707,8 @@ class PubServer(BaseHTTPRequestHandler):
bold_reading = False bold_reading = False
if self.server.bold_reading.get(nickname): if self.server.bold_reading.get(nickname):
bold_reading = True bold_reading = True
min_images_for_accounts = \
self.server.min_images_for_accounts
msg = \ msg = \
html_moderation(self.server.default_timeline, html_moderation(self.server.default_timeline,
self.server.recent_posts_cache, self.server.recent_posts_cache,
@ -13647,7 +13750,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled, self.server.lists_enabled,
timezone, bold_reading, timezone, bold_reading,
self.server.dogwhistles, self.server.dogwhistles,
ua_str) ua_str,
min_images_for_accounts)
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,
@ -14998,7 +15102,8 @@ class PubServer(BaseHTTPRequestHandler):
if self.server.bold_reading.get(nickname): if self.server.bold_reading.get(nickname):
bold_reading = True bold_reading = True
msg = html_new_post(media_instance, msg = \
html_new_post(media_instance,
translate, translate,
base_dir, base_dir,
http_prefix, http_prefix,
@ -15036,11 +15141,13 @@ class PubServer(BaseHTTPRequestHandler):
self.server.default_timeline, self.server.default_timeline,
reply_is_chat, reply_is_chat,
bold_reading, bold_reading,
self.server.dogwhistles).encode('utf-8') self.server.dogwhistles,
self.server.min_images_for_accounts)
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()
return True return True
msg = msg.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)
@ -15111,7 +15218,8 @@ class PubServer(BaseHTTPRequestHandler):
default_reply_interval_hrs, default_reply_interval_hrs,
self.server.cw_lists, self.server.cw_lists,
self.server.lists_enabled, self.server.lists_enabled,
self.server.system_language) self.server.system_language,
self.server.min_images_for_accounts)
if msg: if msg:
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
@ -21247,6 +21355,9 @@ def run_daemon(map_format: str,
# scan the theme directory for any svg files containing scripts # scan the theme directory for any svg files containing scripts
assert not scan_themes_for_scripts(base_dir) assert not scan_themes_for_scripts(base_dir)
# which accounts should minimize all attached images by default
httpd.min_images_for_accounts = load_min_images_for_accounts(base_dir)
# caches css files # caches css files
httpd.css_cache = {} httpd.css_cache = {}

File diff suppressed because one or more lines are too long

BIN
emoji/00.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
emoji/0000.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
emoji/001.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
emoji/0010.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
emoji/0020.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
emoji/0030.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

BIN
emoji/0040.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
emoji/0050.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
emoji/0060.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
emoji/007_dog.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

BIN
emoji/0080.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
emoji/0090.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
emoji/0100.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
emoji/0110.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 973 B

BIN
emoji/0140.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
emoji/0150.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
emoji/0160.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
emoji/0170.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
emoji/0171.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
emoji/0180.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
emoji/0181.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
emoji/0190.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
emoji/0200.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
emoji/0230.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
emoji/0240.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
emoji/0250.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
emoji/0260.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
emoji/0280.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
emoji/02smug.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
emoji/0300.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
emoji/0310.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
emoji/0320.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
emoji/0330.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
emoji/0331.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
emoji/0340.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
emoji/0350.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
emoji/0360.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
emoji/0390.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
emoji/0410.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
emoji/0420.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
emoji/0430.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
emoji/0450.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
emoji/0460.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
emoji/0461.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 835 B

BIN
emoji/0470.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
emoji/0480.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
emoji/0490.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
emoji/0510.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
emoji/0520.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
emoji/0530.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
emoji/0540.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
emoji/0550.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
emoji/0560.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
emoji/0590.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
emoji/0600.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
emoji/0_goose.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
emoji/0b08.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
emoji/0b12.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
emoji/0b16.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
emoji/0b19.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
emoji/100_queer.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
emoji/1020.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
emoji/1080.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
emoji/11111.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
emoji/11116.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
emoji/11117.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
emoji/11118.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
emoji/11135.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
emoji/11137.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
emoji/11138.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
emoji/1up.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

BIN
emoji/2040.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 558 B

BIN
emoji/231111.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
emoji/2323234.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
emoji/232327.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
emoji/23235.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
emoji/3020.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
emoji/3040.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
emoji/420leaf.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
emoji/4chan.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
emoji/69.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
emoji/7051.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
emoji/7062.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
emoji/7pay.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
emoji/808.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
emoji/8chan.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
emoji/9gag.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
emoji/AAAAAA.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Some files were not shown because too many files have changed in this diff Show More