Buy links

main
Bob Mottram 2023-01-13 15:04:48 +00:00
parent 7d6451ae09
commit 2f9a0c7792
58 changed files with 460 additions and 186 deletions

165
daemon.py
View File

@ -483,7 +483,8 @@ class PubServer(BaseHTTPRequestHandler):
theme_name: str, max_like_count: int,
cw_lists: {}, dogwhistles: {},
min_images_for_accounts: [],
max_hashtags: int) -> None:
max_hashtags: int,
buy_sites: {}) -> None:
"""When an edited post is created this assigns
a published and updated date to it, and uses
the previous id
@ -531,7 +532,7 @@ class PubServer(BaseHTTPRequestHandler):
theme_name, max_like_count,
cw_lists, dogwhistles,
min_images_for_accounts,
max_hashtags)
max_hashtags, buy_sites)
# update the index
id_str = edited_postid.split('/')[-1]
@ -1876,7 +1877,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled,
self.server.content_license_url,
self.server.dogwhistles,
self.server.min_images_for_accounts)
self.server.min_images_for_accounts,
self.server.buy_sites)
def _get_outbox_thread_index(self, nickname: str,
max_outbox_threads_per_account: int) -> int:
@ -3240,7 +3242,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.i2p_domain,
bold_reading,
self.server.dogwhistles,
min_images_for_accounts)
min_images_for_accounts,
self.server.buy_sites)
if profile_str:
msg = profile_str.encode('utf-8')
msglen = len(msg)
@ -3707,7 +3710,8 @@ class PubServer(BaseHTTPRequestHandler):
bold_reading,
self.server.dogwhistles,
self.server.min_images_for_accounts,
None, None, default_post_language)
None, None, default_post_language,
self.server.buy_sites)
if msg:
msg = msg.encode('utf-8')
msglen = len(msg)
@ -3866,7 +3870,8 @@ class PubServer(BaseHTTPRequestHandler):
bold_reading,
self.server.dogwhistles,
self.server.min_images_for_accounts,
None, None, default_post_language)
None, None, default_post_language,
self.server.buy_sites)
if msg:
msg = msg.encode('utf-8')
msglen = len(msg)
@ -4444,7 +4449,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.map_format,
self.server.access_keys,
'search',
self.server.min_images_for_accounts)
self.server.min_images_for_accounts,
self.server.buy_sites)
if hashtag_str:
msg = hashtag_str.encode('utf-8')
msglen = len(msg)
@ -4555,7 +4561,8 @@ class PubServer(BaseHTTPRequestHandler):
timezone, bold_reading,
self.server.dogwhistles,
self.server.access_keys,
self.server.min_images_for_accounts)
self.server.min_images_for_accounts,
self.server.buy_sites)
if history_str:
msg = history_str.encode('utf-8')
msglen = len(msg)
@ -4638,7 +4645,8 @@ class PubServer(BaseHTTPRequestHandler):
timezone, bold_reading,
self.server.dogwhistles,
self.server.access_keys,
self.server.min_images_for_accounts)
self.server.min_images_for_accounts,
self.server.buy_sites)
if bookmarks_str:
msg = bookmarks_str.encode('utf-8')
msglen = len(msg)
@ -4817,7 +4825,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.i2p_domain,
bold_reading,
self.server.dogwhistles,
min_images_for_accounts)
min_images_for_accounts,
self.server.buy_sites)
if profile_str:
msg = profile_str.encode('utf-8')
msglen = len(msg)
@ -9201,7 +9210,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.map_format,
self.server.access_keys,
'search',
self.server.min_images_for_accounts)
self.server.min_images_for_accounts,
self.server.buy_sites)
if hashtag_str:
msg = hashtag_str.encode('utf-8')
msglen = len(msg)
@ -9522,7 +9532,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled,
timezone, mitm, bold_reading,
self.server.dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
self.server.buy_sites)
actor_absolute = self._get_instance_url(calling_domain) + actor
@ -10088,7 +10099,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled,
timezone, mitm, bold_reading,
self.server.dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
self.server.buy_sites)
else:
print('WARN: Liked post not found: ' + liked_post_filename)
# clear the icon from the cache so that it gets updated
@ -10292,7 +10304,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled,
timezone, mitm, bold_reading,
self.server.dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
self.server.buy_sites)
else:
print('WARN: Unliked post not found: ' + liked_post_filename)
# clear the icon from the cache so that it gets updated
@ -10525,7 +10538,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled,
timezone, mitm, bold_reading,
self.server.dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
self.server.buy_sites)
else:
print('WARN: Emoji reaction post not found: ' +
reaction_post_filename)
@ -10748,7 +10762,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled,
timezone, mitm, bold_reading,
self.server.dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
self.server.buy_sites)
else:
print('WARN: Unreaction post not found: ' +
reaction_post_filename)
@ -10857,7 +10872,8 @@ class PubServer(BaseHTTPRequestHandler):
timeline_str, page_number,
timezone, bold_reading,
self.server.dogwhistles,
self.server.min_images_for_accounts)
self.server.min_images_for_accounts,
self.server.buy_sites)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -11016,7 +11032,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled,
timezone, mitm, bold_reading,
self.server.dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
self.server.buy_sites)
else:
print('WARN: Bookmarked post not found: ' + bookmark_filename)
# self._post_to_outbox(bookmark_json,
@ -11184,7 +11201,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled,
timezone, mitm, bold_reading,
self.server.dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
self.server.buy_sites)
else:
print('WARN: Unbookmarked post not found: ' +
bookmark_filename)
@ -11298,7 +11316,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cw_lists,
self.server.lists_enabled,
self.server.dogwhistles,
self.server.min_images_for_accounts)
self.server.min_images_for_accounts,
self.server.buy_sites)
if delete_str:
delete_str_len = len(delete_str)
self._set_headers('text/html', delete_str_len,
@ -11439,7 +11458,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled,
timezone, mitm, bold_reading,
self.server.dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
self.server.buy_sites)
else:
print('WARN: Muted post not found: ' + mute_filename)
@ -11583,7 +11603,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled,
timezone, mitm, bold_reading,
self.server.dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
self.server.buy_sites)
else:
print('WARN: Unmuted post not found: ' + mute_filename)
if calling_domain.endswith('.onion') and onion_domain:
@ -11714,7 +11735,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled,
timezone, bold_reading,
self.server.dogwhistles,
self.server.min_images_for_accounts)
self.server.min_images_for_accounts,
self.server.buy_sites)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -11828,7 +11850,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled,
timezone, bold_reading,
self.server.dogwhistles,
self.server.min_images_for_accounts)
self.server.min_images_for_accounts,
self.server.buy_sites)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -11948,7 +11971,8 @@ class PubServer(BaseHTTPRequestHandler):
None, None, self.server.cw_lists,
self.server.lists_enabled,
self.server.content_license_url,
timezone, bold_reading)
timezone, bold_reading,
self.server.buy_sites)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -12074,7 +12098,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cw_lists,
self.server.lists_enabled,
content_license_url,
timezone, bold_reading)
timezone, bold_reading,
self.server.buy_sites)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -12173,7 +12198,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.dogwhistles,
self.server.access_keys,
self.server.min_images_for_accounts,
self.server.debug)
self.server.debug,
self.server.buy_sites)
if conv_str:
msg = conv_str.encode('utf-8')
msglen = len(msg)
@ -12336,7 +12362,8 @@ class PubServer(BaseHTTPRequestHandler):
'inbox', self.server.default_timeline,
bold_reading,
self.server.dogwhistles,
self.server.min_images_for_accounts)
self.server.min_images_for_accounts,
self.server.buy_sites)
if not msg:
self._404()
return True
@ -12402,6 +12429,7 @@ class PubServer(BaseHTTPRequestHandler):
'inbox', self.server.default_timeline,
bold_reading, self.server.dogwhistles,
self.server.min_images_for_accounts,
self.server.buy_sites,
'shares')
if not msg:
self._404()
@ -12491,7 +12519,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.lists_enabled,
timezone, mitm, bold_reading,
self.server.dogwhistles,
self.server.min_images_for_accounts)
self.server.min_images_for_accounts,
self.server.buy_sites)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -12817,7 +12846,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.dogwhistles,
ua_str,
self.server.min_images_for_accounts,
reverse_sequence, last_post_id)
reverse_sequence, last_post_id,
self.server.buy_sites)
if getreq_start_time:
fitness_performance(getreq_start_time,
self.server.fitness,
@ -13000,7 +13030,8 @@ class PubServer(BaseHTTPRequestHandler):
timezone, bold_reading,
self.server.dogwhistles, ua_str,
self.server.min_images_for_accounts,
reverse_sequence, last_post_id)
reverse_sequence, last_post_id,
self.server.buy_sites)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -13174,7 +13205,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.dogwhistles,
ua_str,
self.server.min_images_for_accounts,
reverse_sequence, last_post_id)
reverse_sequence, last_post_id,
self.server.buy_sites)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -13344,7 +13376,8 @@ class PubServer(BaseHTTPRequestHandler):
timezone, bold_reading,
self.server.dogwhistles, ua_str,
self.server.min_images_for_accounts,
reverse_sequence, last_post_id)
reverse_sequence, last_post_id,
self.server.buy_sites)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -13514,7 +13547,8 @@ class PubServer(BaseHTTPRequestHandler):
timezone, bold_reading,
self.server.dogwhistles, ua_str,
self.server.min_images_for_accounts,
reverse_sequence, last_post_id)
reverse_sequence, last_post_id,
self.server.buy_sites)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -13687,7 +13721,8 @@ class PubServer(BaseHTTPRequestHandler):
timezone, bold_reading,
self.server.dogwhistles, ua_str,
self.server.min_images_for_accounts,
reverse_sequence)
reverse_sequence,
self.server.buy_sites)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -13864,7 +13899,8 @@ class PubServer(BaseHTTPRequestHandler):
timezone, bold_reading,
self.server.dogwhistles, ua_str,
min_images_for_accounts,
reverse_sequence)
reverse_sequence,
self.server.buy_sites)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -13992,7 +14028,8 @@ class PubServer(BaseHTTPRequestHandler):
bold_reading, self.server.dogwhistles,
ua_str,
self.server.min_images_for_accounts,
reverse_sequence)
reverse_sequence,
self.server.buy_sites)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -14093,7 +14130,8 @@ class PubServer(BaseHTTPRequestHandler):
timezone, bold_reading,
self.server.dogwhistles, ua_str,
self.server.min_images_for_accounts,
reverse_sequence)
reverse_sequence,
self.server.buy_sites)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -14235,7 +14273,8 @@ class PubServer(BaseHTTPRequestHandler):
timezone, bold_reading,
self.server.dogwhistles, ua_str,
self.server.min_images_for_accounts,
reverse_sequence)
reverse_sequence,
self.server.buy_sites)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -14395,7 +14434,8 @@ class PubServer(BaseHTTPRequestHandler):
timezone, bold_reading,
self.server.dogwhistles, ua_str,
self.server.min_images_for_accounts,
reverse_sequence)
reverse_sequence,
self.server.buy_sites)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -14552,7 +14592,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.dogwhistles,
ua_str,
min_images_for_accounts,
reverse_sequence)
reverse_sequence,
self.server.buy_sites)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -14696,7 +14737,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cw_lists,
self.server.lists_enabled,
self.server.content_license_url,
timezone, bold_reading)
timezone, bold_reading,
self.server.buy_sites)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -14838,7 +14880,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cw_lists,
self.server.lists_enabled,
content_license_url,
timezone, bold_reading).encode('utf-8')
timezone, bold_reading,
self.server.buy_sites).encode('utf-8')
msglen = len(msg)
self._set_headers('text/html',
msglen, cookie, calling_domain, False)
@ -14974,7 +15017,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cw_lists,
self.server.lists_enabled,
content_license_url,
timezone, bold_reading).encode('utf-8')
timezone, bold_reading,
self.server.buy_sites).encode('utf-8')
msglen = len(msg)
self._set_headers('text/html',
msglen, cookie, calling_domain, False)
@ -15114,7 +15158,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cw_lists,
self.server.lists_enabled,
content_license_url,
timezone, bold_reading).encode('utf-8')
timezone, bold_reading,
self.server.buy_sites).encode('utf-8')
msglen = len(msg)
self._set_headers('text/html',
msglen, cookie, calling_domain, False)
@ -15255,7 +15300,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cw_lists,
self.server.lists_enabled,
content_license_url,
timezone, bold_reading).encode('utf-8')
timezone, bold_reading,
self.server.buy_sites).encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
cookie, calling_domain, False)
@ -15422,7 +15468,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cw_lists,
self.server.lists_enabled,
self.server.content_license_url,
timezone, bold_reading).encode('utf-8')
timezone, bold_reading,
self.server.buy_sites).encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
cookie, calling_domain, False)
@ -16264,7 +16311,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.dogwhistles,
self.server.min_images_for_accounts,
new_post_month, new_post_year,
default_post_language)
default_post_language,
self.server.buy_sites)
if not msg:
print('Error replying to ' + in_reply_to_url)
self._404()
@ -18634,7 +18682,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.bold_reading,
self.server.dogwhistles,
self.server.min_images_for_accounts,
self.server.debug)
self.server.debug,
self.server.buy_sites)
if msg:
msg = msg.encode('utf-8')
msglen = len(msg)
@ -20722,7 +20771,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cw_lists,
self.server.dogwhistles,
min_images_for_accounts,
self.server.max_hashtags)
self.server.max_hashtags,
self.server.buy_sites)
print('DEBUG: sending edited public post ' +
str(message_json))
if fields['schedulePost']:
@ -21026,7 +21076,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cw_lists,
self.server.dogwhistles,
min_images_for_accounts,
self.server.max_hashtags)
self.server.max_hashtags,
self.server.buy_sites)
print('DEBUG: sending edited unlisted post ' +
str(message_json))
@ -21136,7 +21187,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cw_lists,
self.server.dogwhistles,
min_images_for_accounts,
self.server.max_hashtags)
self.server.max_hashtags,
self.server.buy_sites)
print('DEBUG: sending edited followers post ' +
str(message_json))
@ -21260,7 +21312,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cw_lists,
self.server.dogwhistles,
min_images_for_accounts,
self.server.max_hashtags)
self.server.max_hashtags,
self.server.buy_sites)
print('DEBUG: sending edited dm post ' +
str(message_json))
@ -21378,7 +21431,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cw_lists,
self.server.dogwhistles,
min_images_for_accounts,
self.server.max_hashtags)
self.server.max_hashtags,
self.server.buy_sites)
print('DEBUG: sending edited reminder post ' +
str(message_json))
if self._post_to_outbox(message_json,
@ -22928,6 +22982,9 @@ def run_daemon(max_hashtags: int,
# scan the theme directory for any svg files containing scripts
assert not scan_themes_for_scripts(base_dir)
# permitted sites from which the buy button may be displayed
httpd.buy_sites = {}
# which accounts should minimize all attached images by default
httpd.min_images_for_accounts = load_min_images_for_accounts(base_dir)

104
inbox.py
View File

@ -452,7 +452,8 @@ def _inbox_store_post_to_html_cache(recent_posts_cache: {},
mitm: bool,
bold_reading: bool,
dogwhistles: {},
min_images_for_accounts: []) -> None:
min_images_for_accounts: [],
buy_sites: {}) -> None:
"""Converts the json post into html and stores it in a cache
This enables the post to be quickly displayed later
"""
@ -482,7 +483,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)
None, buy_sites)
def valid_inbox(base_dir: str, nickname: str, domain: str) -> bool:
@ -1257,7 +1258,8 @@ def receive_edit_to_post(recent_posts_cache: {}, message_json: {},
theme_name: str, max_like_count: int,
cw_lists: {}, dogwhistles: {},
min_images_for_accounts: [],
max_hashtags: int) -> bool:
max_hashtags: int,
buy_sites: {}) -> bool:
"""A post was edited
"""
if not has_object_dict(message_json):
@ -1392,7 +1394,8 @@ def receive_edit_to_post(recent_posts_cache: {}, message_json: {},
False, True, False, cw_lists,
lists_enabled, timezone, mitm,
bold_reading, dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
buy_sites)
return True
@ -1414,7 +1417,8 @@ def _receive_update_activity(recent_posts_cache: {}, session, base_dir: str,
theme_name: str, max_like_count: int,
cw_lists: {}, dogwhistles: {},
min_images_for_accounts: [],
max_hashtags: int) -> bool:
max_hashtags: int,
buy_sites: {}) -> bool:
"""Receives an Update activity within the POST section of HTTPServer
"""
@ -1456,7 +1460,7 @@ 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):
max_hashtags, buy_sites):
print('EDITPOST: received ' + message_json['object']['id'])
return True
else:
@ -1507,7 +1511,8 @@ def _receive_like(recent_posts_cache: {},
max_like_count: int, cw_lists: {},
lists_enabled: str,
bold_reading: bool, dogwhistles: {},
min_images_for_accounts: []) -> bool:
min_images_for_accounts: [],
buy_sites: {}) -> bool:
"""Receives a Like activity within the POST section of HTTPServer
"""
if message_json['type'] != 'Like':
@ -1621,7 +1626,7 @@ def _receive_like(recent_posts_cache: {},
False, True, False, cw_lists,
lists_enabled, timezone, mitm,
bold_reading, dogwhistles,
minimize_all_images, None)
minimize_all_images, None, buy_sites)
return True
@ -1642,7 +1647,8 @@ def _receive_undo_like(recent_posts_cache: {},
max_like_count: int, cw_lists: {},
lists_enabled: str,
bold_reading: bool, dogwhistles: {},
min_images_for_accounts: []) -> bool:
min_images_for_accounts: [],
buy_sites: {}) -> bool:
"""Receives an undo like activity within the POST section of HTTPServer
"""
if message_json['type'] != 'Undo':
@ -1746,7 +1752,8 @@ def _receive_undo_like(recent_posts_cache: {},
False, True, False, cw_lists,
lists_enabled, timezone, mitm,
bold_reading, dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
buy_sites)
return True
@ -1768,7 +1775,8 @@ def _receive_reaction(recent_posts_cache: {},
max_like_count: int, cw_lists: {},
lists_enabled: str, bold_reading: bool,
dogwhistles: {},
min_images_for_accounts: []) -> bool:
min_images_for_accounts: [],
buy_sites: {}) -> bool:
"""Receives an emoji reaction within the POST section of HTTPServer
"""
if message_json['type'] != 'EmojiReact':
@ -1903,7 +1911,7 @@ def _receive_reaction(recent_posts_cache: {},
False, True, False, cw_lists,
lists_enabled, timezone, mitm,
bold_reading, dogwhistles,
minimize_all_images, None)
minimize_all_images, None, buy_sites)
return True
@ -1925,7 +1933,8 @@ def _receive_zot_reaction(recent_posts_cache: {},
max_like_count: int, cw_lists: {},
lists_enabled: str, bold_reading: bool,
dogwhistles: {},
min_images_for_accounts: []) -> bool:
min_images_for_accounts: [],
buy_sites: {}) -> 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
@ -2084,7 +2093,8 @@ def _receive_zot_reaction(recent_posts_cache: {},
False, True, False, cw_lists,
lists_enabled, timezone, mitm,
bold_reading, dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
buy_sites)
return True
@ -2107,7 +2117,8 @@ def _receive_undo_reaction(recent_posts_cache: {},
max_like_count: int, cw_lists: {},
lists_enabled: str,
bold_reading: bool, dogwhistles: {},
min_images_for_accounts: []) -> bool:
min_images_for_accounts: [],
buy_sites: {}) -> bool:
"""Receives an undo emoji reaction within the POST section of HTTPServer
"""
if message_json['type'] != 'Undo':
@ -2229,7 +2240,8 @@ def _receive_undo_reaction(recent_posts_cache: {},
False, True, False, cw_lists,
lists_enabled, timezone, mitm,
bold_reading, dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
buy_sites)
return True
@ -2249,7 +2261,8 @@ def _receive_bookmark(recent_posts_cache: {},
max_like_count: int, cw_lists: {},
lists_enabled: {}, bold_reading: bool,
dogwhistles: {},
min_images_for_accounts: []) -> bool:
min_images_for_accounts: [],
buy_sites: {}) -> bool:
"""Receives a bookmark activity within the POST section of HTTPServer
"""
if not message_json.get('type'):
@ -2350,7 +2363,8 @@ def _receive_bookmark(recent_posts_cache: {},
False, True, False, cw_lists,
lists_enabled, timezone, mitm,
bold_reading, dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
buy_sites)
return True
@ -2372,7 +2386,8 @@ def _receive_undo_bookmark(recent_posts_cache: {},
max_like_count: int, cw_lists: {},
lists_enabled: str, bold_reading: bool,
dogwhistles: {},
min_images_for_accounts: []) -> bool:
min_images_for_accounts: [],
buy_sites: {}) -> bool:
"""Receives an undo bookmark activity within the POST section of HTTPServer
"""
if not message_json.get('type'):
@ -2473,7 +2488,8 @@ def _receive_undo_bookmark(recent_posts_cache: {},
manually_approve_followers,
False, True, False, cw_lists, lists_enabled,
timezone, mitm, bold_reading,
dogwhistles, minimize_all_images, None)
dogwhistles, minimize_all_images, None,
buy_sites)
return True
@ -2572,7 +2588,8 @@ def _receive_announce(recent_posts_cache: {},
max_like_count: int, cw_lists: {},
lists_enabled: str, bold_reading: bool,
dogwhistles: {}, mitm: bool,
min_images_for_accounts: []) -> bool:
min_images_for_accounts: [],
buy_sites: {}) -> bool:
"""Receives an announce activity within the POST section of HTTPServer
"""
if message_json['type'] != 'Announce':
@ -2714,7 +2731,8 @@ def _receive_announce(recent_posts_cache: {},
False, True, False, cw_lists,
lists_enabled, timezone, mitm,
bold_reading, dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
buy_sites)
if not announce_html:
print('WARN: Unable to generate html for announce ' +
str(message_json))
@ -3903,7 +3921,8 @@ def _receive_question_vote(server, base_dir: str, nickname: str, domain: str,
max_like_count: int,
cw_lists: {}, lists_enabled: bool,
bold_reading: bool, dogwhistles: {},
min_images_for_accounts: []) -> None:
min_images_for_accounts: [],
buy_sites: {}) -> None:
"""Updates the votes on a Question/poll
"""
# if this is a reply to a question then update the votes
@ -3961,7 +3980,8 @@ def _receive_question_vote(server, base_dir: str, nickname: str, domain: str,
False, True, False, cw_lists,
lists_enabled, timezone, mitm,
bold_reading, dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
buy_sites)
# add id to inbox index
inbox_update_index('inbox', base_dir, handle,
@ -4136,7 +4156,7 @@ def _inbox_after_initial(server, inbox_start_time,
languages_understood: [],
mitm: bool, bold_reading: bool,
dogwhistles: {},
max_hashtags: int) -> bool:
max_hashtags: int, buy_sites: {}) -> bool:
""" Anything which needs to be done after initial checks have passed
"""
# if this is a clearnet instance then replace any onion/i2p
@ -4185,7 +4205,8 @@ def _inbox_after_initial(server, inbox_start_time,
theme_name, system_language,
max_like_count, cw_lists, lists_enabled,
bold_reading, dogwhistles,
server.min_images_for_accounts):
server.min_images_for_accounts,
buy_sites):
if debug:
print('DEBUG: Like accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness,
@ -4211,7 +4232,8 @@ def _inbox_after_initial(server, inbox_start_time,
theme_name, system_language,
max_like_count, cw_lists, lists_enabled,
bold_reading, dogwhistles,
server.min_images_for_accounts):
server.min_images_for_accounts,
buy_sites):
if debug:
print('DEBUG: Undo like accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness,
@ -4238,7 +4260,8 @@ def _inbox_after_initial(server, inbox_start_time,
theme_name, system_language,
max_like_count, cw_lists, lists_enabled,
bold_reading, dogwhistles,
server.min_images_for_accounts):
server.min_images_for_accounts,
buy_sites):
if debug:
print('DEBUG: Reaction accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness,
@ -4265,7 +4288,8 @@ def _inbox_after_initial(server, inbox_start_time,
theme_name, system_language,
max_like_count, cw_lists, lists_enabled,
bold_reading, dogwhistles,
server.min_images_for_accounts):
server.min_images_for_accounts,
buy_sites):
if debug:
print('DEBUG: Zot reaction accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness,
@ -4293,7 +4317,8 @@ def _inbox_after_initial(server, inbox_start_time,
theme_name, system_language,
max_like_count, cw_lists, lists_enabled,
bold_reading, dogwhistles,
server.min_images_for_accounts):
server.min_images_for_accounts,
buy_sites):
if debug:
print('DEBUG: Undo reaction accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness,
@ -4321,7 +4346,8 @@ def _inbox_after_initial(server, inbox_start_time,
theme_name, system_language,
max_like_count, cw_lists, lists_enabled,
bold_reading, dogwhistles,
server.min_images_for_accounts):
server.min_images_for_accounts,
server.buy_sites):
if debug:
print('DEBUG: Bookmark accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness,
@ -4349,7 +4375,8 @@ def _inbox_after_initial(server, inbox_start_time,
theme_name, system_language,
max_like_count, cw_lists, lists_enabled,
bold_reading, dogwhistles,
server.min_images_for_accounts):
server.min_images_for_accounts,
server.buy_sites):
if debug:
print('DEBUG: Undo bookmark accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness,
@ -4385,7 +4412,8 @@ def _inbox_after_initial(server, inbox_start_time,
peertube_instances,
max_like_count, cw_lists, lists_enabled,
bold_reading, dogwhistles, mitm,
server.min_images_for_accounts):
server.min_images_for_accounts,
server.buy_sites):
if debug:
print('DEBUG: Announce accepted from ' + actor)
fitness_performance(inbox_start_time, server.fitness,
@ -4462,7 +4490,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.min_images_for_accounts,
server.buy_sites)
fitness_performance(inbox_start_time, server.fitness,
'INBOX', '_receive_question_vote',
debug)
@ -4779,7 +4808,8 @@ def _inbox_after_initial(server, inbox_start_time,
timezone, mitm,
bold_reading,
dogwhistles,
min_img_for_accounts)
min_img_for_accounts,
buy_sites)
fitness_performance(inbox_start_time,
server.fitness,
'INBOX',
@ -5840,7 +5870,7 @@ def run_inbox_queue(server,
theme_name, max_like_count,
cw_lists, dogwhistles,
server.min_images_for_accounts,
max_hashtags):
max_hashtags, server.buy_sites):
if debug:
print('Queue: Update accepted from ' + key_id)
if os.path.isfile(queue_filename):
@ -5969,7 +5999,7 @@ def run_inbox_queue(server,
content_license_url,
languages_understood, mitm,
bold_reading, dogwhistles,
max_hashtags)
max_hashtags, server.buy_sites)
fitness_performance(inbox_start_time, server.fitness,
'INBOX', 'handle_after_initial',
debug)

View File

@ -238,7 +238,8 @@ def post_message_to_outbox(session, translate: {},
lists_enabled: str,
content_license_url: str,
dogwhistles: {},
min_images_for_accounts: []) -> bool:
min_images_for_accounts: [],
buy_sites: {}) -> bool:
"""post is received by the outbox
Client to server message post
https://www.w3.org/TR/activitypub/#client-to-server-outbox-delivery
@ -593,7 +594,8 @@ def post_message_to_outbox(session, translate: {},
cw_lists, lists_enabled,
timezone, mitm,
bold_reading, dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
buy_sites)
if is_edited_post:
message_json['type'] = 'Update'

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@ -608,5 +608,7 @@
"Inactive": "غير نشط",
"Registrations open": "التسجيلات مفتوحة",
"Registrations remaining": "التسجيلات المتبقية",
"Edit reminder": "تحرير التذكير"
"Edit reminder": "تحرير التذكير",
"Purchase": "شراء",
"Subscribe": "الإشتراك"
}

