mirror of https://gitlab.com/bashrc2/epicyon
Add cache for automatic content warnings
parent
04975770f5
commit
5ff61bab0e
|
@ -2269,12 +2269,17 @@ def _load_auto_cw(base_dir: str, nickname: str, domain: str) -> []:
|
|||
|
||||
|
||||
def add_auto_cw(base_dir: str, nickname: str, domain: str,
|
||||
subject: str, content: str) -> str:
|
||||
subject: str, content: str,
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Appends any automatic CW to the subject line
|
||||
and returns the new subject line
|
||||
"""
|
||||
new_subject = subject
|
||||
auto_cw_list = _load_auto_cw(base_dir, nickname, domain)
|
||||
if auto_cw_cache.get(nickname):
|
||||
auto_cw_list = auto_cw_cache[nickname]
|
||||
else:
|
||||
auto_cw_list = _load_auto_cw(base_dir, nickname, domain)
|
||||
auto_cw_cache[nickname] = auto_cw_list
|
||||
for cw_rule in auto_cw_list:
|
||||
if '->' not in cw_rule:
|
||||
continue
|
||||
|
|
201
daemon.py
201
daemon.py
|
@ -521,7 +521,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
cw_lists: {}, dogwhistles: {},
|
||||
min_images_for_accounts: [],
|
||||
max_hashtags: int,
|
||||
buy_sites: {}) -> None:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> None:
|
||||
"""When an edited post is created this assigns
|
||||
a published and updated date to it, and uses
|
||||
the previous id
|
||||
|
@ -569,7 +570,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
theme_name, max_like_count,
|
||||
cw_lists, dogwhistles,
|
||||
min_images_for_accounts,
|
||||
max_hashtags, buy_sites)
|
||||
max_hashtags, buy_sites,
|
||||
auto_cw_cache)
|
||||
|
||||
# update the index
|
||||
id_str = edited_postid.split('/')[-1]
|
||||
|
@ -757,7 +759,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
content_license_url, '',
|
||||
languages_understood, False,
|
||||
translate, buy_url,
|
||||
chat_url)
|
||||
chat_url,
|
||||
self.server.auto_cw_cache)
|
||||
if message_json:
|
||||
# NOTE: content and contentMap are not required, but we will keep
|
||||
# them in there so that the post does not get filtered out by
|
||||
|
@ -2078,7 +2081,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.sites_unavailable,
|
||||
self.server.max_recent_books,
|
||||
self.server.books_cache,
|
||||
self.server.max_cached_readers)
|
||||
self.server.max_cached_readers,
|
||||
self.server.auto_cw_cache)
|
||||
|
||||
def _get_outbox_thread_index(self, nickname: str,
|
||||
max_outbox_threads_per_account: int) -> int:
|
||||
|
@ -3520,7 +3524,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
min_images_for_accounts,
|
||||
self.server.buy_sites,
|
||||
max_shares_on_profile,
|
||||
self.server.no_of_books)
|
||||
self.server.no_of_books,
|
||||
self.server.auto_cw_cache)
|
||||
if profile_str:
|
||||
msg = profile_str.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
|
@ -3994,7 +3999,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.min_images_for_accounts,
|
||||
None, None, default_post_language,
|
||||
self.server.buy_sites,
|
||||
default_buy_site)
|
||||
default_buy_site,
|
||||
self.server.auto_cw_cache)
|
||||
if msg:
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
|
@ -4157,7 +4163,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.min_images_for_accounts,
|
||||
None, None, default_post_language,
|
||||
self.server.buy_sites,
|
||||
default_buy_site)
|
||||
default_buy_site,
|
||||
self.server.auto_cw_cache)
|
||||
if msg:
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
|
@ -4848,7 +4855,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.access_keys,
|
||||
'search',
|
||||
self.server.min_images_for_accounts,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
if hashtag_str:
|
||||
msg = hashtag_str.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
|
@ -4960,7 +4968,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.dogwhistles,
|
||||
self.server.access_keys,
|
||||
self.server.min_images_for_accounts,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
if history_str:
|
||||
msg = history_str.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
|
@ -5044,7 +5053,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.dogwhistles,
|
||||
self.server.access_keys,
|
||||
self.server.min_images_for_accounts,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
if bookmarks_str:
|
||||
msg = bookmarks_str.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
|
@ -5234,7 +5244,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
min_images_for_accounts,
|
||||
self.server.buy_sites,
|
||||
max_shares_on_profile,
|
||||
self.server.no_of_books)
|
||||
self.server.no_of_books,
|
||||
self.server.auto_cw_cache)
|
||||
if profile_str:
|
||||
msg = profile_str.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
|
@ -8439,6 +8450,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
except OSError:
|
||||
print('EX: unable to write auto CW ' +
|
||||
auto_cw_filename)
|
||||
self.server.auto_cw_cache[nickname] = \
|
||||
fields['autoCW'].split('\n')
|
||||
else:
|
||||
if os.path.isfile(auto_cw_filename):
|
||||
try:
|
||||
|
@ -8447,6 +8460,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
print('EX: _profile_edit ' +
|
||||
'unable to delete ' +
|
||||
auto_cw_filename)
|
||||
self.server.auto_cw_cache[nickname] = []
|
||||
|
||||
# save blocked accounts list
|
||||
if fields.get('blocked'):
|
||||
|
@ -9942,7 +9956,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.access_keys,
|
||||
'search',
|
||||
self.server.min_images_for_accounts,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
if hashtag_str:
|
||||
msg = hashtag_str.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
|
@ -10265,7 +10280,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
timezone, mitm, bold_reading,
|
||||
self.server.dogwhistles,
|
||||
minimize_all_images, None,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
|
||||
actor_absolute = \
|
||||
self._get_instance_url(calling_domain) + \
|
||||
|
@ -10844,7 +10860,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
timezone, mitm, bold_reading,
|
||||
self.server.dogwhistles,
|
||||
minimize_all_images, None,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
else:
|
||||
print('WARN: Liked post not found: ' + liked_post_filename)
|
||||
# clear the icon from the cache so that it gets updated
|
||||
|
@ -11051,7 +11068,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
timezone, mitm, bold_reading,
|
||||
self.server.dogwhistles,
|
||||
minimize_all_images, None,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
else:
|
||||
print('WARN: Unliked post not found: ' + liked_post_filename)
|
||||
# clear the icon from the cache so that it gets updated
|
||||
|
@ -11287,7 +11305,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
timezone, mitm, bold_reading,
|
||||
self.server.dogwhistles,
|
||||
minimize_all_images, None,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
else:
|
||||
print('WARN: Emoji reaction post not found: ' +
|
||||
reaction_post_filename)
|
||||
|
@ -11513,7 +11532,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
timezone, mitm, bold_reading,
|
||||
self.server.dogwhistles,
|
||||
minimize_all_images, None,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
else:
|
||||
print('WARN: Unreaction post not found: ' +
|
||||
reaction_post_filename)
|
||||
|
@ -11625,7 +11645,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
timezone, bold_reading,
|
||||
self.server.dogwhistles,
|
||||
self.server.min_images_for_accounts,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
|
@ -11785,7 +11806,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
timezone, mitm, bold_reading,
|
||||
self.server.dogwhistles,
|
||||
minimize_all_images, None,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
else:
|
||||
print('WARN: Bookmarked post not found: ' + bookmark_filename)
|
||||
# self._post_to_outbox(bookmark_json,
|
||||
|
@ -11956,7 +11978,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
timezone, mitm, bold_reading,
|
||||
self.server.dogwhistles,
|
||||
minimize_all_images, None,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
else:
|
||||
print('WARN: Unbookmarked post not found: ' +
|
||||
bookmark_filename)
|
||||
|
@ -12073,7 +12096,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.lists_enabled,
|
||||
self.server.dogwhistles,
|
||||
self.server.min_images_for_accounts,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
if delete_str:
|
||||
delete_str_len = len(delete_str)
|
||||
self._set_headers('text/html', delete_str_len,
|
||||
|
@ -12215,7 +12239,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
timezone, mitm, bold_reading,
|
||||
self.server.dogwhistles,
|
||||
minimize_all_images, None,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
else:
|
||||
print('WARN: Muted post not found: ' + mute_filename)
|
||||
|
||||
|
@ -12360,7 +12385,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
timezone, mitm, bold_reading,
|
||||
self.server.dogwhistles,
|
||||
minimize_all_images, None,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
else:
|
||||
print('WARN: Unmuted post not found: ' + mute_filename)
|
||||
if calling_domain.endswith('.onion') and onion_domain:
|
||||
|
@ -12492,7 +12518,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
timezone, bold_reading,
|
||||
self.server.dogwhistles,
|
||||
self.server.min_images_for_accounts,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
|
@ -12607,7 +12634,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
timezone, bold_reading,
|
||||
self.server.dogwhistles,
|
||||
self.server.min_images_for_accounts,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
|
@ -12731,7 +12759,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.buy_sites, None,
|
||||
self.server.max_shares_on_profile,
|
||||
self.server.sites_unavailable,
|
||||
self.server.no_of_books)
|
||||
self.server.no_of_books,
|
||||
self.server.auto_cw_cache)
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
|
@ -12864,7 +12893,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
None,
|
||||
max_shares_on_profile,
|
||||
self.server.sites_unavailable,
|
||||
self.server.no_of_books)
|
||||
self.server.no_of_books,
|
||||
self.server.auto_cw_cache)
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
|
@ -12968,7 +12998,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.min_images_for_accounts,
|
||||
self.server.debug,
|
||||
self.server.buy_sites,
|
||||
self.server.blocked_cache)
|
||||
self.server.blocked_cache,
|
||||
self.server.auto_cw_cache)
|
||||
if conv_str:
|
||||
msg = conv_str.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
|
@ -13137,7 +13168,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
bold_reading,
|
||||
self.server.dogwhistles,
|
||||
self.server.min_images_for_accounts,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
if not msg:
|
||||
self._404()
|
||||
return True
|
||||
|
@ -13204,6 +13236,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
bold_reading, self.server.dogwhistles,
|
||||
self.server.min_images_for_accounts,
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache,
|
||||
'shares')
|
||||
if not msg:
|
||||
self._404()
|
||||
|
@ -13294,7 +13327,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
timezone, mitm, bold_reading,
|
||||
self.server.dogwhistles,
|
||||
self.server.min_images_for_accounts,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
|
@ -13621,7 +13655,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
ua_str,
|
||||
self.server.min_images_for_accounts,
|
||||
reverse_sequence, last_post_id,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
if getreq_start_time:
|
||||
fitness_performance(getreq_start_time,
|
||||
self.server.fitness,
|
||||
|
@ -13805,7 +13840,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.dogwhistles, ua_str,
|
||||
self.server.min_images_for_accounts,
|
||||
reverse_sequence, last_post_id,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
|
@ -13980,7 +14016,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
ua_str,
|
||||
self.server.min_images_for_accounts,
|
||||
reverse_sequence, last_post_id,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
|
@ -14151,7 +14188,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.dogwhistles, ua_str,
|
||||
self.server.min_images_for_accounts,
|
||||
reverse_sequence, last_post_id,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
|
@ -14322,7 +14360,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.dogwhistles, ua_str,
|
||||
self.server.min_images_for_accounts,
|
||||
reverse_sequence, last_post_id,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
|
@ -14496,7 +14535,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.dogwhistles, ua_str,
|
||||
self.server.min_images_for_accounts,
|
||||
reverse_sequence,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
|
@ -14674,7 +14714,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.dogwhistles, ua_str,
|
||||
min_images_for_accounts,
|
||||
reverse_sequence,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
|
@ -14803,7 +14844,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
ua_str,
|
||||
self.server.min_images_for_accounts,
|
||||
reverse_sequence,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
|
@ -14905,7 +14947,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.dogwhistles, ua_str,
|
||||
self.server.min_images_for_accounts,
|
||||
reverse_sequence,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
|
@ -15048,7 +15091,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.dogwhistles, ua_str,
|
||||
self.server.min_images_for_accounts,
|
||||
reverse_sequence,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
|
@ -15209,7 +15253,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.dogwhistles, ua_str,
|
||||
self.server.min_images_for_accounts,
|
||||
reverse_sequence,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
|
@ -15367,7 +15412,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
ua_str,
|
||||
min_images_for_accounts,
|
||||
reverse_sequence,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
|
@ -15516,7 +15562,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
None,
|
||||
self.server.max_shares_on_profile,
|
||||
self.server.sites_unavailable,
|
||||
self.server.no_of_books)
|
||||
self.server.no_of_books,
|
||||
self.server.auto_cw_cache)
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
|
@ -15670,7 +15717,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
None,
|
||||
max_shares_on_profile,
|
||||
sites_unavailable,
|
||||
self.server.no_of_books).encode('utf-8')
|
||||
self.server.no_of_books,
|
||||
self.server.auto_cw_cache).encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html',
|
||||
msglen, cookie, calling_domain, False)
|
||||
|
@ -15823,7 +15871,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
None,
|
||||
max_shares_on_profile,
|
||||
sites_unavailable,
|
||||
self.server.no_of_books).encode('utf-8')
|
||||
self.server.no_of_books,
|
||||
self.server.auto_cw_cache).encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html',
|
||||
msglen, cookie, calling_domain, False)
|
||||
|
@ -15974,7 +16023,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
None,
|
||||
max_shares_on_profile,
|
||||
sites_unavailable,
|
||||
self.server.no_of_books).encode('utf-8')
|
||||
self.server.no_of_books,
|
||||
self.server.auto_cw_cache).encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html',
|
||||
msglen, cookie, calling_domain, False)
|
||||
|
@ -16127,7 +16177,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
None,
|
||||
max_shares_on_profile,
|
||||
sites_unavailable,
|
||||
self.server.no_of_books).encode('utf-8')
|
||||
self.server.no_of_books,
|
||||
self.server.auto_cw_cache).encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
cookie, calling_domain, False)
|
||||
|
@ -16310,7 +16361,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
None,
|
||||
max_shares_on_profile,
|
||||
sites_unavailable,
|
||||
self.server.no_of_books).encode('utf-8')
|
||||
self.server.no_of_books,
|
||||
self.server.auto_cw_cache).encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
cookie, calling_domain, False)
|
||||
|
@ -17140,7 +17192,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
new_post_month, new_post_year,
|
||||
default_post_language,
|
||||
self.server.buy_sites,
|
||||
default_buy_site)
|
||||
default_buy_site,
|
||||
self.server.auto_cw_cache)
|
||||
if not msg:
|
||||
print('Error replying to ' + in_reply_to_url)
|
||||
self._404()
|
||||
|
@ -19875,7 +19928,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.dogwhistles,
|
||||
self.server.min_images_for_accounts,
|
||||
self.server.debug,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
if msg:
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
|
@ -21995,7 +22049,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
media_license_url, media_creator,
|
||||
languages_understood,
|
||||
self.server.translate, buy_url,
|
||||
chat_url)
|
||||
chat_url,
|
||||
self.server.auto_cw_cache)
|
||||
if message_json:
|
||||
if edited_postid:
|
||||
recent_posts_cache = self.server.recent_posts_cache
|
||||
|
@ -22043,7 +22098,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.dogwhistles,
|
||||
min_images_for_accounts,
|
||||
self.server.max_hashtags,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
print('DEBUG: sending edited public post ' +
|
||||
str(message_json))
|
||||
if fields['schedulePost']:
|
||||
|
@ -22344,7 +22400,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
media_license_url, media_creator,
|
||||
languages_understood,
|
||||
self.server.translate, buy_url,
|
||||
chat_url)
|
||||
chat_url,
|
||||
self.server.auto_cw_cache)
|
||||
if message_json:
|
||||
if edited_postid:
|
||||
recent_posts_cache = self.server.recent_posts_cache
|
||||
|
@ -22392,7 +22449,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.dogwhistles,
|
||||
min_images_for_accounts,
|
||||
self.server.max_hashtags,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
print('DEBUG: sending edited unlisted post ' +
|
||||
str(message_json))
|
||||
|
||||
|
@ -22471,7 +22529,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
media_creator,
|
||||
languages_understood,
|
||||
self.server.translate,
|
||||
buy_url, chat_url)
|
||||
buy_url, chat_url,
|
||||
self.server.auto_cw_cache)
|
||||
if message_json:
|
||||
if edited_postid:
|
||||
recent_posts_cache = self.server.recent_posts_cache
|
||||
|
@ -22519,7 +22578,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.dogwhistles,
|
||||
min_images_for_accounts,
|
||||
self.server.max_hashtags,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
print('DEBUG: sending edited followers post ' +
|
||||
str(message_json))
|
||||
|
||||
|
@ -22611,7 +22671,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
languages_understood,
|
||||
reply_is_chat,
|
||||
self.server.translate,
|
||||
buy_url, chat_url)
|
||||
buy_url, chat_url,
|
||||
self.server.auto_cw_cache)
|
||||
if message_json:
|
||||
print('DEBUG: posting DM edited_postid ' +
|
||||
str(edited_postid))
|
||||
|
@ -22661,7 +22722,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.dogwhistles,
|
||||
min_images_for_accounts,
|
||||
self.server.max_hashtags,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
print('DEBUG: sending edited dm post ' +
|
||||
str(message_json))
|
||||
|
||||
|
@ -22743,7 +22805,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
media_creator,
|
||||
languages_understood,
|
||||
False, self.server.translate,
|
||||
buy_url, chat_url)
|
||||
buy_url, chat_url,
|
||||
self.server.auto_cw_cache)
|
||||
if message_json:
|
||||
if fields['schedulePost']:
|
||||
return 1
|
||||
|
@ -22796,7 +22859,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.dogwhistles,
|
||||
min_images_for_accounts,
|
||||
self.server.max_hashtags,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
print('DEBUG: sending edited reminder post ' +
|
||||
str(message_json))
|
||||
if self._post_to_outbox(message_json,
|
||||
|
@ -22852,7 +22916,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood,
|
||||
self.server.translate)
|
||||
self.server.translate,
|
||||
self.server.auto_cw_cache)
|
||||
if message_json:
|
||||
if self._post_to_outbox(message_json,
|
||||
self.server.project_version,
|
||||
|
@ -22919,7 +22984,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood,
|
||||
self.server.translate)
|
||||
self.server.translate,
|
||||
self.server.auto_cw_cache)
|
||||
if message_json:
|
||||
if self.server.debug:
|
||||
print('DEBUG: new Question')
|
||||
|
@ -22974,7 +23040,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.base_dir,
|
||||
nickname, self.server.domain)
|
||||
msg_str = fields['readingupdatetype']
|
||||
# TODO reading status
|
||||
# reading status
|
||||
message_json = \
|
||||
create_reading_post(self.server.base_dir,
|
||||
nickname,
|
||||
|
@ -23003,7 +23069,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
media_license_url, media_creator,
|
||||
languages_understood,
|
||||
self.server.translate, buy_url,
|
||||
chat_url)
|
||||
chat_url,
|
||||
self.server.auto_cw_cache)
|
||||
if message_json:
|
||||
if edited_postid:
|
||||
recent_posts_cache = self.server.recent_posts_cache
|
||||
|
@ -23051,7 +23118,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.dogwhistles,
|
||||
min_images_for_accounts,
|
||||
self.server.max_hashtags,
|
||||
self.server.buy_sites)
|
||||
self.server.buy_sites,
|
||||
self.server.auto_cw_cache)
|
||||
print('DEBUG: sending edited reading status post ' +
|
||||
str(message_json))
|
||||
if fields['schedulePost']:
|
||||
|
@ -24474,6 +24542,9 @@ def run_daemon(no_of_books: int,
|
|||
httpd.max_recent_books = 1000
|
||||
httpd.max_cached_readers = 24
|
||||
|
||||
# cache for automatic content warnings
|
||||
httpd.auto_cw_cache = {}
|
||||
|
||||
# list of websites which are currently down
|
||||
httpd.sites_unavailable = load_unavailable_sites(base_dir)
|
||||
|
||||
|
|
|
@ -554,6 +554,7 @@ def _desktop_reply_to_post(session, post_id: str,
|
|||
buy_url = ''
|
||||
chat_url = ''
|
||||
video_transcript = None
|
||||
auto_cw_cache = {}
|
||||
_say_command(say_str, say_str, screenreader, system_language, espeak)
|
||||
if send_post_via_server(signing_priv_key_pem, __version__,
|
||||
base_dir, session, nickname, password,
|
||||
|
@ -568,7 +569,7 @@ def _desktop_reply_to_post(session, post_id: str,
|
|||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
event_date, event_time, event_end_time, location,
|
||||
translate, buy_url, chat_url,
|
||||
translate, buy_url, chat_url, auto_cw_cache,
|
||||
debug, post_id, post_id,
|
||||
conversation_id, subject) == 0:
|
||||
say_str = 'Reply sent'
|
||||
|
@ -635,6 +636,7 @@ def _desktop_new_post(session,
|
|||
buy_url = ''
|
||||
chat_url = ''
|
||||
video_transcript = None
|
||||
auto_cw_cache = {}
|
||||
_say_command(say_str, say_str, screenreader, system_language, espeak)
|
||||
if send_post_via_server(signing_priv_key_pem, __version__,
|
||||
base_dir, session, nickname, password,
|
||||
|
@ -648,7 +650,8 @@ def _desktop_new_post(session,
|
|||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
event_date, event_time, event_end_time, location,
|
||||
translate, buy_url, chat_url, debug, None, None,
|
||||
translate, buy_url, chat_url, auto_cw_cache,
|
||||
debug, None, None,
|
||||
conversation_id, subject) == 0:
|
||||
say_str = 'Post sent'
|
||||
else:
|
||||
|
@ -1404,6 +1407,7 @@ def _desktop_new_dm_base(session, to_handle: str,
|
|||
video_transcript = None
|
||||
|
||||
say_str = 'Sending'
|
||||
auto_cw_cache = {}
|
||||
_say_command(say_str, say_str, screenreader, system_language, espeak)
|
||||
if send_post_via_server(signing_priv_key_pem, __version__,
|
||||
base_dir, session, nickname, password,
|
||||
|
@ -1417,7 +1421,8 @@ def _desktop_new_dm_base(session, to_handle: str,
|
|||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
event_date, event_time, event_end_time, location,
|
||||
translate, buy_url, chat_url, debug, None, None,
|
||||
translate, buy_url, chat_url, auto_cw_cache,
|
||||
debug, None, None,
|
||||
conversation_id, subject) == 0:
|
||||
say_str = 'Direct message sent'
|
||||
else:
|
||||
|
|
28
epicyon.py
28
epicyon.py
|
@ -1788,6 +1788,7 @@ def _command_options() -> None:
|
|||
languages_understood = [argb.languages_understood]
|
||||
translate = {}
|
||||
video_transcript = None
|
||||
auto_cw_cache = {}
|
||||
|
||||
print('Sending post to ' + argb.sendto)
|
||||
send_post_via_server(signing_priv_key_pem, __version__,
|
||||
|
@ -1805,7 +1806,7 @@ def _command_options() -> None:
|
|||
argb.media_license_url, argb.media_creator,
|
||||
argb.eventDate, argb.eventTime, argb.eventEndTime,
|
||||
argb.eventLocation, translate, argb.buyUrl,
|
||||
argb.chatUrl, argb.debug,
|
||||
argb.chatUrl, auto_cw_cache, argb.debug,
|
||||
reply_to, reply_to, argb.conversationId, subject)
|
||||
for _ in range(10):
|
||||
# TODO detect send success/fail
|
||||
|
@ -3576,6 +3577,7 @@ def _command_options() -> None:
|
|||
translate = {}
|
||||
buy_url = ''
|
||||
chat_url = ''
|
||||
auto_cw_cache = {}
|
||||
test_video_transcript = ''
|
||||
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
|
@ -3593,7 +3595,8 @@ def _command_options() -> None:
|
|||
test_is_article, argb.language, conversation_id,
|
||||
low_bandwidth, argb.content_license_url,
|
||||
argb.media_license_url, argb.media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
"Zoiks!!!",
|
||||
test_save_to_file,
|
||||
|
@ -3609,7 +3612,8 @@ def _command_options() -> None:
|
|||
test_is_article, argb.language, conversation_id,
|
||||
low_bandwidth, argb.content_license_url,
|
||||
argb.media_license_url, argb.media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
"Hey scoob we need like a hundred more #milkshakes",
|
||||
test_save_to_file,
|
||||
|
@ -3625,7 +3629,8 @@ def _command_options() -> None:
|
|||
test_is_article, argb.language, conversation_id,
|
||||
low_bandwidth, argb.content_license_url,
|
||||
argb.media_license_url, argb.media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
"Getting kinda spooky around here",
|
||||
test_save_to_file,
|
||||
|
@ -3641,7 +3646,8 @@ def _command_options() -> None:
|
|||
test_is_article, argb.language, conversation_id,
|
||||
low_bandwidth, argb.content_license_url,
|
||||
argb.media_license_url, argb.media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
"And they would have gotten away with it too" +
|
||||
"if it wasn't for those pesky hackers",
|
||||
|
@ -3658,7 +3664,8 @@ def _command_options() -> None:
|
|||
test_is_article, argb.language, conversation_id,
|
||||
low_bandwidth, argb.content_license_url,
|
||||
argb.media_license_url, argb.media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
"man these centralized sites are like the worst!",
|
||||
test_save_to_file,
|
||||
|
@ -3674,7 +3681,8 @@ def _command_options() -> None:
|
|||
test_is_article, argb.language, conversation_id,
|
||||
low_bandwidth, argb.content_license_url,
|
||||
argb.media_license_url, argb.media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
"another mystery solved #test",
|
||||
test_save_to_file,
|
||||
|
@ -3690,7 +3698,8 @@ def _command_options() -> None:
|
|||
test_is_article, argb.language, conversation_id,
|
||||
low_bandwidth, argb.content_license_url,
|
||||
argb.media_license_url, argb.media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
"let's go bowling",
|
||||
test_save_to_file,
|
||||
|
@ -3706,7 +3715,8 @@ def _command_options() -> None:
|
|||
test_is_article, argb.language, conversation_id,
|
||||
low_bandwidth, argb.content_license_url,
|
||||
argb.media_license_url, argb.media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
domain_full = domain + ':' + str(port)
|
||||
clear_follows(base_dir, nickname, domain)
|
||||
follow_person(base_dir, nickname, domain, 'maxboardroom', domain_full,
|
||||
|
|
95
inbox.py
95
inbox.py
|
@ -474,7 +474,8 @@ def _inbox_store_post_to_html_cache(recent_posts_cache: {},
|
|||
bold_reading: bool,
|
||||
dogwhistles: {},
|
||||
min_images_for_accounts: [],
|
||||
buy_sites: {}) -> None:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> None:
|
||||
"""Converts the json post into html and stores it in a cache
|
||||
This enables the post to be quickly displayed later
|
||||
"""
|
||||
|
@ -504,7 +505,7 @@ def _inbox_store_post_to_html_cache(recent_posts_cache: {},
|
|||
not_dm, True, True, False, True, False,
|
||||
cw_lists, lists_enabled, timezone, mitm,
|
||||
bold_reading, dogwhistles, minimize_all_images,
|
||||
None, buy_sites)
|
||||
None, buy_sites, auto_cw_cache)
|
||||
|
||||
|
||||
def valid_inbox(base_dir: str, nickname: str, domain: str) -> bool:
|
||||
|
@ -1577,7 +1578,8 @@ def receive_edit_to_post(recent_posts_cache: {}, message_json: {},
|
|||
cw_lists: {}, dogwhistles: {},
|
||||
min_images_for_accounts: [],
|
||||
max_hashtags: int,
|
||||
buy_sites: {}) -> bool:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> bool:
|
||||
"""A post was edited
|
||||
"""
|
||||
if not has_object_dict(message_json):
|
||||
|
@ -1715,7 +1717,7 @@ def receive_edit_to_post(recent_posts_cache: {}, message_json: {},
|
|||
lists_enabled, timezone, mitm,
|
||||
bold_reading, dogwhistles,
|
||||
minimize_all_images, None,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
return True
|
||||
|
||||
|
||||
|
@ -1844,7 +1846,8 @@ def _receive_update_activity(recent_posts_cache: {}, session, base_dir: str,
|
|||
cw_lists: {}, dogwhistles: {},
|
||||
min_images_for_accounts: [],
|
||||
max_hashtags: int,
|
||||
buy_sites: {}) -> bool:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> bool:
|
||||
|
||||
"""Receives an Update activity within the POST section of HTTPServer
|
||||
"""
|
||||
|
@ -1889,7 +1892,8 @@ def _receive_update_activity(recent_posts_cache: {}, session, base_dir: str,
|
|||
theme_name, max_like_count,
|
||||
cw_lists, dogwhistles,
|
||||
min_images_for_accounts,
|
||||
max_hashtags, buy_sites):
|
||||
max_hashtags, buy_sites,
|
||||
auto_cw_cache):
|
||||
print('EDITPOST: received ' + message_json['object']['id'])
|
||||
return True
|
||||
else:
|
||||
|
@ -1942,7 +1946,8 @@ def _receive_like(recent_posts_cache: {},
|
|||
lists_enabled: str,
|
||||
bold_reading: bool, dogwhistles: {},
|
||||
min_images_for_accounts: [],
|
||||
buy_sites: {}) -> bool:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> bool:
|
||||
"""Receives a Like activity within the POST section of HTTPServer
|
||||
"""
|
||||
if message_json['type'] != 'Like':
|
||||
|
@ -2057,7 +2062,8 @@ def _receive_like(recent_posts_cache: {},
|
|||
False, True, False, cw_lists,
|
||||
lists_enabled, timezone, mitm,
|
||||
bold_reading, dogwhistles,
|
||||
minimize_all_images, None, buy_sites)
|
||||
minimize_all_images, None, buy_sites,
|
||||
auto_cw_cache)
|
||||
return True
|
||||
|
||||
|
||||
|
@ -2079,7 +2085,8 @@ def _receive_undo_like(recent_posts_cache: {},
|
|||
lists_enabled: str,
|
||||
bold_reading: bool, dogwhistles: {},
|
||||
min_images_for_accounts: [],
|
||||
buy_sites: {}) -> bool:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> bool:
|
||||
"""Receives an undo like activity within the POST section of HTTPServer
|
||||
"""
|
||||
if message_json['type'] != 'Undo':
|
||||
|
@ -2185,7 +2192,7 @@ def _receive_undo_like(recent_posts_cache: {},
|
|||
lists_enabled, timezone, mitm,
|
||||
bold_reading, dogwhistles,
|
||||
minimize_all_images, None,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
return True
|
||||
|
||||
|
||||
|
@ -2208,7 +2215,8 @@ def _receive_reaction(recent_posts_cache: {},
|
|||
lists_enabled: str, bold_reading: bool,
|
||||
dogwhistles: {},
|
||||
min_images_for_accounts: [],
|
||||
buy_sites: {}) -> bool:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> bool:
|
||||
"""Receives an emoji reaction within the POST section of HTTPServer
|
||||
"""
|
||||
if message_json['type'] != 'EmojiReact':
|
||||
|
@ -2344,7 +2352,8 @@ def _receive_reaction(recent_posts_cache: {},
|
|||
False, True, False, cw_lists,
|
||||
lists_enabled, timezone, mitm,
|
||||
bold_reading, dogwhistles,
|
||||
minimize_all_images, None, buy_sites)
|
||||
minimize_all_images, None, buy_sites,
|
||||
auto_cw_cache)
|
||||
return True
|
||||
|
||||
|
||||
|
@ -2367,7 +2376,8 @@ def _receive_zot_reaction(recent_posts_cache: {},
|
|||
lists_enabled: str, bold_reading: bool,
|
||||
dogwhistles: {},
|
||||
min_images_for_accounts: [],
|
||||
buy_sites: {}) -> bool:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> bool:
|
||||
"""Receives an zot-style emoji reaction within the POST section of
|
||||
HTTPServer A zot style emoji reaction is an ordinary reply Note whose
|
||||
content is exactly one emoji
|
||||
|
@ -2529,7 +2539,7 @@ def _receive_zot_reaction(recent_posts_cache: {},
|
|||
lists_enabled, timezone, mitm,
|
||||
bold_reading, dogwhistles,
|
||||
minimize_all_images, None,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
return True
|
||||
|
||||
|
||||
|
@ -2553,7 +2563,8 @@ def _receive_undo_reaction(recent_posts_cache: {},
|
|||
lists_enabled: str,
|
||||
bold_reading: bool, dogwhistles: {},
|
||||
min_images_for_accounts: [],
|
||||
buy_sites: {}) -> bool:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> bool:
|
||||
"""Receives an undo emoji reaction within the POST section of HTTPServer
|
||||
"""
|
||||
if message_json['type'] != 'Undo':
|
||||
|
@ -2677,7 +2688,7 @@ def _receive_undo_reaction(recent_posts_cache: {},
|
|||
lists_enabled, timezone, mitm,
|
||||
bold_reading, dogwhistles,
|
||||
minimize_all_images, None,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
return True
|
||||
|
||||
|
||||
|
@ -2698,7 +2709,8 @@ def _receive_bookmark(recent_posts_cache: {},
|
|||
lists_enabled: {}, bold_reading: bool,
|
||||
dogwhistles: {},
|
||||
min_images_for_accounts: [],
|
||||
buy_sites: {}) -> bool:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> bool:
|
||||
"""Receives a bookmark activity within the POST section of HTTPServer
|
||||
"""
|
||||
if not message_json.get('type'):
|
||||
|
@ -2802,7 +2814,7 @@ def _receive_bookmark(recent_posts_cache: {},
|
|||
lists_enabled, timezone, mitm,
|
||||
bold_reading, dogwhistles,
|
||||
minimize_all_images, None,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
return True
|
||||
|
||||
|
||||
|
@ -2825,7 +2837,8 @@ def _receive_undo_bookmark(recent_posts_cache: {},
|
|||
lists_enabled: str, bold_reading: bool,
|
||||
dogwhistles: {},
|
||||
min_images_for_accounts: [],
|
||||
buy_sites: {}) -> bool:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> bool:
|
||||
"""Receives an undo bookmark activity within the POST section of HTTPServer
|
||||
"""
|
||||
if not message_json.get('type'):
|
||||
|
@ -2930,7 +2943,7 @@ def _receive_undo_bookmark(recent_posts_cache: {},
|
|||
False, True, False, cw_lists, lists_enabled,
|
||||
timezone, mitm, bold_reading,
|
||||
dogwhistles, minimize_all_images, None,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
return True
|
||||
|
||||
|
||||
|
@ -3032,7 +3045,8 @@ def _receive_announce(recent_posts_cache: {},
|
|||
dogwhistles: {}, mitm: bool,
|
||||
min_images_for_accounts: [],
|
||||
buy_sites: {},
|
||||
languages_understood: []) -> bool:
|
||||
languages_understood: [],
|
||||
auto_cw_cache: {}) -> bool:
|
||||
"""Receives an announce activity within the POST section of HTTPServer
|
||||
"""
|
||||
if message_json['type'] != 'Announce':
|
||||
|
@ -3194,7 +3208,7 @@ def _receive_announce(recent_posts_cache: {},
|
|||
lists_enabled, timezone, mitm,
|
||||
bold_reading, dogwhistles,
|
||||
minimize_all_images, None,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
if not announce_html:
|
||||
print('WARN: Unable to generate html for announce ' +
|
||||
str(message_json))
|
||||
|
@ -4161,6 +4175,7 @@ def _bounce_dm(sender_post_id: str, session, http_prefix: str,
|
|||
low_bandwidth = False
|
||||
buy_url = ''
|
||||
chat_url = ''
|
||||
auto_cw_cache = {}
|
||||
post_json_object = \
|
||||
create_direct_message_post(base_dir, nickname, domain, port,
|
||||
http_prefix, content,
|
||||
|
@ -4175,7 +4190,8 @@ def _bounce_dm(sender_post_id: str, session, http_prefix: str,
|
|||
low_bandwidth, dm_license_url,
|
||||
dm_license_url, '',
|
||||
languages_understood, bounce_is_chat,
|
||||
translate, buy_url, chat_url)
|
||||
translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
if not post_json_object:
|
||||
print('WARN: unable to create bounce message to ' + sending_handle)
|
||||
return False
|
||||
|
@ -4343,7 +4359,8 @@ def _receive_question_vote(server, base_dir: str, nickname: str, domain: str,
|
|||
bold_reading: bool, dogwhistles: {},
|
||||
min_images_for_accounts: [],
|
||||
buy_sites: {},
|
||||
sites_unavailable: []) -> None:
|
||||
sites_unavailable: [],
|
||||
auto_cw_cache: {}) -> None:
|
||||
"""Updates the votes on a Question/poll
|
||||
"""
|
||||
# if this is a reply to a question then update the votes
|
||||
|
@ -4402,7 +4419,7 @@ def _receive_question_vote(server, base_dir: str, nickname: str, domain: str,
|
|||
lists_enabled, timezone, mitm,
|
||||
bold_reading, dogwhistles,
|
||||
minimize_all_images, None,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
|
||||
# add id to inbox index
|
||||
inbox_update_index('inbox', base_dir, handle,
|
||||
|
@ -4631,7 +4648,7 @@ def _inbox_after_initial(server, inbox_start_time,
|
|||
max_like_count, cw_lists, lists_enabled,
|
||||
bold_reading, dogwhistles,
|
||||
server.min_images_for_accounts,
|
||||
buy_sites):
|
||||
buy_sites, server.auto_cw_cache):
|
||||
if debug:
|
||||
print('DEBUG: Like accepted from ' + actor)
|
||||
fitness_performance(inbox_start_time, server.fitness,
|
||||
|
@ -4658,7 +4675,7 @@ def _inbox_after_initial(server, inbox_start_time,
|
|||
max_like_count, cw_lists, lists_enabled,
|
||||
bold_reading, dogwhistles,
|
||||
server.min_images_for_accounts,
|
||||
buy_sites):
|
||||
buy_sites, server.auto_cw_cache):
|
||||
if debug:
|
||||
print('DEBUG: Undo like accepted from ' + actor)
|
||||
fitness_performance(inbox_start_time, server.fitness,
|
||||
|
@ -4686,7 +4703,7 @@ def _inbox_after_initial(server, inbox_start_time,
|
|||
max_like_count, cw_lists, lists_enabled,
|
||||
bold_reading, dogwhistles,
|
||||
server.min_images_for_accounts,
|
||||
buy_sites):
|
||||
buy_sites, server.auto_cw_cache):
|
||||
if debug:
|
||||
print('DEBUG: Reaction accepted from ' + actor)
|
||||
fitness_performance(inbox_start_time, server.fitness,
|
||||
|
@ -4714,7 +4731,7 @@ def _inbox_after_initial(server, inbox_start_time,
|
|||
max_like_count, cw_lists, lists_enabled,
|
||||
bold_reading, dogwhistles,
|
||||
server.min_images_for_accounts,
|
||||
buy_sites):
|
||||
buy_sites, server.auto_cw_cache):
|
||||
if debug:
|
||||
print('DEBUG: Zot reaction accepted from ' + actor)
|
||||
fitness_performance(inbox_start_time, server.fitness,
|
||||
|
@ -4743,7 +4760,7 @@ def _inbox_after_initial(server, inbox_start_time,
|
|||
max_like_count, cw_lists, lists_enabled,
|
||||
bold_reading, dogwhistles,
|
||||
server.min_images_for_accounts,
|
||||
buy_sites):
|
||||
buy_sites, server.auto_cw_cache):
|
||||
if debug:
|
||||
print('DEBUG: Undo reaction accepted from ' + actor)
|
||||
fitness_performance(inbox_start_time, server.fitness,
|
||||
|
@ -4772,7 +4789,8 @@ def _inbox_after_initial(server, inbox_start_time,
|
|||
max_like_count, cw_lists, lists_enabled,
|
||||
bold_reading, dogwhistles,
|
||||
server.min_images_for_accounts,
|
||||
server.buy_sites):
|
||||
server.buy_sites,
|
||||
server.auto_cw_cache):
|
||||
if debug:
|
||||
print('DEBUG: Bookmark accepted from ' + actor)
|
||||
fitness_performance(inbox_start_time, server.fitness,
|
||||
|
@ -4801,7 +4819,8 @@ def _inbox_after_initial(server, inbox_start_time,
|
|||
max_like_count, cw_lists, lists_enabled,
|
||||
bold_reading, dogwhistles,
|
||||
server.min_images_for_accounts,
|
||||
server.buy_sites):
|
||||
server.buy_sites,
|
||||
server.auto_cw_cache):
|
||||
if debug:
|
||||
print('DEBUG: Undo bookmark accepted from ' + actor)
|
||||
fitness_performance(inbox_start_time, server.fitness,
|
||||
|
@ -4849,7 +4868,8 @@ def _inbox_after_initial(server, inbox_start_time,
|
|||
bold_reading, dogwhistles, mitm,
|
||||
server.min_images_for_accounts,
|
||||
server.buy_sites,
|
||||
languages_understood):
|
||||
languages_understood,
|
||||
server.auto_cw_cache):
|
||||
if debug:
|
||||
print('DEBUG: Announce accepted from ' + actor)
|
||||
fitness_performance(inbox_start_time, server.fitness,
|
||||
|
@ -4928,7 +4948,8 @@ def _inbox_after_initial(server, inbox_start_time,
|
|||
bold_reading, dogwhistles,
|
||||
server.min_images_for_accounts,
|
||||
server.buy_sites,
|
||||
server.sites_unavailable)
|
||||
server.sites_unavailable,
|
||||
server.auto_cw_cache)
|
||||
fitness_performance(inbox_start_time, server.fitness,
|
||||
'INBOX', '_receive_question_vote',
|
||||
debug)
|
||||
|
@ -5254,7 +5275,8 @@ def _inbox_after_initial(server, inbox_start_time,
|
|||
bold_reading,
|
||||
dogwhistles,
|
||||
min_img_for_accounts,
|
||||
buy_sites)
|
||||
buy_sites,
|
||||
server.auto_cw_cache)
|
||||
fitness_performance(inbox_start_time,
|
||||
server.fitness,
|
||||
'INBOX',
|
||||
|
@ -6398,7 +6420,8 @@ def run_inbox_queue(server,
|
|||
theme_name, max_like_count,
|
||||
cw_lists, dogwhistles,
|
||||
server.min_images_for_accounts,
|
||||
max_hashtags, server.buy_sites):
|
||||
max_hashtags, server.buy_sites,
|
||||
server.auto_cw_cache):
|
||||
if debug:
|
||||
print('Queue: Update accepted from ' + key_id)
|
||||
if os.path.isfile(queue_filename):
|
||||
|
|
|
@ -252,7 +252,8 @@ def post_message_to_outbox(session, translate: {},
|
|||
sites_unavailable: [],
|
||||
max_recent_books: int,
|
||||
books_cache: {},
|
||||
max_cached_readers: int) -> bool:
|
||||
max_cached_readers: int,
|
||||
auto_cw_cache: {}) -> bool:
|
||||
"""post is received by the outbox
|
||||
Client to server message post
|
||||
https://www.w3.org/TR/activitypub/#client-to-server-outbox-delivery
|
||||
|
@ -634,7 +635,7 @@ def post_message_to_outbox(session, translate: {},
|
|||
timezone, mitm,
|
||||
bold_reading, dogwhistles,
|
||||
minimize_all_images, None,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
|
||||
if is_edited_post:
|
||||
message_json['type'] = 'Update'
|
||||
|
|
60
posts.py
60
posts.py
|
@ -1644,12 +1644,14 @@ def _create_post_base(base_dir: str,
|
|||
content_license_url: str,
|
||||
media_license_url: str, media_creator: str,
|
||||
languages_understood: [], translate: {},
|
||||
buy_url: str, chat_url: str) -> {}:
|
||||
buy_url: str, chat_url: str,
|
||||
auto_cw_cache: {}) -> {}:
|
||||
"""Creates a message
|
||||
"""
|
||||
content = remove_invalid_chars(content)
|
||||
|
||||
subject = add_auto_cw(base_dir, nickname, domain, subject, content)
|
||||
subject = add_auto_cw(base_dir, nickname, domain, subject, content,
|
||||
auto_cw_cache)
|
||||
|
||||
if nickname != 'news':
|
||||
mentioned_recipients = \
|
||||
|
@ -2078,7 +2080,8 @@ def create_public_post(base_dir: str,
|
|||
content_license_url: str,
|
||||
media_license_url: str, media_creator: str,
|
||||
languages_understood: [], translate: {},
|
||||
buy_url: str, chat_url: str) -> {}:
|
||||
buy_url: str, chat_url: str,
|
||||
auto_cw_cache: {}) -> {}:
|
||||
"""Public post
|
||||
"""
|
||||
domain_full = get_full_domain(domain, port)
|
||||
|
@ -2114,7 +2117,7 @@ def create_public_post(base_dir: str,
|
|||
content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url,
|
||||
chat_url)
|
||||
chat_url, auto_cw_cache)
|
||||
|
||||
|
||||
def create_reading_post(base_dir: str,
|
||||
|
@ -2135,8 +2138,9 @@ def create_reading_post(base_dir: str,
|
|||
content_license_url: str,
|
||||
media_license_url: str, media_creator: str,
|
||||
languages_understood: [], translate: {},
|
||||
buy_url: str, chat_url: str) -> {}:
|
||||
""" TODO reading status post
|
||||
buy_url: str, chat_url: str,
|
||||
auto_cw_cache: {}) -> {}:
|
||||
""" reading status post
|
||||
"""
|
||||
content = ''
|
||||
if mentions_str:
|
||||
|
@ -2175,7 +2179,7 @@ def create_reading_post(base_dir: str,
|
|||
content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate,
|
||||
buy_url, chat_url)
|
||||
buy_url, chat_url, auto_cw_cache)
|
||||
if post_json_object:
|
||||
post_json_object['object']['tag'] = [{
|
||||
'href': book_url,
|
||||
|
@ -2230,6 +2234,7 @@ def create_blog_post(base_dir: str,
|
|||
media_license_url: str, media_creator: str,
|
||||
languages_understood: [], translate: {},
|
||||
buy_url: str, chat_url: str) -> {}:
|
||||
auto_cw_cache = {}
|
||||
blog_json = \
|
||||
create_public_post(base_dir,
|
||||
nickname, domain, port, http_prefix,
|
||||
|
@ -2243,7 +2248,8 @@ def create_blog_post(base_dir: str,
|
|||
True, system_language, conversation_id,
|
||||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
url_str = get_url_from_post(blog_json['object']['url'])
|
||||
obj_url = remove_html(url_str)
|
||||
if '/@/' not in obj_url:
|
||||
|
@ -2264,6 +2270,7 @@ def create_news_post(base_dir: str,
|
|||
media_license_url: str, media_creator: str,
|
||||
languages_understood: [], translate: {},
|
||||
buy_url: str, chat_url: str) -> {}:
|
||||
auto_cw_cache = {}
|
||||
client_to_server = False
|
||||
in_reply_to = None
|
||||
in_reply_to_atom_uri = None
|
||||
|
@ -2285,7 +2292,8 @@ def create_news_post(base_dir: str,
|
|||
True, system_language, conversation_id,
|
||||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
blog['object']['type'] = 'Article'
|
||||
return blog
|
||||
|
||||
|
@ -2302,7 +2310,8 @@ def create_question_post(base_dir: str,
|
|||
system_language: str, low_bandwidth: bool,
|
||||
content_license_url: str,
|
||||
media_license_url: str, media_creator: str,
|
||||
languages_understood: [], translate: {}) -> {}:
|
||||
languages_understood: [], translate: {},
|
||||
auto_cw_cache: {}) -> {}:
|
||||
"""Question post with multiple choice options
|
||||
"""
|
||||
domain_full = get_full_domain(domain, port)
|
||||
|
@ -2324,7 +2333,7 @@ def create_question_post(base_dir: str,
|
|||
None, low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url,
|
||||
chat_url)
|
||||
chat_url, auto_cw_cache)
|
||||
message_json['object']['type'] = 'Question'
|
||||
message_json['object']['oneOf'] = []
|
||||
message_json['object']['votersCount'] = 0
|
||||
|
@ -2362,7 +2371,8 @@ def create_unlisted_post(base_dir: str,
|
|||
content_license_url: str,
|
||||
media_license_url: str, media_creator: str,
|
||||
languages_understood: [], translate: {},
|
||||
buy_url: str, chat_url: str) -> {}:
|
||||
buy_url: str, chat_url: str,
|
||||
auto_cw_cache: {}) -> {}:
|
||||
"""Unlisted post. This has the #Public and followers links inverted.
|
||||
"""
|
||||
domain_full = get_full_domain(domain, port)
|
||||
|
@ -2384,7 +2394,7 @@ def create_unlisted_post(base_dir: str,
|
|||
content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate,
|
||||
buy_url, chat_url)
|
||||
buy_url, chat_url, auto_cw_cache)
|
||||
|
||||
|
||||
def create_followers_only_post(base_dir: str,
|
||||
|
@ -2405,7 +2415,8 @@ def create_followers_only_post(base_dir: str,
|
|||
media_license_url: str, media_creator: str,
|
||||
languages_understood: [],
|
||||
translate: {}, buy_url: str,
|
||||
chat_url: str) -> {}:
|
||||
chat_url: str,
|
||||
auto_cw_cache: {}) -> {}:
|
||||
"""Followers only post
|
||||
"""
|
||||
domain_full = get_full_domain(domain, port)
|
||||
|
@ -2425,7 +2436,7 @@ def create_followers_only_post(base_dir: str,
|
|||
content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate,
|
||||
buy_url, chat_url)
|
||||
buy_url, chat_url, auto_cw_cache)
|
||||
|
||||
|
||||
def get_mentioned_people(base_dir: str, http_prefix: str,
|
||||
|
@ -2484,7 +2495,8 @@ def create_direct_message_post(base_dir: str,
|
|||
media_license_url: str, media_creator: str,
|
||||
languages_understood: [],
|
||||
dm_is_chat: bool, translate: {},
|
||||
buy_url: str, chat_url: str) -> {}:
|
||||
buy_url: str, chat_url: str,
|
||||
auto_cw_cache: {}) -> {}:
|
||||
"""Direct Message post
|
||||
"""
|
||||
content = resolve_petnames(base_dir, nickname, domain, content)
|
||||
|
@ -2511,7 +2523,8 @@ def create_direct_message_post(base_dir: str,
|
|||
conversation_id, low_bandwidth,
|
||||
content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
# mentioned recipients go into To rather than Cc
|
||||
message_json['to'] = message_json['object']['cc']
|
||||
message_json['object']['to'] = message_json['to']
|
||||
|
@ -2536,7 +2549,8 @@ def create_report_post(base_dir: str,
|
|||
system_language: str, low_bandwidth: bool,
|
||||
content_license_url: str,
|
||||
media_license_url: str, media_creator: str,
|
||||
languages_understood: [], translate: {}) -> {}:
|
||||
languages_understood: [], translate: {},
|
||||
auto_cw_cache: {}) -> {}:
|
||||
"""Send a report to moderators
|
||||
"""
|
||||
domain_full = get_full_domain(domain, port)
|
||||
|
@ -2618,7 +2632,7 @@ def create_report_post(base_dir: str,
|
|||
None, low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate,
|
||||
buy_url, chat_url)
|
||||
buy_url, chat_url, auto_cw_cache)
|
||||
if not post_json_object:
|
||||
continue
|
||||
|
||||
|
@ -2829,6 +2843,7 @@ def send_post(signing_priv_key_pem: str, project_version: str,
|
|||
low_bandwidth: bool, content_license_url: str,
|
||||
media_license_url: str, media_creator: str,
|
||||
translate: {}, buy_url: str, chat_url: str,
|
||||
auto_cw_cache: {},
|
||||
debug: bool = False, in_reply_to: str = None,
|
||||
in_reply_to_atom_uri: str = None, subject: str = None) -> int:
|
||||
"""Post to another inbox. Used by unit tests.
|
||||
|
@ -2898,7 +2913,8 @@ def send_post(signing_priv_key_pem: str, project_version: str,
|
|||
content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood,
|
||||
translate, buy_url, chat_url)
|
||||
translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
|
||||
# get the senders private key
|
||||
private_key_pem = get_person_key(nickname, domain, base_dir, 'private')
|
||||
|
@ -3005,7 +3021,7 @@ def send_post_via_server(signing_priv_key_pem: str, project_version: str,
|
|||
media_license_url: str, media_creator: str,
|
||||
event_date: str, event_time: str, event_end_time: str,
|
||||
location: str, translate: {},
|
||||
buy_url: str, chat_url: str,
|
||||
buy_url: str, chat_url: str, auto_cw_cache: {},
|
||||
debug: bool = False,
|
||||
in_reply_to: str = None,
|
||||
in_reply_to_atom_uri: str = None,
|
||||
|
@ -3099,7 +3115,7 @@ def send_post_via_server(signing_priv_key_pem: str, project_version: str,
|
|||
content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood,
|
||||
translate, buy_url, chat_url)
|
||||
translate, buy_url, chat_url, auto_cw_cache)
|
||||
|
||||
auth_header = create_basic_auth_header(from_nickname, password)
|
||||
|
||||
|
|
|
@ -155,7 +155,8 @@ def _update_post_schedule(base_dir: str, handle: str, httpd,
|
|||
httpd.sites_unavailable,
|
||||
httpd.max_recent_books,
|
||||
httpd.books_cache,
|
||||
httpd.max_cached_readers):
|
||||
httpd.max_cached_readers,
|
||||
httpd.auto_cw_cache):
|
||||
index_lines.remove(line)
|
||||
try:
|
||||
os.remove(post_filename)
|
||||
|
|
59
tests.py
59
tests.py
|
@ -796,6 +796,7 @@ def create_server_alice(path: str, domain: str, port: int,
|
|||
media_creator = 'Mr Blobby'
|
||||
buy_url = ''
|
||||
chat_url = ''
|
||||
auto_cw_cache = {}
|
||||
test_video_transcript = ''
|
||||
create_public_post(path, nickname, domain, port, http_prefix,
|
||||
"No wise fish would go anywhere without a porpoise",
|
||||
|
@ -813,7 +814,8 @@ def create_server_alice(path: str, domain: str, port: int,
|
|||
test_is_article, system_language, conversation_id,
|
||||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
create_public_post(path, nickname, domain, port, http_prefix,
|
||||
"Curiouser and curiouser!",
|
||||
test_save_to_file,
|
||||
|
@ -830,7 +832,8 @@ def create_server_alice(path: str, domain: str, port: int,
|
|||
test_is_article, system_language, conversation_id,
|
||||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
create_public_post(path, nickname, domain, port, http_prefix,
|
||||
"In the gardens of memory, in the palace " +
|
||||
"of dreams, that is where you and I shall meet",
|
||||
|
@ -848,7 +851,8 @@ def create_server_alice(path: str, domain: str, port: int,
|
|||
test_is_article, system_language, conversation_id,
|
||||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
regenerate_index_for_box(path, nickname, domain, 'outbox')
|
||||
global TEST_SERVER_ALICE_RUNNING
|
||||
TEST_SERVER_ALICE_RUNNING = True
|
||||
|
@ -975,6 +979,7 @@ def create_server_bob(path: str, domain: str, port: int,
|
|||
translate = {}
|
||||
buy_url = ''
|
||||
chat_url = ''
|
||||
auto_cw_cache = {}
|
||||
test_video_transcript = ''
|
||||
create_public_post(path, nickname, domain, port, http_prefix,
|
||||
"It's your life, live it your way.",
|
||||
|
@ -992,7 +997,8 @@ def create_server_bob(path: str, domain: str, port: int,
|
|||
test_is_article, system_language, conversation_id,
|
||||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
create_public_post(path, nickname, domain, port, http_prefix,
|
||||
"One of the things I've realised is that " +
|
||||
"I am very simple",
|
||||
|
@ -1010,7 +1016,8 @@ def create_server_bob(path: str, domain: str, port: int,
|
|||
test_is_article, system_language, conversation_id,
|
||||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
create_public_post(path, nickname, domain, port, http_prefix,
|
||||
"Quantum physics is a bit of a passion of mine",
|
||||
test_save_to_file,
|
||||
|
@ -1027,7 +1034,8 @@ def create_server_bob(path: str, domain: str, port: int,
|
|||
test_is_article, system_language, conversation_id,
|
||||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
regenerate_index_for_box(path, nickname, domain, 'outbox')
|
||||
global TEST_SERVER_BOB_RUNNING
|
||||
TEST_SERVER_BOB_RUNNING = True
|
||||
|
@ -1386,6 +1394,7 @@ def test_post_message_between_servers(base_dir: str) -> None:
|
|||
translate = {}
|
||||
buy_url = ''
|
||||
chat_url = ''
|
||||
auto_cw_cache = {}
|
||||
send_result = \
|
||||
send_post(signing_priv_key_pem, __version__,
|
||||
session_alice, alice_dir, 'alice', alice_domain, alice_port,
|
||||
|
@ -1402,7 +1411,7 @@ def test_post_message_between_servers(base_dir: str) -> None:
|
|||
alice_shared_items_federated_domains,
|
||||
alice_shared_item_federation_tokens, low_bandwidth,
|
||||
content_license_url, media_license_url, media_creator,
|
||||
translate, buy_url, chat_url,
|
||||
translate, buy_url, chat_url, auto_cw_cache, True,
|
||||
in_reply_to, in_reply_to_atom_uri, subject)
|
||||
print('send_result: ' + str(send_result))
|
||||
|
||||
|
@ -1778,6 +1787,7 @@ def test_follow_between_servers(base_dir: str) -> None:
|
|||
buy_url = ''
|
||||
chat_url = ''
|
||||
video_transcript = None
|
||||
auto_cw_cache = {}
|
||||
send_result = \
|
||||
send_post(signing_priv_key_pem, __version__,
|
||||
session_alice, alice_dir, 'alice', alice_domain, alice_port,
|
||||
|
@ -1791,7 +1801,7 @@ def test_follow_between_servers(base_dir: str) -> None:
|
|||
alice_shared_items_federated_domains,
|
||||
alice_shared_item_federation_tokens, low_bandwidth,
|
||||
content_license_url, media_license_url, media_creator,
|
||||
translate, buy_url, chat_url,
|
||||
translate, buy_url, chat_url, auto_cw_cache, True,
|
||||
in_reply_to, in_reply_to_atom_uri, subject)
|
||||
print('send_result: ' + str(send_result))
|
||||
|
||||
|
@ -2174,6 +2184,7 @@ def test_shared_items_federation(base_dir: str) -> None:
|
|||
buy_url = ''
|
||||
chat_url = ''
|
||||
video_transcript = None
|
||||
auto_cw_cache = {}
|
||||
send_result = \
|
||||
send_post(signing_priv_key_pem, __version__,
|
||||
session_alice, alice_dir, 'alice', alice_domain, alice_port,
|
||||
|
@ -2187,7 +2198,7 @@ def test_shared_items_federation(base_dir: str) -> None:
|
|||
alice_shared_items_federated_domains,
|
||||
alice_shared_item_federation_tokens, low_bandwidth,
|
||||
content_license_url, media_license_url, media_creator,
|
||||
translate, buy_url, chat_url, True,
|
||||
translate, buy_url, chat_url, auto_cw_cache, True,
|
||||
in_reply_to, in_reply_to_atom_uri, subject)
|
||||
print('send_result: ' + str(send_result))
|
||||
|
||||
|
@ -2616,6 +2627,7 @@ def test_group_follow(base_dir: str) -> None:
|
|||
buy_url = ''
|
||||
chat_url = ''
|
||||
video_transcript = None
|
||||
auto_cw_cache = {}
|
||||
send_result = \
|
||||
send_post(signing_priv_key_pem, __version__,
|
||||
session_alice, alice_dir, 'alice', alice_domain, alice_port,
|
||||
|
@ -2629,7 +2641,7 @@ def test_group_follow(base_dir: str) -> None:
|
|||
alice_shared_items_federated_domains,
|
||||
alice_shared_item_federation_tokens, low_bandwidth,
|
||||
content_license_url, media_license_url, media_creator,
|
||||
translate, buy_url, chat_url,
|
||||
translate, buy_url, chat_url, auto_cw_cache, True,
|
||||
in_reply_to, in_reply_to_atom_uri, subject)
|
||||
print('send_result: ' + str(send_result))
|
||||
|
||||
|
@ -3011,6 +3023,7 @@ def _test_create_person_account(base_dir: str):
|
|||
"anything which challenges middle class sensibilities or incomes."
|
||||
buy_url = ''
|
||||
chat_url = ''
|
||||
auto_cw_cache = {}
|
||||
test_post_json = \
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
content, save_to_file,
|
||||
|
@ -3024,7 +3037,8 @@ def _test_create_person_account(base_dir: str):
|
|||
test_is_article, system_language, conversation_id,
|
||||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
assert test_post_json
|
||||
assert test_post_json.get('object')
|
||||
assert test_post_json['object']['content']
|
||||
|
@ -3051,7 +3065,8 @@ def _test_create_person_account(base_dir: str):
|
|||
test_is_article, system_language, conversation_id,
|
||||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
assert test_post_json
|
||||
assert test_post_json.get('object')
|
||||
assert test_post_json['object']['content']
|
||||
|
@ -3257,6 +3272,7 @@ def test_client_to_server(base_dir: str):
|
|||
buy_url = ''
|
||||
chat_url = ''
|
||||
video_transcript = None
|
||||
auto_cw_cache = {}
|
||||
send_result = \
|
||||
send_post_via_server(signing_priv_key_pem, __version__,
|
||||
alice_dir, session_alice, 'alice', password,
|
||||
|
@ -3271,8 +3287,8 @@ def test_client_to_server(base_dir: str):
|
|||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
event_date, event_time, event_end_time, location,
|
||||
translate, buy_url, chat_url, True, None, None,
|
||||
conversation_id, None)
|
||||
translate, buy_url, chat_url, auto_cw_cache,
|
||||
True, None, None, conversation_id, None)
|
||||
print('send_result: ' + str(send_result))
|
||||
|
||||
for _ in range(30):
|
||||
|
@ -4890,6 +4906,7 @@ def _test_reply_to_public_post(base_dir: str) -> None:
|
|||
translate = {}
|
||||
buy_url = ''
|
||||
chat_url = ''
|
||||
auto_cw_cache = {}
|
||||
video_transcript = ''
|
||||
reply = \
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
|
@ -4905,7 +4922,8 @@ def _test_reply_to_public_post(base_dir: str) -> None:
|
|||
test_is_article, system_language, conversation_id,
|
||||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
# print(str(reply))
|
||||
expected_str = \
|
||||
'<p><span class=\"h-card\">' + \
|
||||
|
@ -5846,6 +5864,7 @@ def _test_links_within_post(base_dir: str) -> None:
|
|||
translate = {}
|
||||
buy_url = ''
|
||||
chat_url = ''
|
||||
auto_cw_cache = {}
|
||||
video_transcript = ''
|
||||
|
||||
post_json_object = \
|
||||
|
@ -5861,7 +5880,8 @@ def _test_links_within_post(base_dir: str) -> None:
|
|||
test_is_article, system_language, conversation_id,
|
||||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
|
||||
expected_str = \
|
||||
'<p>This is a test post with links.<br><br>' + \
|
||||
|
@ -5906,7 +5926,8 @@ def _test_links_within_post(base_dir: str) -> None:
|
|||
test_is_article, system_language, conversation_id,
|
||||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
assert post_json_object['object']['content'] == content
|
||||
assert post_json_object['object']['contentMap'][system_language] == content
|
||||
|
||||
|
@ -6985,6 +7006,7 @@ def _test_can_replyto(base_dir: str) -> None:
|
|||
translate = {}
|
||||
buy_url = ''
|
||||
chat_url = ''
|
||||
auto_cw_cache = {}
|
||||
video_transcript = ''
|
||||
|
||||
post_json_object = \
|
||||
|
@ -7000,7 +7022,8 @@ def _test_can_replyto(base_dir: str) -> None:
|
|||
test_is_article, system_language, conversation_id,
|
||||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url)
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
# set the date on the post
|
||||
curr_date_str = "2021-09-08T20:45:00Z"
|
||||
post_json_object['published'] = curr_date_str
|
||||
|
|
|
@ -42,7 +42,8 @@ def html_confirm_delete(server,
|
|||
cw_lists: {}, lists_enabled: str,
|
||||
dogwhistles: {},
|
||||
min_images_for_accounts: [],
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Shows a screen asking to confirm the deletion of a post
|
||||
"""
|
||||
if '/statuses/' not in message_id:
|
||||
|
@ -100,7 +101,8 @@ def html_confirm_delete(server,
|
|||
False, False, False, False, False, False,
|
||||
cw_lists, lists_enabled, timezone, mitm,
|
||||
bold_reading, dogwhistles,
|
||||
minimize_all_images, None, buy_sites)
|
||||
minimize_all_images, None, buy_sites,
|
||||
auto_cw_cache)
|
||||
delete_post_str += '<center>'
|
||||
delete_post_str += \
|
||||
' <p class="followText">' + \
|
||||
|
|
|
@ -48,7 +48,8 @@ def html_conversation_view(authorized: bool, post_id: str,
|
|||
dogwhistles: {}, access_keys: {},
|
||||
min_images_for_accounts: [],
|
||||
debug: bool, buy_sites: {},
|
||||
blocked_cache: []) -> str:
|
||||
blocked_cache: [],
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Show a page containing a conversation thread
|
||||
"""
|
||||
conv_posts = \
|
||||
|
@ -119,7 +120,7 @@ def html_conversation_view(authorized: bool, post_id: str,
|
|||
timezone, False, bold_reading,
|
||||
dogwhistles,
|
||||
minimize_all_images, None,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
if post_str:
|
||||
conv_str += text_mode_separator + separator_str + post_str
|
||||
|
||||
|
|
|
@ -261,7 +261,8 @@ def html_new_post(edit_post_params: {},
|
|||
default_month: int, default_year: int,
|
||||
default_post_language: str,
|
||||
buy_sites: {},
|
||||
default_buy_site: str) -> str:
|
||||
default_buy_site: str,
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""New post screen
|
||||
"""
|
||||
# get the json if this is an edited post
|
||||
|
@ -446,7 +447,7 @@ def html_new_post(edit_post_params: {},
|
|||
timezone, False,
|
||||
bold_reading, dogwhistles,
|
||||
minimize_all_images, None,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
# about the author
|
||||
if has_object_dict(post_json_object):
|
||||
if post_json_object['object'].get('attributedTo'):
|
||||
|
|
|
@ -41,7 +41,8 @@ def _html_front_screen_posts(recent_posts_cache: {}, max_recent_posts: int,
|
|||
bold_reading: bool,
|
||||
dogwhistles: {},
|
||||
min_images_for_accounts: [],
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Shows posts on the front screen of a news instance
|
||||
These should only be public blog posts from the features timeline
|
||||
which is the blog timeline of the news actor
|
||||
|
@ -97,7 +98,7 @@ def _html_front_screen_posts(recent_posts_cache: {}, max_recent_posts: int,
|
|||
timezone, False,
|
||||
bold_reading, dogwhistles,
|
||||
minimize_all_images, None,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
if post_str:
|
||||
profile_str += post_str + separator_str
|
||||
ctr += 1
|
||||
|
@ -131,7 +132,8 @@ def html_front_screen(signing_priv_key_pem: str,
|
|||
cw_lists: {}, lists_enabled: str,
|
||||
dogwhistles: {},
|
||||
min_images_for_accounts: [],
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Show the news instance front screen
|
||||
"""
|
||||
bold_reading = False
|
||||
|
@ -208,7 +210,8 @@ def html_front_screen(signing_priv_key_pem: str,
|
|||
cw_lists, lists_enabled,
|
||||
bold_reading, dogwhistles,
|
||||
min_images_for_accounts,
|
||||
buy_sites) + license_str
|
||||
buy_sites,
|
||||
auto_cw_cache) + license_str
|
||||
|
||||
# Footer which is only used for system accounts
|
||||
profile_footer_str = ' </td>\n'
|
||||
|
|
|
@ -44,7 +44,7 @@ def html_likers_of_post(base_dir: str, nickname: str,
|
|||
box_name: str, default_timeline: str,
|
||||
bold_reading: bool, dogwhistles: {},
|
||||
min_images_for_accounts: [],
|
||||
buy_sites: {},
|
||||
buy_sites: {}, auto_cw_cache: {},
|
||||
dict_name: str = 'likes') -> str:
|
||||
"""Returns html for a screen showing who liked a post
|
||||
"""
|
||||
|
@ -116,7 +116,7 @@ def html_likers_of_post(base_dir: str, nickname: str,
|
|||
timezone, mitm, bold_reading,
|
||||
dogwhistles,
|
||||
minimize_all_images, None,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
|
||||
# show likers beneath the post
|
||||
obj = post_json_object
|
||||
|
|
|
@ -64,7 +64,8 @@ def html_moderation(default_timeline: str,
|
|||
dogwhistles: {}, ua_str: str,
|
||||
min_images_for_accounts: [],
|
||||
reverse_sequence: bool,
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Show the moderation feed as html
|
||||
This is what you see when selecting the "mod" timeline
|
||||
"""
|
||||
|
@ -92,7 +93,7 @@ def html_moderation(default_timeline: str,
|
|||
signing_priv_key_pem, cw_lists, lists_enabled,
|
||||
timezone, bold_reading, dogwhistles, ua_str,
|
||||
min_images_for_accounts, reverse_sequence, None,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
|
||||
|
||||
def html_account_info(translate: {},
|
||||
|
|
|
@ -2084,7 +2084,8 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
|||
dogwhistles: {},
|
||||
minimize_all_images: bool,
|
||||
first_post_id: str,
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
""" Shows a single post as html
|
||||
"""
|
||||
if not post_json_object:
|
||||
|
@ -2742,7 +2743,8 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
|||
dogwhistles, translate)
|
||||
# add automatic content warnings
|
||||
summary_str = add_auto_cw(base_dir, nickname, domain,
|
||||
summary_str, content_str)
|
||||
summary_str, content_str,
|
||||
auto_cw_cache)
|
||||
|
||||
content_all_str = str(summary_str) + ' ' + content_str
|
||||
# does an emoji or lack of alt text on an image indicate a
|
||||
|
@ -2800,7 +2802,8 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
|||
dogwhistles, translate)
|
||||
# add automatic content warnings
|
||||
summary_str = add_auto_cw(base_dir, nickname, domain,
|
||||
summary_str, content_str)
|
||||
summary_str, content_str,
|
||||
auto_cw_cache)
|
||||
|
||||
if summary_str and not post_is_sensitive:
|
||||
post_is_sensitive = True
|
||||
|
@ -3023,7 +3026,8 @@ def html_individual_post(recent_posts_cache: {}, max_recent_posts: int,
|
|||
timezone: str, mitm: bool,
|
||||
bold_reading: bool, dogwhistles: {},
|
||||
min_images_for_accounts: [],
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Show an individual post as html
|
||||
"""
|
||||
original_post_json = post_json_object
|
||||
|
@ -3109,7 +3113,8 @@ def html_individual_post(recent_posts_cache: {}, max_recent_posts: int,
|
|||
False, authorized, False, False, False, False,
|
||||
cw_lists, lists_enabled, timezone, mitm,
|
||||
bold_reading, dogwhistles,
|
||||
minimize_all_images, None, buy_sites)
|
||||
minimize_all_images, None, buy_sites,
|
||||
auto_cw_cache)
|
||||
message_id = remove_id_ending(post_json_object['id'])
|
||||
|
||||
# show the previous posts
|
||||
|
@ -3158,7 +3163,8 @@ def html_individual_post(recent_posts_cache: {}, max_recent_posts: int,
|
|||
bold_reading,
|
||||
dogwhistles,
|
||||
minimize_all_images,
|
||||
None, buy_sites) + post_str
|
||||
None, buy_sites,
|
||||
auto_cw_cache) + post_str
|
||||
|
||||
# show the following posts
|
||||
post_filename = locate_post(base_dir, nickname, domain, message_id)
|
||||
|
@ -3199,7 +3205,7 @@ def html_individual_post(recent_posts_cache: {}, max_recent_posts: int,
|
|||
timezone, False,
|
||||
bold_reading, dogwhistles,
|
||||
minimize_all_images, None,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
css_filename = base_dir + '/epicyon-profile.css'
|
||||
if os.path.isfile(base_dir + '/epicyon.css'):
|
||||
css_filename = base_dir + '/epicyon.css'
|
||||
|
@ -3231,7 +3237,8 @@ def html_post_replies(recent_posts_cache: {}, max_recent_posts: int,
|
|||
timezone: str, bold_reading: bool,
|
||||
dogwhistles: {},
|
||||
min_images_for_accounts: [],
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Show the replies to an individual post as html
|
||||
"""
|
||||
replies_str = ''
|
||||
|
@ -3263,7 +3270,7 @@ def html_post_replies(recent_posts_cache: {}, max_recent_posts: int,
|
|||
timezone, False,
|
||||
bold_reading, dogwhistles,
|
||||
minimize_all_images, None,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
|
||||
css_filename = base_dir + '/epicyon-profile.css'
|
||||
if os.path.isfile(base_dir + '/epicyon.css'):
|
||||
|
@ -3295,7 +3302,8 @@ def html_emoji_reaction_picker(recent_posts_cache: {}, max_recent_posts: int,
|
|||
timezone: str, bold_reading: bool,
|
||||
dogwhistles: {},
|
||||
min_images_for_accounts: [],
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Returns the emoji picker screen
|
||||
"""
|
||||
minimize_all_images = False
|
||||
|
@ -3323,7 +3331,8 @@ def html_emoji_reaction_picker(recent_posts_cache: {}, max_recent_posts: int,
|
|||
False, False, False, False, False, False,
|
||||
cw_lists, lists_enabled, timezone, False,
|
||||
bold_reading, dogwhistles,
|
||||
minimize_all_images, None, buy_sites)
|
||||
minimize_all_images, None, buy_sites,
|
||||
auto_cw_cache)
|
||||
|
||||
reactions_filename = base_dir + '/emoji/reactions.json'
|
||||
if not os.path.isfile(reactions_filename):
|
||||
|
|
|
@ -213,7 +213,8 @@ def html_profile_after_search(authorized: bool,
|
|||
min_images_for_accounts: [],
|
||||
buy_sites: {},
|
||||
max_shares_on_profile: int,
|
||||
no_of_books: int) -> str:
|
||||
no_of_books: int,
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Show a profile page after a search for a fediverse address
|
||||
"""
|
||||
http = False
|
||||
|
@ -551,7 +552,7 @@ def html_profile_after_search(authorized: bool,
|
|||
timezone, False,
|
||||
bold_reading, dogwhistles,
|
||||
minimize_all_images, None,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
if not profile_post_html:
|
||||
if debug:
|
||||
print('DEBUG: no html produced for profile post: ' +
|
||||
|
@ -926,7 +927,8 @@ def html_profile(signing_priv_key_pem: str,
|
|||
actor_proxied: str,
|
||||
max_shares_on_profile: int,
|
||||
sites_unavailable: [],
|
||||
no_of_books: int) -> str:
|
||||
no_of_books: int,
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Show the profile page as html
|
||||
"""
|
||||
show_moved_accounts = False
|
||||
|
@ -958,7 +960,8 @@ def html_profile(signing_priv_key_pem: str,
|
|||
shared_items_federated_domains, None,
|
||||
page_number, max_items_per_page, cw_lists,
|
||||
lists_enabled, {},
|
||||
min_images_for_accounts, buy_sites)
|
||||
min_images_for_accounts, buy_sites,
|
||||
auto_cw_cache)
|
||||
|
||||
domain, port = get_domain_from_actor(profile_json['id'])
|
||||
if not domain:
|
||||
|
@ -1469,7 +1472,8 @@ def html_profile(signing_priv_key_pem: str,
|
|||
timezone, bold_reading, {},
|
||||
min_images_for_accounts,
|
||||
max_profile_posts,
|
||||
buy_sites) + license_str
|
||||
buy_sites,
|
||||
auto_cw_cache) + license_str
|
||||
if not is_group:
|
||||
if selected == 'following':
|
||||
profile_str += \
|
||||
|
@ -1576,7 +1580,8 @@ def _html_profile_posts(recent_posts_cache: {}, max_recent_posts: int,
|
|||
dogwhistles: {},
|
||||
min_images_for_accounts: [],
|
||||
max_profile_posts: int,
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Shows posts on the profile screen
|
||||
These should only be public posts
|
||||
"""
|
||||
|
@ -1635,7 +1640,7 @@ def _html_profile_posts(recent_posts_cache: {}, max_recent_posts: int,
|
|||
timezone, False,
|
||||
bold_reading, dogwhistles,
|
||||
minimize_all_images, None,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
if post_str and item_id not in shown_items:
|
||||
profile_str += post_str + separator_str
|
||||
shown_items.append(item_id)
|
||||
|
|
|
@ -713,7 +713,8 @@ def html_history_search(translate: {}, base_dir: str,
|
|||
timezone: str, bold_reading: bool,
|
||||
dogwhistles: {}, access_keys: {},
|
||||
min_images_for_accounts: [],
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Show a page containing search results for your post history
|
||||
"""
|
||||
if historysearch.startswith("'"):
|
||||
|
@ -824,7 +825,7 @@ def html_history_search(translate: {}, base_dir: str,
|
|||
timezone, False, bold_reading,
|
||||
dogwhistles,
|
||||
minimize_all_images, None,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
if post_str:
|
||||
history_search_form += separator_str + post_str
|
||||
index += 1
|
||||
|
@ -853,7 +854,7 @@ def html_hashtag_search(nickname: str, domain: str, port: int,
|
|||
dogwhistles: {}, map_format: str,
|
||||
access_keys: {}, box_name: str,
|
||||
min_images_for_accounts: [],
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {}, auto_cw_cache: {}) -> str:
|
||||
"""Show a page containing search results for a hashtag
|
||||
or after selecting a hashtag from the swarm
|
||||
"""
|
||||
|
@ -1046,7 +1047,7 @@ def html_hashtag_search(nickname: str, domain: str, port: int,
|
|||
lists_enabled, timezone, False,
|
||||
bold_reading, dogwhistles,
|
||||
minimize_all_images, None,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
if post_str:
|
||||
hashtag_search_form += \
|
||||
text_mode_separator + separator_str + post_str
|
||||
|
@ -1089,7 +1090,8 @@ def html_hashtag_search_remote(nickname: str, domain: str, port: int,
|
|||
timezone: str, bold_reading: bool,
|
||||
dogwhistles: {},
|
||||
min_images_for_accounts: [],
|
||||
debug: bool, buy_sites: {}) -> str:
|
||||
debug: bool, buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Show a page containing search results for a remote hashtag
|
||||
"""
|
||||
hashtag = urllib.parse.unquote(hashtag_url.split('/')[-1])
|
||||
|
@ -1250,7 +1252,7 @@ def html_hashtag_search_remote(nickname: str, domain: str, port: int,
|
|||
lists_enabled, timezone, False,
|
||||
bold_reading, dogwhistles,
|
||||
minimize_all_images, None,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
if post_str:
|
||||
hashtag_search_form += \
|
||||
text_mode_separator + separator_str + post_str
|
||||
|
|
|
@ -512,7 +512,8 @@ def html_timeline(default_timeline: str,
|
|||
min_images_for_accounts: [],
|
||||
reverse_sequence: bool,
|
||||
last_post_id: str,
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Show the timeline as html
|
||||
"""
|
||||
enable_timing_log = False
|
||||
|
@ -1058,7 +1059,8 @@ def html_timeline(default_timeline: str,
|
|||
timezone, mitm,
|
||||
bold_reading, dogwhistles,
|
||||
minimize_all_images,
|
||||
first_post_id, buy_sites)
|
||||
first_post_id, buy_sites,
|
||||
auto_cw_cache)
|
||||
_log_timeline_timing(enable_timing_log,
|
||||
timeline_start_time, box_name, '12')
|
||||
|
||||
|
@ -1333,7 +1335,8 @@ def html_shares(default_timeline: str,
|
|||
dogwhistles: {}, ua_str: str,
|
||||
min_images_for_accounts: [],
|
||||
reverse_sequence: bool,
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Show the shares timeline as html
|
||||
"""
|
||||
manually_approve_followers = \
|
||||
|
@ -1366,7 +1369,8 @@ def html_shares(default_timeline: str,
|
|||
cw_lists, lists_enabled, timezone,
|
||||
bold_reading, dogwhistles, ua_str,
|
||||
min_images_for_accounts,
|
||||
reverse_sequence, None, buy_sites)
|
||||
reverse_sequence, None, buy_sites,
|
||||
auto_cw_cache)
|
||||
|
||||
|
||||
def html_wanted(default_timeline: str,
|
||||
|
@ -1399,7 +1403,8 @@ def html_wanted(default_timeline: str,
|
|||
dogwhistles: {}, ua_str: str,
|
||||
min_images_for_accounts: [],
|
||||
reverse_sequence: bool,
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Show the wanted timeline as html
|
||||
"""
|
||||
manually_approve_followers = \
|
||||
|
@ -1432,7 +1437,8 @@ def html_wanted(default_timeline: str,
|
|||
cw_lists, lists_enabled, timezone,
|
||||
bold_reading, dogwhistles, ua_str,
|
||||
min_images_for_accounts,
|
||||
reverse_sequence, None, buy_sites)
|
||||
reverse_sequence, None, buy_sites,
|
||||
auto_cw_cache)
|
||||
|
||||
|
||||
def html_inbox(default_timeline: str,
|
||||
|
@ -1467,7 +1473,8 @@ def html_inbox(default_timeline: str,
|
|||
min_images_for_accounts: [],
|
||||
reverse_sequence: bool,
|
||||
last_post_id: str,
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Show the inbox as html
|
||||
"""
|
||||
manually_approve_followers = \
|
||||
|
@ -1501,7 +1508,7 @@ def html_inbox(default_timeline: str,
|
|||
bold_reading, dogwhistles, ua_str,
|
||||
min_images_for_accounts,
|
||||
reverse_sequence, last_post_id,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
|
||||
|
||||
def html_bookmarks(default_timeline: str,
|
||||
|
@ -1535,7 +1542,8 @@ def html_bookmarks(default_timeline: str,
|
|||
dogwhistles: {}, ua_str: str,
|
||||
min_images_for_accounts: [],
|
||||
reverse_sequence: bool,
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Show the bookmarks as html
|
||||
"""
|
||||
manually_approve_followers = \
|
||||
|
@ -1567,7 +1575,8 @@ def html_bookmarks(default_timeline: str,
|
|||
cw_lists, lists_enabled, timezone,
|
||||
bold_reading, dogwhistles, ua_str,
|
||||
min_images_for_accounts,
|
||||
reverse_sequence, None, buy_sites)
|
||||
reverse_sequence, None, buy_sites,
|
||||
auto_cw_cache)
|
||||
|
||||
|
||||
def html_inbox_dms(default_timeline: str,
|
||||
|
@ -1602,7 +1611,8 @@ def html_inbox_dms(default_timeline: str,
|
|||
min_images_for_accounts: [],
|
||||
reverse_sequence: bool,
|
||||
last_post_id: str,
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Show the DM timeline as html
|
||||
"""
|
||||
artist = is_artist(base_dir, nickname)
|
||||
|
@ -1631,7 +1641,7 @@ def html_inbox_dms(default_timeline: str,
|
|||
bold_reading, dogwhistles, ua_str,
|
||||
min_images_for_accounts,
|
||||
reverse_sequence, last_post_id,
|
||||
buy_sites)
|
||||
buy_sites, auto_cw_cache)
|
||||
|
||||
|
||||
def html_inbox_replies(default_timeline: str,
|
||||
|
@ -1666,7 +1676,8 @@ def html_inbox_replies(default_timeline: str,
|
|||
min_images_for_accounts: [],
|
||||
reverse_sequence: bool,
|
||||
last_post_id: str,
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Show the replies timeline as html
|
||||
"""
|
||||
artist = is_artist(base_dir, nickname)
|
||||
|
@ -1692,7 +1703,8 @@ def html_inbox_replies(default_timeline: str,
|
|||
shared_items_federated_domains, signing_priv_key_pem,
|
||||
cw_lists, lists_enabled, timezone, bold_reading,
|
||||
dogwhistles, ua_str, min_images_for_accounts,
|
||||
reverse_sequence, last_post_id, buy_sites)
|
||||
reverse_sequence, last_post_id, buy_sites,
|
||||
auto_cw_cache)
|
||||
|
||||
|
||||
def html_inbox_media(default_timeline: str,
|
||||
|
@ -1727,7 +1739,8 @@ def html_inbox_media(default_timeline: str,
|
|||
min_images_for_accounts: [],
|
||||
reverse_sequence: bool,
|
||||
last_post_id: str,
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Show the media timeline as html
|
||||
"""
|
||||
artist = is_artist(base_dir, nickname)
|
||||
|
@ -1753,7 +1766,8 @@ def html_inbox_media(default_timeline: str,
|
|||
shared_items_federated_domains, signing_priv_key_pem,
|
||||
cw_lists, lists_enabled, timezone, bold_reading,
|
||||
dogwhistles, ua_str, min_images_for_accounts,
|
||||
reverse_sequence, last_post_id, buy_sites)
|
||||
reverse_sequence, last_post_id, buy_sites,
|
||||
auto_cw_cache)
|
||||
|
||||
|
||||
def html_inbox_blogs(default_timeline: str,
|
||||
|
@ -1788,7 +1802,8 @@ def html_inbox_blogs(default_timeline: str,
|
|||
min_images_for_accounts: [],
|
||||
reverse_sequence: bool,
|
||||
last_post_id: str,
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Show the blogs timeline as html
|
||||
"""
|
||||
artist = is_artist(base_dir, nickname)
|
||||
|
@ -1814,7 +1829,8 @@ def html_inbox_blogs(default_timeline: str,
|
|||
shared_items_federated_domains, signing_priv_key_pem,
|
||||
cw_lists, lists_enabled, timezone, bold_reading,
|
||||
dogwhistles, ua_str, min_images_for_accounts,
|
||||
reverse_sequence, last_post_id, buy_sites)
|
||||
reverse_sequence, last_post_id, buy_sites,
|
||||
auto_cw_cache)
|
||||
|
||||
|
||||
def html_inbox_features(default_timeline: str,
|
||||
|
@ -1849,7 +1865,8 @@ def html_inbox_features(default_timeline: str,
|
|||
dogwhistles: {}, ua_str: str,
|
||||
min_images_for_accounts: [],
|
||||
reverse_sequence: bool,
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Show the features timeline as html
|
||||
"""
|
||||
return html_timeline(default_timeline,
|
||||
|
@ -1874,7 +1891,8 @@ def html_inbox_features(default_timeline: str,
|
|||
shared_items_federated_domains, signing_priv_key_pem,
|
||||
cw_lists, lists_enabled, timezone, bold_reading,
|
||||
dogwhistles, ua_str, min_images_for_accounts,
|
||||
reverse_sequence, None, buy_sites)
|
||||
reverse_sequence, None, buy_sites,
|
||||
auto_cw_cache)
|
||||
|
||||
|
||||
def html_inbox_news(default_timeline: str,
|
||||
|
@ -1908,7 +1926,8 @@ def html_inbox_news(default_timeline: str,
|
|||
dogwhistles: {}, ua_str: str,
|
||||
min_images_for_accounts: [],
|
||||
reverse_sequence: bool,
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Show the news timeline as html
|
||||
"""
|
||||
return html_timeline(default_timeline,
|
||||
|
@ -1933,7 +1952,8 @@ def html_inbox_news(default_timeline: str,
|
|||
shared_items_federated_domains, signing_priv_key_pem,
|
||||
cw_lists, lists_enabled, timezone, bold_reading,
|
||||
dogwhistles, ua_str, min_images_for_accounts,
|
||||
reverse_sequence, None, buy_sites)
|
||||
reverse_sequence, None, buy_sites,
|
||||
auto_cw_cache)
|
||||
|
||||
|
||||
def html_outbox(default_timeline: str,
|
||||
|
@ -1967,7 +1987,8 @@ def html_outbox(default_timeline: str,
|
|||
dogwhistles: {}, ua_str: str,
|
||||
min_images_for_accounts: [],
|
||||
reverse_sequence: bool,
|
||||
buy_sites: {}) -> str:
|
||||
buy_sites: {},
|
||||
auto_cw_cache: {}) -> str:
|
||||
"""Show the Outbox as html
|
||||
"""
|
||||
manually_approve_followers = \
|
||||
|
@ -1995,4 +2016,4 @@ def html_outbox(default_timeline: str,
|
|||
shared_items_federated_domains, signing_priv_key_pem,
|
||||
cw_lists, lists_enabled, timezone, bold_reading,
|
||||
dogwhistles, ua_str, min_images_for_accounts,
|
||||
reverse_sequence, None, buy_sites)
|
||||
reverse_sequence, None, buy_sites, auto_cw_cache)
|
||||
|
|
Loading…
Reference in New Issue