View File

@ -608,5 +608,7 @@
"Inactive": "নিষ্ক্রিয়",
"Registrations open": "রেজিস্ট্রেশন খোলা",
"Registrations remaining": "রেজিস্ট্রেশন বাকি",
"Edit reminder": "অনুস্মারক সম্পাদনা করুন"
"Edit reminder": "অনুস্মারক সম্পাদনা করুন",
"Purchase": "ক্রয়",
"Subscribe": "সাবস্ক্রাইব"
}

View File

@ -608,5 +608,7 @@
"Inactive": "Inactiu",
"Registrations open": "Inscripcions obertes",
"Registrations remaining": "Inscripcions restants",
"Edit reminder": "Edita el recordatori"
"Edit reminder": "Edita el recordatori",
"Purchase": "Compra",
"Subscribe": "Subscriu-te"
}

View File

@ -608,5 +608,7 @@
"Inactive": "Anactif",
"Registrations open": "Cofrestriadau yn agor",
"Registrations remaining": "Cofrestriadau ar ôl",
"Edit reminder": "Golygu nodyn atgoffa"
"Edit reminder": "Golygu nodyn atgoffa",
"Purchase": "Prynu",
"Subscribe": "Tanysgrifio"
}

View File

@ -608,5 +608,7 @@
"Inactive": "Inaktiv",
"Registrations open": "Anmeldungen geöffnet",
"Registrations remaining": "Anmeldungen verbleiben",
"Edit reminder": "Erinnerung bearbeiten"
"Edit reminder": "Erinnerung bearbeiten",
"Purchase": "Kaufen",
"Subscribe": "Abonnieren"
}

View File

@ -608,5 +608,7 @@
"Inactive": "Αδρανής",
"Registrations open": "Οι εγγραφές ανοίγουν",
"Registrations remaining": "Απομένουν οι εγγραφές",
"Edit reminder": "Επεξεργασία υπενθύμισης"
"Edit reminder": "Επεξεργασία υπενθύμισης",
"Purchase": "Αγορά",
"Subscribe": "Εγγραφείτε"
}

View File

@ -608,5 +608,7 @@
"Inactive": "Inactive",
"Registrations open": "Registrations open",
"Registrations remaining": "Registrations remaining",
"Edit reminder": "Edit reminder"
"Edit reminder": "Edit reminder",
"Purchase": "Purchase",
"Subscribe": "Subscribe"
}

View File

@ -608,5 +608,7 @@
"Inactive": "Αδρανής",
"Registrations open": "Inscripciones abiertas",
"Registrations remaining": "Registros restantes",
"Edit reminder": "Editar recordatorio"
"Edit reminder": "Editar recordatorio",
"Purchase": "Compra",
"Subscribe": "Suscribir"
}

View File

@ -608,5 +608,7 @@
"Inactive": "غیر فعال",
"Registrations open": "ثبت نام ها باز شد",
"Registrations remaining": "ثبت نام باقی مانده است",
"Edit reminder": "ویرایش یادآوری"
"Edit reminder": "ویرایش یادآوری",
"Purchase": "خرید",
"Subscribe": "اشتراک در"
}

View File

@ -608,5 +608,7 @@
"Inactive": "Inactive",
"Registrations open": "Inscriptions ouvertes",
"Registrations remaining": "Inscriptions restantes",
"Edit reminder": "Modifier le rappel"
"Edit reminder": "Modifier le rappel",
"Purchase": "Acheter",
"Subscribe": "S'abonner"
}

View File

@ -608,5 +608,7 @@
"Inactive": "Neamhghníomhach",
"Registrations open": "Clárúcháin oscailte",
"Registrations remaining": "Clárúcháin fágtha",
"Edit reminder": "Cuir meabhrúchán in eagar"
"Edit reminder": "Cuir meabhrúchán in eagar",
"Purchase": "Ceannach",
"Subscribe": "Liostáil"
}

View File

@ -608,5 +608,7 @@
"Inactive": "निष्क्रिय",
"Registrations open": "पंजीकरण खुले हैं",
"Registrations remaining": "रजिस्ट्रेशन बाकी हैं",
"Edit reminder": "रिमाइंडर संपादित करें"
"Edit reminder": "रिमाइंडर संपादित करें",
"Purchase": "खरीदना",
"Subscribe": "सदस्यता लेने के"
}

View File

@ -608,5 +608,7 @@
"Inactive": "Non attivo",
"Registrations open": "Aperte le iscrizioni",
"Registrations remaining": "Iscrizioni rimanenti",
"Edit reminder": "Modifica promemoria"
"Edit reminder": "Modifica promemoria",
"Purchase": "Acquistare",
"Subscribe": "Sottoscrivi"
}

View File

@ -608,5 +608,7 @@
"Inactive": "非活性",
"Registrations open": "登録開始",
"Registrations remaining": "残りの登録数",
"Edit reminder": "リマインダーを編集"
"Edit reminder": "リマインダーを編集",
"Purchase": "購入",
"Subscribe": "申し込む"
}

View File

@ -608,5 +608,7 @@
"Inactive": "비활성",
"Registrations open": "등록 시작",
"Registrations remaining": "남은 등록",
"Edit reminder": "알림 수정"
"Edit reminder": "알림 수정",
"Purchase": "구입",
"Subscribe": "구독하다"
}

View File

@ -608,5 +608,7 @@
"Inactive": "Bêkar",
"Registrations open": "Qeydkirin vedibin",
"Registrations remaining": "Registrations maye",
"Edit reminder": "Bîranîna biguherîne"
"Edit reminder": "Bîranîna biguherîne",
"Purchase": "Kirrîn",
"Subscribe": "Subscribe"
}

View File

@ -608,5 +608,7 @@
"Inactive": "Inactief",
"Registrations open": "Inschrijvingen geopend",
"Registrations remaining": "Resterende inschrijvingen",
"Edit reminder": "Herinnering bewerken"
"Edit reminder": "Herinnering bewerken",
"Purchase": "Aankoop",
"Subscribe": "Abonneren"
}

View File

@ -604,5 +604,7 @@
"Inactive": "Inactive",
"Registrations open": "Registrations open",
"Registrations remaining": "Registrations remaining",
"Edit reminder": "Edit reminder"
"Edit reminder": "Edit reminder",
"Purchase": "Purchase",
"Subscribe": "Subscribe"
}

View File

@ -608,5 +608,7 @@
"Inactive": "Nieaktywny",
"Registrations open": "Rejestracje otwarte",
"Registrations remaining": "Pozostały zapisy",
"Edit reminder": "Edytuj przypomnienie"
"Edit reminder": "Edytuj przypomnienie",
"Purchase": "Zakup",
"Subscribe": "Subskrybuj"
}

View File

@ -608,5 +608,7 @@
"Inactive": "Inativa",
"Registrations open": "inscrições abertas",
"Registrations remaining": "Inscrições restantes",
"Edit reminder": "Editar lembrete"
"Edit reminder": "Editar lembrete",
"Purchase": "Comprar",
"Subscribe": "Se inscrever"
}

View File

@ -608,5 +608,7 @@
"Inactive": "Неактивный",
"Registrations open": "Регистрация открыта",
"Registrations remaining": "Осталось регистраций",
"Edit reminder": "Изменить напоминание"
"Edit reminder": "Изменить напоминание",
"Purchase": "Покупка",
"Subscribe": "Подписаться"
}

View File

@ -608,5 +608,7 @@
"Inactive": "Isiyotumika",
"Registrations open": "Usajili umefunguliwa",
"Registrations remaining": "Usajili uliosalia",
"Edit reminder": "Badilisha kikumbusho"
"Edit reminder": "Badilisha kikumbusho",
"Purchase": "Nunua",
"Subscribe": "Jisajili"
}

View File

@ -608,5 +608,7 @@
"Inactive": "etkin değil",
"Registrations open": "kayıtlar açık",
"Registrations remaining": "kalan kayıtlar",
"Edit reminder": "Hatırlatıcıyı düzenle"
"Edit reminder": "Hatırlatıcıyı düzenle",
"Purchase": "Satın alma",
"Subscribe": "Abone"
}

View File

@ -608,5 +608,7 @@
"Inactive": "Неактивний",
"Registrations open": "Реєстрація відкрита",
"Registrations remaining": "Залишилось реєстрацій",
"Edit reminder": "Редагувати нагадування"
"Edit reminder": "Редагувати нагадування",
"Purchase": "Купівля",
"Subscribe": "Підпишіться"
}

View File

@ -608,5 +608,7 @@
"Inactive": "ינאַקטיוו",
"Registrations open": "רעדזשיסטריישאַנז עפענען",
"Registrations remaining": "רעדזשיסטריישאַנז רוען",
"Edit reminder": "רעדאַגירן דערמאָנונג"
"Edit reminder": "רעדאַגירן דערמאָנונג",
"Purchase": "קויפן",
"Subscribe": "אַבאָנירן"
}

View File

@ -608,5 +608,7 @@
"Inactive": "无效",
"Registrations open": "注册开放",
"Registrations remaining": "剩余名额",
"Edit reminder": "编辑提醒"
"Edit reminder": "编辑提醒",
"Purchase": "购买",
"Subscribe": "订阅"
}

View File

@ -4166,7 +4166,7 @@ def save_reverse_timeline(base_dir: str, reverse_sequence: []) -> []:
def is_quote_toot(post_json_object: str, content: str) -> bool:
"""Returns true if the given post is a quote toot
"""Returns true if the given post is a quote toot / quote tweet
"""
# Pleroma/Misskey implementations
if post_json_object['object'].get('quoteUri') or \

View File

@ -40,7 +40,8 @@ def html_confirm_delete(server,
max_like_count: int, signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str,
dogwhistles: {},
min_images_for_accounts: []) -> str:
min_images_for_accounts: [],
buy_sites: {}) -> str:
"""Shows a screen asking to confirm the deletion of a post
"""
if '/statuses/' not in message_id:
@ -96,7 +97,7 @@ def html_confirm_delete(server,
False, False, False, False, False, False,
cw_lists, lists_enabled, timezone, mitm,
bold_reading, dogwhistles,
minimize_all_images, None)
minimize_all_images, None, buy_sites)
delete_post_str += '<center>'
delete_post_str += \
' <p class="followText">' + \

View File

@ -42,7 +42,7 @@ def html_conversation_view(post_id: str,
timezone: str, bold_reading: bool,
dogwhistles: {}, access_keys: {},
min_images_for_accounts: [],
debug: bool) -> str:
debug: bool, buy_sites: {}) -> str:
"""Show a page containing a conversation thread
"""
conv_posts = \
@ -96,7 +96,8 @@ def html_conversation_view(post_id: str,
cw_lists, lists_enabled,
timezone, False, bold_reading,
dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
buy_sites)
if post_str:
# check for "HTTP/1.1 303 See Other Server"
if 'X-AP-Instance-ID' not in post_str:

View File

@ -239,7 +239,8 @@ def html_new_post(edit_post_params: {},
dogwhistles: {},
min_images_for_accounts: [],
default_month: int, default_year: int,
default_post_language: str) -> str:
default_post_language: str,
buy_sites: {}) -> str:
"""New post screen
"""
# get the json if this is an edited post
@ -390,7 +391,8 @@ def html_new_post(edit_post_params: {},
cw_lists, lists_enabled,
timezone, False,
bold_reading, dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
buy_sites)
reply_str = '<input type="hidden" ' + \
'name="replyTo" value="' + in_reply_to + '">\n'

View File

@ -40,7 +40,8 @@ def _html_front_screen_posts(recent_posts_cache: {}, max_recent_posts: int,
lists_enabled: str,
bold_reading: bool,
dogwhistles: {},
min_images_for_accounts: []) -> str:
min_images_for_accounts: [],
buy_sites: {}) -> 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
@ -95,7 +96,8 @@ def _html_front_screen_posts(recent_posts_cache: {}, max_recent_posts: int,
cw_lists, lists_enabled,
timezone, False,
bold_reading, dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
buy_sites)
if post_str:
profile_str += post_str + separator_str
ctr += 1
@ -128,7 +130,8 @@ def html_front_screen(signing_priv_key_pem: str,
max_items_per_page: int,
cw_lists: {}, lists_enabled: str,
dogwhistles: {},
min_images_for_accounts: []) -> str:
min_images_for_accounts: [],
buy_sites: {}) -> str:
"""Show the news instance front screen
"""
bold_reading = False
@ -204,7 +207,8 @@ def html_front_screen(signing_priv_key_pem: str,
signing_priv_key_pem,
cw_lists, lists_enabled,
bold_reading, dogwhistles,
min_images_for_accounts) + license_str
min_images_for_accounts,
buy_sites) + license_str
# Footer which is only used for system accounts
profile_footer_str = ' </td>\n'

View File

@ -43,6 +43,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: {},
dict_name: str = 'likes') -> str:
"""Returns html for a screen showing who liked a post
"""
@ -113,7 +114,8 @@ def html_likers_of_post(base_dir: str, nickname: str,
cw_lists, lists_enabled,
timezone, mitm, bold_reading,
dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
buy_sites)
# show likers beneath the post
obj = post_json_object

View File

@ -61,7 +61,8 @@ def html_moderation(default_timeline: str,
timezone: str, bold_reading: bool,
dogwhistles: {}, ua_str: str,
min_images_for_accounts: [],
reverse_sequence: bool) -> str:
reverse_sequence: bool,
buy_sites: {}) -> str:
"""Show the moderation feed as html
This is what you see when selecting the "mod" timeline
"""
@ -88,7 +89,8 @@ def html_moderation(default_timeline: str,
max_like_count, 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)
min_images_for_accounts, reverse_sequence, None,
buy_sites)
def html_account_info(translate: {},

View File

@ -81,6 +81,7 @@ from content import get_mentions_from_html
from content import switch_words
from person import is_person_snoozed
from person import get_person_avatar_url
from webapp_utils import get_buy_links
from webapp_utils import language_right_to_left
from webapp_utils import get_banner_file
from webapp_utils import get_avatar_image_url
@ -1648,6 +1649,7 @@ def _get_footer_with_icons(show_icons: bool,
like_str: str, reaction_str: str,
bookmark_str: str,
delete_str: str, mute_str: str, edit_str: str,
buy_str: str,
post_json_object: {}, published_link: str,
time_class: str, published_str: str,
nickname: str, content_license_url: str,
@ -1661,7 +1663,7 @@ def _get_footer_with_icons(show_icons: bool,
footer_str += ' <div class="' + container_class_icons + '">\n'
footer_str += \
reply_str + announce_str + like_str + bookmark_str + reaction_str
footer_str += delete_str + mute_str + edit_str
footer_str += delete_str + mute_str + edit_str + buy_str
if not is_news_post(post_json_object):
footer_str += ' '
if content_license_url:
@ -1836,6 +1838,28 @@ def _get_copyright_footer(content_license_url: str,
return copyright_str
def _get_buy_footer(buy_links: {}, translate: {}) -> str:
"""Returns the footer buy link
"""
if not buy_links:
return ''
icon_filename = 'buy.png'
buy_title, buy_url = buy_links.items()[0]
if buy_title:
description = buy_title
else:
description = translate['Buy']
buy_str = \
' ' + \
'<a class="imageAnchor" href="' + buy_url + \
'" title="' + description + '" tabindex="10">' + \
'<img loading="lazy" decoding="async" title="' + \
description + '" alt="' + description + \
' |" src="/icons/' + icon_filename + '"/></a>\n'
return buy_str
def individual_post_as_html(signing_priv_key_pem: str,
allow_downloads: bool,
recent_posts_cache: {}, max_recent_posts: int,
@ -1867,7 +1891,8 @@ def individual_post_as_html(signing_priv_key_pem: str,
mitm: bool, bold_reading: bool,
dogwhistles: {},
minimize_all_images: bool,
first_post_id: str) -> str:
first_post_id: str,
buy_sites: {}) -> str:
""" Shows a single post as html
"""
if not post_json_object:
@ -2475,12 +2500,23 @@ def individual_post_as_html(signing_priv_key_pem: str,
if disallow_reply(content_all_str):
reply_str = ''
is_patch = is_git_patch(base_dir, nickname, domain,
post_json_object['object']['type'],
summary_str, content_str)
# html for the buy icon
buy_str = ''
if post_json_object['object'].get('tag'):
if not is_patch:
buy_links = get_buy_links(post_json_object, translate, buy_sites)
buy_str = _get_buy_footer(buy_links, translate)
new_footer_str = \
_get_footer_with_icons(show_icons,
container_class_icons,
reply_str, announce_str,
like_str, reaction_str, bookmark_str,
delete_str, mute_str, edit_str,
delete_str, mute_str, edit_str, buy_str,
post_json_object, published_link,
time_class, published_str, nickname,
content_license_url, translate)
@ -2495,9 +2531,6 @@ def individual_post_as_html(signing_priv_key_pem: str,
if not summary_str:
summary_str = get_summary_from_post(post_json_object, system_language,
languages_understood)
is_patch = is_git_patch(base_dir, nickname, domain,
post_json_object['object']['type'],
summary_str, content_str)
_log_post_timing(enable_timing_log, post_start_time, '16')
@ -2582,13 +2615,14 @@ def individual_post_as_html(signing_priv_key_pem: str,
_log_post_timing(enable_timing_log, post_start_time, '17')
map_str = ''
buy_links = {}
if post_json_object['object'].get('tag'):
if not is_patch:
content_str = \
replace_emoji_from_tags(session, base_dir, content_str,
post_json_object['object']['tag'],
'content', False, True)
buy_links = get_buy_links(post_json_object, translate, buy_sites)
# show embedded map if the location contains a map url
location_str = \
get_location_from_tags(post_json_object['object']['tag'])
@ -2707,7 +2741,8 @@ def html_individual_post(recent_posts_cache: {}, max_recent_posts: int,
cw_lists: {}, lists_enabled: str,
timezone: str, mitm: bool,
bold_reading: bool, dogwhistles: {},
min_images_for_accounts: []) -> str:
min_images_for_accounts: [],
buy_sites: {}) -> str:
"""Show an individual post as html
"""
original_post_json = post_json_object
@ -2791,7 +2826,7 @@ 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)
minimize_all_images, None, buy_sites)
message_id = remove_id_ending(post_json_object['id'])
# show the previous posts
@ -2835,7 +2870,7 @@ def html_individual_post(recent_posts_cache: {}, max_recent_posts: int,
bold_reading,
dogwhistles,
minimize_all_images,
None) + post_str
None, buy_sites) + post_str
# show the following posts
post_filename = locate_post(base_dir, nickname, domain, message_id)
@ -2875,7 +2910,8 @@ def html_individual_post(recent_posts_cache: {}, max_recent_posts: int,
cw_lists, lists_enabled,
timezone, False,
bold_reading, dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
buy_sites)
css_filename = base_dir + '/epicyon-profile.css'
if os.path.isfile(base_dir + '/epicyon.css'):
css_filename = base_dir + '/epicyon.css'
@ -2906,7 +2942,8 @@ def html_post_replies(recent_posts_cache: {}, max_recent_posts: int,
lists_enabled: str,
timezone: str, bold_reading: bool,
dogwhistles: {},
min_images_for_accounts: []) -> str:
min_images_for_accounts: [],
buy_sites: {}) -> str:
"""Show the replies to an individual post as html
"""
replies_str = ''
@ -2937,7 +2974,8 @@ def html_post_replies(recent_posts_cache: {}, max_recent_posts: int,
cw_lists, lists_enabled,
timezone, False,
bold_reading, dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
buy_sites)
css_filename = base_dir + '/epicyon-profile.css'
if os.path.isfile(base_dir + '/epicyon.css'):
@ -2968,7 +3006,8 @@ def html_emoji_reaction_picker(recent_posts_cache: {}, max_recent_posts: int,
box_name: str, page_number: int,
timezone: str, bold_reading: bool,
dogwhistles: {},
min_images_for_accounts: []) -> str:
min_images_for_accounts: [],
buy_sites: {}) -> str:
"""Returns the emoji picker screen
"""
minimize_all_images = False
@ -2996,7 +3035,7 @@ 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)
minimize_all_images, None, buy_sites)
reactions_filename = base_dir + '/emoji/reactions.json'
if not os.path.isfile(reactions_filename):

View File

@ -164,7 +164,8 @@ def html_profile_after_search(recent_posts_cache: {}, max_recent_posts: int,
timezone: str,
onion_domain: str, i2p_domain: str,
bold_reading: bool, dogwhistles: {},
min_images_for_accounts: []) -> str:
min_images_for_accounts: [],
buy_sites: {}) -> str:
"""Show a profile page after a search for a fediverse address
"""
http = False
@ -416,7 +417,8 @@ def html_profile_after_search(recent_posts_cache: {}, max_recent_posts: int,
cw_lists, lists_enabled,
timezone, False,
bold_reading, dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
buy_sites)
i += 1
if i >= 8:
break
@ -646,7 +648,8 @@ def html_profile(signing_priv_key_pem: str,
max_items_per_page: int,
cw_lists: {}, lists_enabled: str,
content_license_url: str,
timezone: str, bold_reading: bool) -> str:
timezone: str, bold_reading: bool,
buy_sites: {}) -> str:
"""Show the profile page as html
"""
show_moved_accounts = False
@ -678,7 +681,7 @@ 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)
min_images_for_accounts, buy_sites)
domain, port = get_domain_from_actor(profile_json['id'])
if not domain:
@ -1169,7 +1172,8 @@ def html_profile(signing_priv_key_pem: str,
cw_lists, lists_enabled,
timezone, bold_reading, {},
min_images_for_accounts,
max_profile_posts) + license_str
max_profile_posts,
buy_sites) + license_str
if not is_group:
if selected == 'following':
profile_str += \
@ -1269,7 +1273,8 @@ def _html_profile_posts(recent_posts_cache: {}, max_recent_posts: int,
timezone: str, bold_reading: bool,
dogwhistles: {},
min_images_for_accounts: [],
max_profile_posts: int) -> str:
max_profile_posts: int,
buy_sites: {}) -> str:
"""Shows posts on the profile screen
These should only be public posts
"""
@ -1327,7 +1332,8 @@ def _html_profile_posts(recent_posts_cache: {}, max_recent_posts: int,
cw_lists, lists_enabled,
timezone, False,
bold_reading, dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
buy_sites)
if post_str and item_id not in shown_items:
profile_str += post_str + separator_str
shown_items.append(item_id)

View File

@ -702,7 +702,8 @@ def html_history_search(translate: {}, base_dir: str,
lists_enabled: str,
timezone: str, bold_reading: bool,
dogwhistles: {}, access_keys: {},
min_images_for_accounts: []) -> str:
min_images_for_accounts: [],
buy_sites: {}) -> str:
"""Show a page containing search results for your post history
"""
if historysearch.startswith("'"):
@ -812,7 +813,8 @@ def html_history_search(translate: {}, base_dir: str,
cw_lists, lists_enabled,
timezone, False, bold_reading,
dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
buy_sites)
if post_str:
history_search_form += separator_str + post_str
index += 1
@ -840,7 +842,8 @@ def html_hashtag_search(nickname: str, domain: str, port: int,
timezone: str, bold_reading: bool,
dogwhistles: {}, map_format: str,
access_keys: {}, box_name: str,
min_images_for_accounts: []) -> str:
min_images_for_accounts: [],
buy_sites: {}) -> str:
"""Show a page containing search results for a hashtag
or after selecting a hashtag from the swarm
"""
@ -1032,7 +1035,8 @@ def html_hashtag_search(nickname: str, domain: str, port: int,
store_to_sache, False, cw_lists,
lists_enabled, timezone, False,
bold_reading, dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
buy_sites)
if post_str:
hashtag_search_form += \
text_mode_separator + separator_str + post_str
@ -1075,7 +1079,7 @@ def html_hashtag_search_remote(nickname: str, domain: str, port: int,
timezone: str, bold_reading: bool,
dogwhistles: {},
min_images_for_accounts: [],
debug: bool) -> str:
debug: bool, buy_sites: {}) -> str:
"""Show a page containing search results for a remote hashtag
"""
hashtag = hashtag_url.split('/')[-1]
@ -1235,7 +1239,8 @@ def html_hashtag_search_remote(nickname: str, domain: str, port: int,
store_to_sache, False, cw_lists,
lists_enabled, timezone, False,
bold_reading, dogwhistles,
minimize_all_images, None)
minimize_all_images, None,
buy_sites)
if post_str:
hashtag_search_form += \
text_mode_separator + separator_str + post_str

View File

@ -501,7 +501,8 @@ def html_timeline(default_timeline: str,
dogwhistles: {}, ua_str: str,
min_images_for_accounts: [],
reverse_sequence: bool,
last_post_id: str) -> str:
last_post_id: str,
buy_sites: {}) -> str:
"""Show the timeline as html
"""
enable_timing_log = False
@ -1037,7 +1038,7 @@ def html_timeline(default_timeline: str,
timezone, mitm,
bold_reading, dogwhistles,
minimize_all_images,
first_post_id)
first_post_id, buy_sites)
_log_timeline_timing(enable_timing_log,
timeline_start_time, box_name, '12')
@ -1306,7 +1307,8 @@ def html_shares(default_timeline: str,
timezone: str, bold_reading: bool,
dogwhistles: {}, ua_str: str,
min_images_for_accounts: [],
reverse_sequence: bool) -> str:
reverse_sequence: bool,
buy_sites: {}) -> str:
"""Show the shares timeline as html
"""
manually_approve_followers = \
@ -1339,7 +1341,7 @@ def html_shares(default_timeline: str,
cw_lists, lists_enabled, timezone,
bold_reading, dogwhistles, ua_str,
min_images_for_accounts,
reverse_sequence, None)
reverse_sequence, None, buy_sites)
def html_wanted(default_timeline: str,
@ -1371,7 +1373,8 @@ def html_wanted(default_timeline: str,
timezone: str, bold_reading: bool,
dogwhistles: {}, ua_str: str,
min_images_for_accounts: [],
reverse_sequence: bool) -> str:
reverse_sequence: bool,
buy_sites: {}) -> str:
"""Show the wanted timeline as html
"""
manually_approve_followers = \
@ -1404,7 +1407,7 @@ def html_wanted(default_timeline: str,
cw_lists, lists_enabled, timezone,
bold_reading, dogwhistles, ua_str,
min_images_for_accounts,
reverse_sequence, None)
reverse_sequence, None, buy_sites)
def html_inbox(default_timeline: str,
@ -1438,7 +1441,8 @@ def html_inbox(default_timeline: str,
dogwhistles: {}, ua_str: str,
min_images_for_accounts: [],
reverse_sequence: bool,
last_post_id: str) -> str:
last_post_id: str,
buy_sites: {}) -> str:
"""Show the inbox as html
"""
manually_approve_followers = \
@ -1471,7 +1475,8 @@ def html_inbox(default_timeline: str,
cw_lists, lists_enabled, timezone,
bold_reading, dogwhistles, ua_str,
min_images_for_accounts,
reverse_sequence, last_post_id)
reverse_sequence, last_post_id,
buy_sites)
def html_bookmarks(default_timeline: str,
@ -1504,7 +1509,8 @@ def html_bookmarks(default_timeline: str,
timezone: str, bold_reading: bool,
dogwhistles: {}, ua_str: str,
min_images_for_accounts: [],
reverse_sequence: bool) -> str:
reverse_sequence: bool,
buy_sites: {}) -> str:
"""Show the bookmarks as html
"""
manually_approve_followers = \
@ -1536,7 +1542,7 @@ def html_bookmarks(default_timeline: str,
cw_lists, lists_enabled, timezone,
bold_reading, dogwhistles, ua_str,
min_images_for_accounts,
reverse_sequence, None)
reverse_sequence, None, buy_sites)
def html_inbox_dms(default_timeline: str,
@ -1570,7 +1576,8 @@ def html_inbox_dms(default_timeline: str,
dogwhistles: {}, ua_str: str,
min_images_for_accounts: [],
reverse_sequence: bool,
last_post_id: str) -> str:
last_post_id: str,
buy_sites: {}) -> str:
"""Show the DM timeline as html
"""
artist = is_artist(base_dir, nickname)
@ -1598,7 +1605,8 @@ def html_inbox_dms(default_timeline: str,
cw_lists, lists_enabled, timezone,
bold_reading, dogwhistles, ua_str,
min_images_for_accounts,
reverse_sequence, last_post_id)
reverse_sequence, last_post_id,
buy_sites)
def html_inbox_replies(default_timeline: str,
@ -1632,7 +1640,8 @@ def html_inbox_replies(default_timeline: str,
dogwhistles: {}, ua_str: str,
min_images_for_accounts: [],
reverse_sequence: bool,
last_post_id: str) -> str:
last_post_id: str,
buy_sites: {}) -> str:
"""Show the replies timeline as html
"""
artist = is_artist(base_dir, nickname)
@ -1658,7 +1667,7 @@ 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)
reverse_sequence, last_post_id, buy_sites)
def html_inbox_media(default_timeline: str,
@ -1692,7 +1701,8 @@ def html_inbox_media(default_timeline: str,
dogwhistles: {}, ua_str: str,
min_images_for_accounts: [],
reverse_sequence: bool,
last_post_id: str) -> str:
last_post_id: str,
buy_sites: {}) -> str:
"""Show the media timeline as html
"""
artist = is_artist(base_dir, nickname)
@ -1718,7 +1728,7 @@ 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)
reverse_sequence, last_post_id, buy_sites)
def html_inbox_blogs(default_timeline: str,
@ -1752,7 +1762,8 @@ def html_inbox_blogs(default_timeline: str,
dogwhistles: {}, ua_str: str,
min_images_for_accounts: [],
reverse_sequence: bool,
last_post_id: str) -> str:
last_post_id: str,
buy_sites: {}) -> str:
"""Show the blogs timeline as html
"""
artist = is_artist(base_dir, nickname)
@ -1778,7 +1789,7 @@ 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)
reverse_sequence, last_post_id, buy_sites)
def html_inbox_features(default_timeline: str,
@ -1812,7 +1823,8 @@ def html_inbox_features(default_timeline: str,
timezone: str, bold_reading: bool,
dogwhistles: {}, ua_str: str,
min_images_for_accounts: [],
reverse_sequence: bool) -> str:
reverse_sequence: bool,
buy_sites: {}) -> str:
"""Show the features timeline as html
"""
return html_timeline(default_timeline,
@ -1837,7 +1849,7 @@ 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)
reverse_sequence, None, buy_sites)
def html_inbox_news(default_timeline: str,
@ -1870,7 +1882,8 @@ def html_inbox_news(default_timeline: str,
timezone: str, bold_reading: bool,
dogwhistles: {}, ua_str: str,
min_images_for_accounts: [],
reverse_sequence: bool) -> str:
reverse_sequence: bool,
buy_sites: {}) -> str:
"""Show the news timeline as html
"""
return html_timeline(default_timeline,
@ -1895,7 +1908,7 @@ 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)
reverse_sequence, None, buy_sites)
def html_outbox(default_timeline: str,
@ -1928,7 +1941,8 @@ def html_outbox(default_timeline: str,
timezone: str, bold_reading: bool,
dogwhistles: {}, ua_str: str,
min_images_for_accounts: [],
reverse_sequence: bool) -> str:
reverse_sequence: bool,
buy_sites: {}) -> str:
"""Show the Outbox as html
"""
manually_approve_followers = \
@ -1956,4 +1970,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)
reverse_sequence, None, buy_sites)

View File

@ -2080,3 +2080,59 @@ def html_following_dropdown(base_dir: str, nickname: str,
following_address + '</option>\n'
list_str += '</select>\n'
return list_str
def get_buy_links(post_json_object: str, translate: {}, buy_sites: {}) -> {}:
"""Returns any links to buy something from an external site
"""
if not post_json_object['object'].get('tag'):
return {}
if not isinstance(post_json_object['object']['tag'], list):
return {}
links = {}
buy_strings = []
buy_strings += translate['Buy'].lower()
buy_strings += translate['Purchase'].lower()
buy_strings += translate['Subscribe'].lower()
for item in post_json_object['object']['tag']:
if not isinstance(item, dict):
continue
if not item.get('name'):
continue
if not isinstance(item['name'], str):
continue
if not item.get('type'):
continue
if not item.get('href'):
continue
if not isinstance(item['type'], str):
continue
if not isinstance(item['href'], str):
continue
if item['type'] != 'Link':
continue
if not item.get('mediaType'):
continue
if not isinstance(item['mediaType'], str):
continue
if 'html' not in item['mediaType']:
continue
item_name = item['name']
# there should be no html in the name
if remove_html(item_name) != item_name:
continue
# there should be no html in the link
if '<' in item['href'] or \
'://' not in item['href']:
continue
# does the name indicate buying?
for buy_str in buy_strings:
if buy_str in item_name.lower():
links[item_name] = item['href']
continue
# is the link on an allowlist of sites?
for site, keyword in buy_sites.items():
if keyword in item['href']:
links[site.title()] = item['href']
continue
return links