mirror of https://gitlab.com/bashrc2/epicyon
Merge branch 'main' of gitlab.com:bashrc2/epicyon
commit
d449b7d26a
|
@ -200,8 +200,8 @@ def create_announce(session, base_dir: str, federation_list: [],
|
|||
send_signed_json(new_announce, session, base_dir,
|
||||
nickname, domain, port,
|
||||
announce_nickname, announce_domain,
|
||||
announce_port, None,
|
||||
http_prefix, True, client_to_server, federation_list,
|
||||
announce_port,
|
||||
http_prefix, client_to_server, federation_list,
|
||||
send_threads, post_log, cached_webfingers,
|
||||
person_cache,
|
||||
debug, project_version, None, group_account,
|
||||
|
|
|
@ -469,8 +469,7 @@ def outbox_block(base_dir: str, http_prefix: str,
|
|||
return True
|
||||
|
||||
|
||||
def outbox_undo_block(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
def outbox_undo_block(base_dir: str, nickname: str, domain: str,
|
||||
message_json: {}, debug: bool) -> None:
|
||||
""" When an undo block request is received by the outbox from c2s
|
||||
"""
|
||||
|
|
6
blog.py
6
blog.py
|
@ -541,7 +541,7 @@ def html_blog_page(authorized: bool, session,
|
|||
return blog_str + html_footer()
|
||||
|
||||
timeline_json = \
|
||||
create_blogs_timeline(session, base_dir,
|
||||
create_blogs_timeline(base_dir,
|
||||
nickname, domain, port, http_prefix,
|
||||
no_of_items, False, page_number)
|
||||
|
||||
|
@ -629,7 +629,7 @@ def html_blog_page_rss2(authorized: bool, session,
|
|||
return blog_rss2 + rss2footer()
|
||||
return blog_rss2
|
||||
|
||||
timeline_json = create_blogs_timeline(session, base_dir,
|
||||
timeline_json = create_blogs_timeline(base_dir,
|
||||
nickname, domain, port,
|
||||
http_prefix,
|
||||
no_of_items, False,
|
||||
|
@ -677,7 +677,7 @@ def html_blog_page_rss3(authorized: bool, session,
|
|||
return blog_rss3
|
||||
|
||||
timeline_json = \
|
||||
create_blogs_timeline(session, base_dir,
|
||||
create_blogs_timeline(base_dir,
|
||||
nickname, domain, port, http_prefix,
|
||||
no_of_items, False, page_number)
|
||||
|
||||
|
|
60
content.py
60
content.py
|
@ -1273,8 +1273,9 @@ def save_media_in_form_post(media_bytes, debug: bool,
|
|||
extension = 'mp3'
|
||||
if filename_base:
|
||||
filename = filename_base + '.' + extension
|
||||
search_lst = search_str.decode().split('/', maxsplit=1)
|
||||
attachment_media_type = \
|
||||
search_str.decode().split('/')[0].replace('Content-Type: ', '')
|
||||
search_lst[0].replace('Content-Type: ', '')
|
||||
detected_extension = extension
|
||||
break
|
||||
|
||||
|
@ -1331,15 +1332,15 @@ def save_media_in_form_post(media_bytes, debug: bool,
|
|||
|
||||
|
||||
def extract_text_fields_in_post(post_bytes, boundary: str, debug: bool,
|
||||
unit_testData: str = None) -> {}:
|
||||
unit_test_data: str = None) -> {}:
|
||||
"""Returns a dictionary containing the text fields of a http form POST
|
||||
The boundary argument comes from the http header
|
||||
"""
|
||||
if not unit_testData:
|
||||
if not unit_test_data:
|
||||
msg_bytes = email.parser.BytesParser().parsebytes(post_bytes)
|
||||
message_fields = msg_bytes.get_payload(decode=True).decode('utf-8')
|
||||
else:
|
||||
message_fields = unit_testData
|
||||
message_fields = unit_test_data
|
||||
|
||||
if debug:
|
||||
print('DEBUG: POST arriving ' + message_fields)
|
||||
|
@ -1690,30 +1691,31 @@ def remove_script(content: str, log_filename: str,
|
|||
for sep in separators:
|
||||
prefix = sep[0] + 'script'
|
||||
ending = '/script' + sep[1]
|
||||
if prefix in content:
|
||||
sections = content.split(prefix)
|
||||
ctr = 0
|
||||
for text in sections:
|
||||
if ctr == 0:
|
||||
ctr += 1
|
||||
if prefix not in content:
|
||||
continue
|
||||
sections = content.split(prefix)
|
||||
ctr = 0
|
||||
for text in sections:
|
||||
if ctr == 0:
|
||||
ctr += 1
|
||||
continue
|
||||
if ending not in text:
|
||||
if '/' + sep[1] not in text:
|
||||
continue
|
||||
if ending not in text:
|
||||
if '/' + sep[1] not in text:
|
||||
continue
|
||||
if ending in text:
|
||||
text = prefix + text.split(ending)[0] + ending
|
||||
else:
|
||||
text = prefix + text.split('/' + sep[1])[0] + '/' + sep[1]
|
||||
if log_filename and actor:
|
||||
# write the detected script to a log file
|
||||
log_str = actor + ' ' + url + ' ' + text + '\n'
|
||||
write_type = 'a+'
|
||||
if os.path.isfile(log_filename):
|
||||
write_type = 'w+'
|
||||
try:
|
||||
with open(log_filename, write_type) as fp_log:
|
||||
fp_log.write(log_str)
|
||||
except OSError:
|
||||
print('EX: cannot append to svg script log')
|
||||
content = content.replace(text, '')
|
||||
if ending in text:
|
||||
text = prefix + text.split(ending)[0] + ending
|
||||
else:
|
||||
text = prefix + text.split('/' + sep[1])[0] + '/' + sep[1]
|
||||
if log_filename and actor:
|
||||
# write the detected script to a log file
|
||||
log_str = actor + ' ' + url + ' ' + text + '\n'
|
||||
write_type = 'a+'
|
||||
if os.path.isfile(log_filename):
|
||||
write_type = 'w+'
|
||||
try:
|
||||
with open(log_filename, write_type) as fp_log:
|
||||
fp_log.write(log_str)
|
||||
except OSError:
|
||||
print('EX: cannot append to svg script log')
|
||||
content = content.replace(text, '')
|
||||
return content
|
||||
|
|
84
daemon.py
84
daemon.py
|
@ -544,7 +544,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
nickname,
|
||||
self.server.domain, self.server.port,
|
||||
self.server.http_prefix,
|
||||
answer, False, False, False,
|
||||
answer, False, False,
|
||||
comments_enabled,
|
||||
attach_image_filename, media_type,
|
||||
image_description, city,
|
||||
|
@ -3835,8 +3835,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if self.server.bold_reading.get(nickname):
|
||||
bold_reading = True
|
||||
hashtag_str = \
|
||||
html_hashtag_search(self.server.css_cache,
|
||||
nickname, domain, port,
|
||||
html_hashtag_search(nickname, domain, port,
|
||||
self.server.recent_posts_cache,
|
||||
self.server.max_recent_posts,
|
||||
self.server.translate,
|
||||
|
@ -3881,10 +3880,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
search_str = search_str.replace('*', '').strip()
|
||||
skill_str = \
|
||||
html_skills_search(actor_str,
|
||||
self.server.css_cache,
|
||||
self.server.translate,
|
||||
base_dir,
|
||||
http_prefix,
|
||||
search_str,
|
||||
self.server.instance_only_skills_search,
|
||||
64)
|
||||
|
@ -3940,8 +3937,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if self.server.bold_reading.get(nickname):
|
||||
bold_reading = True
|
||||
history_str = \
|
||||
html_history_search(self.server.css_cache,
|
||||
self.server.translate,
|
||||
html_history_search(self.server.translate,
|
||||
base_dir,
|
||||
http_prefix,
|
||||
nickname,
|
||||
|
@ -4021,8 +4017,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if self.server.bold_reading.get(nickname):
|
||||
bold_reading = True
|
||||
bookmarks_str = \
|
||||
html_history_search(self.server.css_cache,
|
||||
self.server.translate,
|
||||
html_history_search(self.server.translate,
|
||||
base_dir,
|
||||
http_prefix,
|
||||
nickname,
|
||||
|
@ -4187,8 +4182,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
bold_reading = True
|
||||
|
||||
profile_str = \
|
||||
html_profile_after_search(self.server.css_cache,
|
||||
recent_posts_cache,
|
||||
html_profile_after_search(recent_posts_cache,
|
||||
self.server.max_recent_posts,
|
||||
self.server.translate,
|
||||
base_dir,
|
||||
|
@ -4243,10 +4237,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
search_str.replace(' emoji', '')
|
||||
# emoji search
|
||||
emoji_str = \
|
||||
html_search_emoji(self.server.css_cache,
|
||||
self.server.translate,
|
||||
html_search_emoji(self.server.translate,
|
||||
base_dir,
|
||||
http_prefix,
|
||||
search_str)
|
||||
if emoji_str:
|
||||
msg = emoji_str.encode('utf-8')
|
||||
|
@ -4261,8 +4253,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
shared_items_federated_domains = \
|
||||
self.server.shared_items_federated_domains
|
||||
wanted_items_str = \
|
||||
html_search_shared_items(self.server.css_cache,
|
||||
self.server.translate,
|
||||
html_search_shared_items(self.server.translate,
|
||||
base_dir,
|
||||
search_str[1:], page_number,
|
||||
MAX_POSTS_IN_FEED,
|
||||
|
@ -4284,8 +4275,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
shared_items_federated_domains = \
|
||||
self.server.shared_items_federated_domains
|
||||
shared_items_str = \
|
||||
html_search_shared_items(self.server.css_cache,
|
||||
self.server.translate,
|
||||
html_search_shared_items(self.server.translate,
|
||||
base_dir,
|
||||
search_str, page_number,
|
||||
MAX_POSTS_IN_FEED,
|
||||
|
@ -5998,12 +5988,12 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
current_show_languages = get_actor_languages(actor_json)
|
||||
if fields.get('showLanguages'):
|
||||
if fields['showLanguages'] != current_show_languages:
|
||||
set_actor_languages(base_dir, actor_json,
|
||||
set_actor_languages(actor_json,
|
||||
fields['showLanguages'])
|
||||
actor_changed = True
|
||||
else:
|
||||
if current_show_languages:
|
||||
set_actor_languages(base_dir, actor_json, '')
|
||||
set_actor_languages(actor_json, '')
|
||||
actor_changed = True
|
||||
|
||||
# change time zone
|
||||
|
@ -8353,7 +8343,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
hashtag = urllib.parse.unquote_plus(hashtag)
|
||||
if is_blocked_hashtag(base_dir, hashtag):
|
||||
print('BLOCK: hashtag #' + hashtag)
|
||||
msg = html_hashtag_blocked(self.server.css_cache, base_dir,
|
||||
msg = html_hashtag_blocked(base_dir,
|
||||
self.server.translate).encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._login_headers('text/html', msglen, calling_domain)
|
||||
|
@ -8374,8 +8364,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if self.server.bold_reading.get(nickname):
|
||||
bold_reading = True
|
||||
hashtag_str = \
|
||||
html_hashtag_search(self.server.css_cache,
|
||||
nickname, domain, port,
|
||||
html_hashtag_search(nickname, domain, port,
|
||||
self.server.recent_posts_cache,
|
||||
self.server.max_recent_posts,
|
||||
self.server.translate,
|
||||
|
@ -9877,8 +9866,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
bold_reading = True
|
||||
|
||||
msg = \
|
||||
html_emoji_reaction_picker(self.server.css_cache,
|
||||
self.server.recent_posts_cache,
|
||||
html_emoji_reaction_picker(self.server.recent_posts_cache,
|
||||
self.server.max_recent_posts,
|
||||
self.server.translate,
|
||||
self.server.base_dir,
|
||||
|
@ -10681,8 +10669,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if self.server.bold_reading.get(nickname):
|
||||
bold_reading = True
|
||||
msg = \
|
||||
html_post_replies(self.server.css_cache,
|
||||
recent_posts_cache,
|
||||
html_post_replies(recent_posts_cache,
|
||||
max_recent_posts,
|
||||
translate,
|
||||
base_dir,
|
||||
|
@ -10786,8 +10773,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if self.server.bold_reading.get(nickname):
|
||||
bold_reading = True
|
||||
msg = \
|
||||
html_post_replies(self.server.css_cache,
|
||||
recent_posts_cache,
|
||||
html_post_replies(recent_posts_cache,
|
||||
max_recent_posts,
|
||||
translate,
|
||||
base_dir,
|
||||
|
@ -11397,8 +11383,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
bold_reading = True
|
||||
|
||||
msg = \
|
||||
html_individual_post(self.server.css_cache,
|
||||
self.server.recent_posts_cache,
|
||||
html_individual_post(self.server.recent_posts_cache,
|
||||
self.server.max_recent_posts,
|
||||
self.server.translate,
|
||||
base_dir,
|
||||
|
@ -16226,17 +16211,14 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if self.path.startswith('/terms'):
|
||||
if calling_domain.endswith('.onion') and \
|
||||
self.server.onion_domain:
|
||||
msg = html_terms_of_service(self.server.css_cache,
|
||||
self.server.base_dir, 'http',
|
||||
msg = html_terms_of_service(self.server.base_dir, 'http',
|
||||
self.server.onion_domain)
|
||||
elif (calling_domain.endswith('.i2p') and
|
||||
self.server.i2p_domain):
|
||||
msg = html_terms_of_service(self.server.css_cache,
|
||||
self.server.base_dir, 'http',
|
||||
msg = html_terms_of_service(self.server.base_dir, 'http',
|
||||
self.server.i2p_domain)
|
||||
else:
|
||||
msg = html_terms_of_service(self.server.css_cache,
|
||||
self.server.base_dir,
|
||||
msg = html_terms_of_service(self.server.base_dir,
|
||||
self.server.http_prefix,
|
||||
self.server.domain_full)
|
||||
msg = msg.encode('utf-8')
|
||||
|
@ -16265,8 +16247,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if not os.path.isfile(following_filename):
|
||||
self._404()
|
||||
return
|
||||
msg = html_following_list(self.server.css_cache,
|
||||
self.server.base_dir, following_filename)
|
||||
msg = html_following_list(self.server.base_dir, following_filename)
|
||||
msglen = len(msg)
|
||||
self._login_headers('text/html', msglen, calling_domain)
|
||||
self._write(msg.encode('utf-8'))
|
||||
|
@ -16435,9 +16416,6 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.domain):
|
||||
msg = \
|
||||
html_welcome_final(self.server.base_dir, nickname,
|
||||
self.server.domain,
|
||||
self.server.http_prefix,
|
||||
self.server.domain_full,
|
||||
self.server.system_language,
|
||||
self.server.translate,
|
||||
self.server.theme_name)
|
||||
|
@ -17016,8 +16994,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
access_keys = self.server.key_shortcuts[nickname]
|
||||
|
||||
# show the search screen
|
||||
msg = html_search(self.server.css_cache,
|
||||
self.server.translate,
|
||||
msg = html_search(self.server.translate,
|
||||
self.server.base_dir, self.path,
|
||||
self.server.domain,
|
||||
self.server.default_timeline,
|
||||
|
@ -17171,8 +17148,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if self.path.endswith('/searchemoji'):
|
||||
# show the search screen
|
||||
msg = \
|
||||
html_search_emoji_text_entry(self.server.css_cache,
|
||||
self.server.translate,
|
||||
html_search_emoji_text_entry(self.server.translate,
|
||||
self.server.base_dir,
|
||||
self.path).encode('utf-8')
|
||||
msglen = len(msg)
|
||||
|
@ -18902,7 +18878,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.port,
|
||||
self.server.http_prefix,
|
||||
mentions_str + fields['message'],
|
||||
False, False, False, comments_enabled,
|
||||
False, False, comments_enabled,
|
||||
filename, attachment_media_type,
|
||||
fields['imageDescription'],
|
||||
city,
|
||||
|
@ -18928,8 +18904,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
sys_language)
|
||||
followers_only = False
|
||||
pin_post(self.server.base_dir,
|
||||
nickname, self.server.domain, content_str,
|
||||
followers_only)
|
||||
nickname, self.server.domain, content_str)
|
||||
return 1
|
||||
if self._post_to_outbox(message_json,
|
||||
self.server.project_version,
|
||||
|
@ -19159,7 +19134,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.domain, self.server.port,
|
||||
self.server.http_prefix,
|
||||
mentions_str + fields['message'],
|
||||
followers_only, save_to_file,
|
||||
save_to_file,
|
||||
client_to_server, comments_enabled,
|
||||
filename, attachment_media_type,
|
||||
fields['imageDescription'],
|
||||
|
@ -19220,7 +19195,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.port,
|
||||
self.server.http_prefix,
|
||||
mentions_message,
|
||||
followers_only, save_to_file,
|
||||
save_to_file,
|
||||
client_to_server,
|
||||
comments_enabled,
|
||||
filename, attachment_media_type,
|
||||
|
@ -19291,7 +19266,6 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.http_prefix,
|
||||
mentions_str +
|
||||
fields['message'],
|
||||
followers_only,
|
||||
save_to_file,
|
||||
client_to_server,
|
||||
comments_enabled,
|
||||
|
@ -19361,7 +19335,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.port,
|
||||
self.server.http_prefix,
|
||||
mentions_message,
|
||||
followers_only, save_to_file,
|
||||
save_to_file,
|
||||
client_to_server,
|
||||
comments_enabled,
|
||||
filename, attachment_media_type,
|
||||
|
@ -19415,7 +19389,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.domain, self.server.port,
|
||||
self.server.http_prefix,
|
||||
mentions_str + fields['message'],
|
||||
True, False, False, True,
|
||||
False, False, True,
|
||||
filename, attachment_media_type,
|
||||
fields['imageDescription'],
|
||||
city,
|
||||
|
@ -19462,7 +19436,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.port,
|
||||
self.server.http_prefix,
|
||||
fields['message'], q_options,
|
||||
False, False, False,
|
||||
False, False,
|
||||
comments_enabled,
|
||||
filename, attachment_media_type,
|
||||
fields['imageDescription'],
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -461,7 +461,6 @@ def _desktop_reply_to_post(session, post_id: str,
|
|||
_say_command(say_str, say_str, screenreader, system_language, espeak)
|
||||
return
|
||||
cc_url = None
|
||||
followers_only = False
|
||||
attach = None
|
||||
media_type = None
|
||||
attached_image_description = None
|
||||
|
@ -479,7 +478,7 @@ def _desktop_reply_to_post(session, post_id: str,
|
|||
base_dir, session, nickname, password,
|
||||
domain, port,
|
||||
to_nickname, to_domain, to_port, cc_url,
|
||||
http_prefix, reply_message, followers_only,
|
||||
http_prefix, reply_message,
|
||||
comments_enabled, attach, media_type,
|
||||
attached_image_description, city,
|
||||
cached_webfingers, person_cache, is_article,
|
||||
|
@ -534,7 +533,6 @@ def _desktop_new_post(session,
|
|||
_say_command(say_str, say_str, screenreader, system_language, espeak)
|
||||
return
|
||||
cc_url = None
|
||||
followers_only = False
|
||||
attach = None
|
||||
media_type = None
|
||||
attached_image_description = None
|
||||
|
@ -553,7 +551,7 @@ def _desktop_new_post(session,
|
|||
base_dir, session, nickname, password,
|
||||
domain, port,
|
||||
None, '#Public', port, cc_url,
|
||||
http_prefix, new_message, followers_only,
|
||||
http_prefix, new_message,
|
||||
comments_enabled, attach, media_type,
|
||||
attached_image_description, city,
|
||||
cached_webfingers, person_cache, is_article,
|
||||
|
@ -722,7 +720,7 @@ def _read_local_box_post(session, nickname: str, domain: str,
|
|||
http_prefix,
|
||||
nickname, domain,
|
||||
post_json_object,
|
||||
__version__, translate,
|
||||
__version__,
|
||||
yt_replace_domain,
|
||||
twitter_replacement_domain,
|
||||
allow_local_network_access,
|
||||
|
@ -1229,7 +1227,6 @@ def _desktop_new_dm_base(session, to_handle: str,
|
|||
_say_command(new_message, new_message,
|
||||
screenreader, system_language, espeak)
|
||||
cc_url = None
|
||||
followers_only = False
|
||||
attach = None
|
||||
media_type = None
|
||||
attached_image_description = None
|
||||
|
@ -1288,7 +1285,7 @@ def _desktop_new_dm_base(session, to_handle: str,
|
|||
base_dir, session, nickname, password,
|
||||
domain, port,
|
||||
to_nickname, to_domain, to_port, cc_url,
|
||||
http_prefix, new_message, followers_only,
|
||||
http_prefix, new_message,
|
||||
comments_enabled, attach, media_type,
|
||||
attached_image_description, city,
|
||||
cached_webfingers, person_cache, is_article,
|
||||
|
@ -1482,25 +1479,22 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
system_language, espeak)
|
||||
pgp_key_upload = True
|
||||
|
||||
box_json = c2s_box_json(base_dir, session,
|
||||
nickname, password,
|
||||
box_json = c2s_box_json(session, nickname, password,
|
||||
domain, port, http_prefix,
|
||||
curr_timeline, page_number,
|
||||
debug, signing_priv_key_pem)
|
||||
|
||||
follow_requests_json = \
|
||||
get_follow_requests_via_server(base_dir, session,
|
||||
get_follow_requests_via_server(session,
|
||||
nickname, password,
|
||||
domain, port,
|
||||
http_prefix, 1,
|
||||
cached_webfingers, person_cache,
|
||||
debug, __version__,
|
||||
signing_priv_key_pem)
|
||||
|
||||
if not (curr_timeline == 'inbox' and page_number == 1):
|
||||
# monitor the inbox to generate notifications
|
||||
inbox_json = c2s_box_json(base_dir, session,
|
||||
nickname, password,
|
||||
inbox_json = c2s_box_json(session, nickname, password,
|
||||
domain, port, http_prefix,
|
||||
'inbox', 1, debug,
|
||||
signing_priv_key_pem)
|
||||
|
@ -1575,8 +1569,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
page_number = 1
|
||||
prev_timeline_first_id = ''
|
||||
curr_timeline = 'dm'
|
||||
box_json = c2s_box_json(base_dir, session,
|
||||
nickname, password,
|
||||
box_json = c2s_box_json(session, nickname, password,
|
||||
domain, port, http_prefix,
|
||||
curr_timeline, page_number,
|
||||
debug, signing_priv_key_pem)
|
||||
|
@ -1592,8 +1585,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
page_number = 1
|
||||
prev_timeline_first_id = ''
|
||||
curr_timeline = 'tlreplies'
|
||||
box_json = c2s_box_json(base_dir, session,
|
||||
nickname, password,
|
||||
box_json = c2s_box_json(session, nickname, password,
|
||||
domain, port, http_prefix,
|
||||
curr_timeline, page_number,
|
||||
debug, signing_priv_key_pem)
|
||||
|
@ -1610,8 +1602,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
page_number = 1
|
||||
prev_timeline_first_id = ''
|
||||
curr_timeline = 'tlbookmarks'
|
||||
box_json = c2s_box_json(base_dir, session,
|
||||
nickname, password,
|
||||
box_json = c2s_box_json(session, nickname, password,
|
||||
domain, port, http_prefix,
|
||||
curr_timeline, page_number,
|
||||
debug, signing_priv_key_pem)
|
||||
|
@ -1629,8 +1620,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
page_number = 1
|
||||
prev_timeline_first_id = ''
|
||||
curr_timeline = 'outbox'
|
||||
box_json = c2s_box_json(base_dir, session,
|
||||
nickname, password,
|
||||
box_json = c2s_box_json(session, nickname, password,
|
||||
domain, port, http_prefix,
|
||||
curr_timeline, page_number,
|
||||
debug, signing_priv_key_pem)
|
||||
|
@ -1655,8 +1645,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
page_number -= 1
|
||||
page_number = max(page_number, 1)
|
||||
prev_timeline_first_id = ''
|
||||
box_json = c2s_box_json(base_dir, session,
|
||||
nickname, password,
|
||||
box_json = c2s_box_json(session, nickname, password,
|
||||
domain, port, http_prefix,
|
||||
curr_timeline, page_number,
|
||||
debug, signing_priv_key_pem)
|
||||
|
@ -2224,12 +2213,10 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
if page_num.isdigit():
|
||||
curr_page = int(page_num)
|
||||
follow_requests_json = \
|
||||
get_follow_requests_via_server(base_dir, session,
|
||||
get_follow_requests_via_server(session,
|
||||
nickname, password,
|
||||
domain, port,
|
||||
http_prefix, curr_page,
|
||||
cached_webfingers,
|
||||
person_cache,
|
||||
debug, __version__,
|
||||
signing_priv_key_pem)
|
||||
if follow_requests_json:
|
||||
|
@ -2245,11 +2232,10 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
if page_num.isdigit():
|
||||
curr_page = int(page_num)
|
||||
following_json = \
|
||||
get_following_via_server(base_dir, session,
|
||||
get_following_via_server(session,
|
||||
nickname, password,
|
||||
domain, port,
|
||||
http_prefix, curr_page,
|
||||
cached_webfingers, person_cache,
|
||||
debug, __version__,
|
||||
signing_priv_key_pem)
|
||||
if following_json:
|
||||
|
@ -2266,11 +2252,10 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
if page_num.isdigit():
|
||||
curr_page = int(page_num)
|
||||
followers_json = \
|
||||
get_followers_via_server(base_dir, session,
|
||||
get_followers_via_server(session,
|
||||
nickname, password,
|
||||
domain, port,
|
||||
http_prefix, curr_page,
|
||||
cached_webfingers, person_cache,
|
||||
debug, __version__,
|
||||
signing_priv_key_pem)
|
||||
if followers_json:
|
||||
|
@ -2369,14 +2354,11 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
_say_command(say_str, say_str,
|
||||
screenreader, system_language, espeak)
|
||||
session_approve = create_session(proxy_type)
|
||||
approve_follow_request_via_server(base_dir,
|
||||
session_approve,
|
||||
approve_follow_request_via_server(session_approve,
|
||||
nickname, password,
|
||||
domain, port,
|
||||
http_prefix,
|
||||
approve_handle,
|
||||
cached_webfingers,
|
||||
person_cache,
|
||||
debug,
|
||||
__version__,
|
||||
signing_priv_key_pem)
|
||||
|
@ -2403,13 +2385,11 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
_say_command(say_str, say_str,
|
||||
screenreader, system_language, espeak)
|
||||
session_deny = create_session(proxy_type)
|
||||
deny_follow_request_via_server(base_dir, session_deny,
|
||||
deny_follow_request_via_server(session_deny,
|
||||
nickname, password,
|
||||
domain, port,
|
||||
http_prefix,
|
||||
deny_handle,
|
||||
cached_webfingers,
|
||||
person_cache,
|
||||
debug,
|
||||
__version__,
|
||||
signing_priv_key_pem)
|
||||
|
@ -2494,7 +2474,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
|
|||
http_prefix,
|
||||
nickname, domain,
|
||||
post_json_object,
|
||||
__version__, translate,
|
||||
__version__,
|
||||
yt_replace_domain,
|
||||
twitter_replacement_domain,
|
||||
allow_local_network_access,
|
||||
|
|
25
epicyon.py
25
epicyon.py
|
@ -1519,7 +1519,6 @@ def _command_options() -> None:
|
|||
|
||||
cc_url = None
|
||||
send_message = argb.message
|
||||
followers_only = argb.followersonly
|
||||
# client_to_server = argb.client
|
||||
attached_image_description = argb.imageDescription
|
||||
city = 'London, England'
|
||||
|
@ -1533,7 +1532,6 @@ def _command_options() -> None:
|
|||
if attach:
|
||||
media_type = get_attachment_media_type(attach)
|
||||
reply_to = argb.replyto
|
||||
followers_only = False
|
||||
is_article = False
|
||||
if not domain:
|
||||
domain = get_config_param(base_dir, 'domain')
|
||||
|
@ -1549,7 +1547,7 @@ def _command_options() -> None:
|
|||
base_dir, session, argb.nickname, argb.password,
|
||||
domain, port,
|
||||
to_nickname, to_domain, to_port, cc_url,
|
||||
http_prefix, send_message, followers_only,
|
||||
http_prefix, send_message,
|
||||
argb.commentsEnabled, attach, media_type,
|
||||
attached_image_description, city,
|
||||
cached_webfingers, person_cache, is_article,
|
||||
|
@ -1681,8 +1679,7 @@ def _command_options() -> None:
|
|||
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
|
||||
|
||||
session = create_session(proxy_type)
|
||||
box_json = c2s_box_json(base_dir, session,
|
||||
argb.nickname, argb.password,
|
||||
box_json = c2s_box_json(session, argb.nickname, argb.password,
|
||||
domain, port, http_prefix,
|
||||
argb.box, argb.pageNumber,
|
||||
argb.debug, signing_priv_key_pem)
|
||||
|
@ -2271,11 +2268,10 @@ def _command_options() -> None:
|
|||
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
|
||||
|
||||
following_json = \
|
||||
get_following_via_server(base_dir, session,
|
||||
get_following_via_server(session,
|
||||
argb.nickname, argb.password,
|
||||
domain, port,
|
||||
follow_http_prefix, argb.pageNumber,
|
||||
cached_webfingers, person_cache,
|
||||
debug, __version__, signing_priv_key_pem)
|
||||
if following_json:
|
||||
pprint(following_json)
|
||||
|
@ -2305,11 +2301,10 @@ def _command_options() -> None:
|
|||
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
|
||||
|
||||
followers_json = \
|
||||
get_followers_via_server(base_dir, session,
|
||||
get_followers_via_server(session,
|
||||
argb.nickname, argb.password,
|
||||
domain, port,
|
||||
follow_http_prefix, argb.pageNumber,
|
||||
cached_webfingers, person_cache,
|
||||
debug, __version__,
|
||||
signing_priv_key_pem)
|
||||
if followers_json:
|
||||
|
@ -2340,11 +2335,10 @@ def _command_options() -> None:
|
|||
signing_priv_key_pem = get_instance_actor_key(base_dir, domain)
|
||||
|
||||
follow_requests_json = \
|
||||
get_follow_requests_via_server(base_dir, session,
|
||||
get_follow_requests_via_server(session,
|
||||
argb.nickname, argb.password,
|
||||
domain, port,
|
||||
follow_http_prefix, argb.pageNumber,
|
||||
cached_webfingers, person_cache,
|
||||
debug, __version__,
|
||||
signing_priv_key_pem)
|
||||
if follow_requests_json:
|
||||
|
@ -3199,7 +3193,6 @@ def _command_options() -> None:
|
|||
delete_all_posts(base_dir, nickname, domain, 'inbox')
|
||||
delete_all_posts(base_dir, nickname, domain, 'outbox')
|
||||
|
||||
test_followers_only = False
|
||||
test_save_to_file = True
|
||||
test_c2s = False
|
||||
test_comments_enabled = True
|
||||
|
@ -3222,7 +3215,6 @@ def _command_options() -> None:
|
|||
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
"like this is totally just a #test man",
|
||||
test_followers_only,
|
||||
test_save_to_file,
|
||||
test_c2s,
|
||||
test_comments_enabled,
|
||||
|
@ -3237,7 +3229,6 @@ def _command_options() -> None:
|
|||
languages_understood)
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
"Zoiks!!!",
|
||||
test_followers_only,
|
||||
test_save_to_file,
|
||||
test_c2s,
|
||||
test_comments_enabled,
|
||||
|
@ -3252,7 +3243,6 @@ def _command_options() -> None:
|
|||
languages_understood)
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
"Hey scoob we need like a hundred more #milkshakes",
|
||||
test_followers_only,
|
||||
test_save_to_file,
|
||||
test_c2s,
|
||||
test_comments_enabled,
|
||||
|
@ -3267,7 +3257,6 @@ def _command_options() -> None:
|
|||
languages_understood)
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
"Getting kinda spooky around here",
|
||||
test_followers_only,
|
||||
test_save_to_file,
|
||||
test_c2s,
|
||||
test_comments_enabled,
|
||||
|
@ -3283,7 +3272,6 @@ def _command_options() -> None:
|
|||
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",
|
||||
test_followers_only,
|
||||
test_save_to_file,
|
||||
test_c2s,
|
||||
test_comments_enabled,
|
||||
|
@ -3298,7 +3286,6 @@ def _command_options() -> None:
|
|||
languages_understood)
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
"man these centralized sites are like the worst!",
|
||||
test_followers_only,
|
||||
test_save_to_file,
|
||||
test_c2s,
|
||||
test_comments_enabled,
|
||||
|
@ -3313,7 +3300,6 @@ def _command_options() -> None:
|
|||
languages_understood)
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
"another mystery solved #test",
|
||||
test_followers_only,
|
||||
test_save_to_file,
|
||||
test_c2s,
|
||||
test_comments_enabled,
|
||||
|
@ -3328,7 +3314,6 @@ def _command_options() -> None:
|
|||
languages_understood)
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
"let's go bowling",
|
||||
test_followers_only,
|
||||
test_save_to_file,
|
||||
test_c2s,
|
||||
test_comments_enabled,
|
||||
|
|
96
follow.py
96
follow.py
|
@ -386,7 +386,6 @@ def clear_followers(base_dir: str, nickname: str, domain: str) -> None:
|
|||
|
||||
|
||||
def _get_no_of_follows(base_dir: str, nickname: str, domain: str,
|
||||
authenticated: bool,
|
||||
follow_file='following.txt') -> int:
|
||||
"""Returns the number of follows or followers
|
||||
"""
|
||||
|
@ -422,13 +421,10 @@ def _get_no_of_follows(base_dir: str, nickname: str, domain: str,
|
|||
return ctr
|
||||
|
||||
|
||||
def get_no_of_followers(base_dir: str,
|
||||
nickname: str, domain: str,
|
||||
authenticated: bool) -> int:
|
||||
def get_no_of_followers(base_dir: str, nickname: str, domain: str) -> int:
|
||||
"""Returns the number of followers of the given person
|
||||
"""
|
||||
return _get_no_of_follows(base_dir, nickname, domain,
|
||||
authenticated, 'followers.txt')
|
||||
return _get_no_of_follows(base_dir, nickname, domain, 'followers.txt')
|
||||
|
||||
|
||||
def get_following_feed(base_dir: str, domain: str, port: int, path: str,
|
||||
|
@ -482,7 +478,7 @@ def get_following_feed(base_dir: str, domain: str, port: int, path: str,
|
|||
id_str = \
|
||||
local_actor_url(http_prefix, nickname, domain) + '/' + follow_file
|
||||
total_str = \
|
||||
_get_no_of_follows(base_dir, nickname, domain, authorized)
|
||||
_get_no_of_follows(base_dir, nickname, domain)
|
||||
following = {
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'first': first_str,
|
||||
|
@ -599,7 +595,6 @@ def follow_approval_required(base_dir: str, nickname_to_follow: str,
|
|||
|
||||
def no_of_follow_requests(base_dir: str,
|
||||
nickname_to_follow: str, domain_to_follow: str,
|
||||
nickname: str, domain: str, from_port: int,
|
||||
follow_type: str) -> int:
|
||||
"""Returns the current number of follow requests
|
||||
"""
|
||||
|
@ -779,8 +774,8 @@ def followed_account_accepts(session, base_dir: str, http_prefix: str,
|
|||
|
||||
return send_signed_json(accept_json, session, base_dir,
|
||||
nickname_to_follow, domain_to_follow, port,
|
||||
nickname, domain, from_port, '',
|
||||
http_prefix, True, client_to_server,
|
||||
nickname, domain, from_port,
|
||||
http_prefix, client_to_server,
|
||||
federation_list,
|
||||
send_threads, post_log, cached_webfingers,
|
||||
person_cache, debug, project_version, None,
|
||||
|
@ -846,11 +841,16 @@ def followed_account_rejects(session, session_onion, session_i2p,
|
|||
except OSError:
|
||||
print('EX: followed_account_rejects unable to delete ' +
|
||||
follow_activity_filename)
|
||||
curr_session = session
|
||||
if domain.endswith('.onion') and session_onion:
|
||||
curr_session = session_onion
|
||||
elif domain.endswith('.i2p') and session_i2p:
|
||||
curr_session = session_i2p
|
||||
# send the reject activity
|
||||
return send_signed_json(reject_json, session, base_dir,
|
||||
return send_signed_json(reject_json, curr_session, base_dir,
|
||||
nickname_to_follow, domain_to_follow, port,
|
||||
nickname, domain, from_port, '',
|
||||
http_prefix, True, client_to_server,
|
||||
nickname, domain, from_port,
|
||||
http_prefix, client_to_server,
|
||||
federation_list,
|
||||
send_threads, post_log, cached_webfingers,
|
||||
person_cache, debug, project_version, None,
|
||||
|
@ -947,8 +947,7 @@ def send_follow_request(session, base_dir: str,
|
|||
send_signed_json(new_follow_json, session, base_dir,
|
||||
nickname, sender_domain, sender_port,
|
||||
follow_nickname, follow_domain, follow_port,
|
||||
'https://www.w3.org/ns/activitystreams#Public',
|
||||
http_prefix, True, client_to_server,
|
||||
http_prefix, client_to_server,
|
||||
federation_list,
|
||||
send_threads, post_log, cached_webfingers, person_cache,
|
||||
debug, project_version, None, group_account,
|
||||
|
@ -982,7 +981,7 @@ def send_follow_request_via_server(base_dir: str, session,
|
|||
followed_id = \
|
||||
http_prefix + '://' + follow_domain_full + '/@' + follow_nickname
|
||||
|
||||
status_number, published = get_status_number()
|
||||
status_number, _ = get_status_number()
|
||||
new_follow_json = {
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
'id': follow_actor + '/statuses/' + str(status_number),
|
||||
|
@ -1148,11 +1147,9 @@ def send_unfollow_request_via_server(base_dir: str, session,
|
|||
return unfollow_json
|
||||
|
||||
|
||||
def get_following_via_server(base_dir: str, session,
|
||||
nickname: str, password: str,
|
||||
def get_following_via_server(session, nickname: str, password: str,
|
||||
domain: str, port: int,
|
||||
http_prefix: str, page_number: int,
|
||||
cached_webfingers: {}, person_cache: {},
|
||||
debug: bool, project_version: str,
|
||||
signing_priv_key_pem: str) -> {}:
|
||||
"""Gets a page from the following collection as json
|
||||
|
@ -1176,7 +1173,7 @@ def get_following_via_server(base_dir: str, session,
|
|||
url = follow_actor + '/following?page=' + str(page_number)
|
||||
following_json = \
|
||||
get_json(signing_priv_key_pem, session, url, headers, {}, debug,
|
||||
__version__, http_prefix, domain, 10, True)
|
||||
project_version, http_prefix, domain, 10, True)
|
||||
if not following_json:
|
||||
if debug:
|
||||
print('DEBUG: GET following list failed for c2s to ' + url)
|
||||
|
@ -1188,11 +1185,9 @@ def get_following_via_server(base_dir: str, session,
|
|||
return following_json
|
||||
|
||||
|
||||
def get_followers_via_server(base_dir: str, session,
|
||||
nickname: str, password: str,
|
||||
def get_followers_via_server(session, nickname: str, password: str,
|
||||
domain: str, port: int,
|
||||
http_prefix: str, page_number: int,
|
||||
cached_webfingers: {}, person_cache: {},
|
||||
debug: bool, project_version: str,
|
||||
signing_priv_key_pem: str) -> {}:
|
||||
"""Gets a page from the followers collection as json
|
||||
|
@ -1212,12 +1207,11 @@ def get_followers_via_server(base_dir: str, session,
|
|||
'Authorization': auth_header
|
||||
}
|
||||
|
||||
if page_number < 1:
|
||||
page_number = 1
|
||||
page_number = max(page_number, 1)
|
||||
url = follow_actor + '/followers?page=' + str(page_number)
|
||||
followers_json = \
|
||||
get_json(signing_priv_key_pem, session, url, headers, {}, debug,
|
||||
__version__, http_prefix, domain, 10, True)
|
||||
project_version, http_prefix, domain, 10, True)
|
||||
if not followers_json:
|
||||
if debug:
|
||||
print('DEBUG: GET followers list failed for c2s to ' + url)
|
||||
|
@ -1229,11 +1223,10 @@ def get_followers_via_server(base_dir: str, session,
|
|||
return followers_json
|
||||
|
||||
|
||||
def get_follow_requests_via_server(base_dir: str, session,
|
||||
def get_follow_requests_via_server(session,
|
||||
nickname: str, password: str,
|
||||
domain: str, port: int,
|
||||
http_prefix: str, page_number: int,
|
||||
cached_webfingers: {}, person_cache: {},
|
||||
debug: bool, project_version: str,
|
||||
signing_priv_key_pem: str) -> {}:
|
||||
"""Gets a page from the follow requests collection as json
|
||||
|
@ -1257,7 +1250,7 @@ def get_follow_requests_via_server(base_dir: str, session,
|
|||
url = follow_actor + '/followrequests?page=' + str(page_number)
|
||||
followers_json = \
|
||||
get_json(signing_priv_key_pem, session, url, headers, {}, debug,
|
||||
__version__, http_prefix, domain, 10, True)
|
||||
project_version, http_prefix, domain, 10, True)
|
||||
if not followers_json:
|
||||
if debug:
|
||||
print('DEBUG: GET follow requests list failed for c2s to ' + url)
|
||||
|
@ -1269,11 +1262,10 @@ def get_follow_requests_via_server(base_dir: str, session,
|
|||
return followers_json
|
||||
|
||||
|
||||
def approve_follow_request_via_server(base_dir: str, session,
|
||||
def approve_follow_request_via_server(session,
|
||||
nickname: str, password: str,
|
||||
domain: str, port: int,
|
||||
http_prefix: str, approve_handle: int,
|
||||
cached_webfingers: {}, person_cache: {},
|
||||
debug: bool, project_version: str,
|
||||
signing_priv_key_pem: str) -> str:
|
||||
"""Approves a follow request
|
||||
|
@ -1298,7 +1290,7 @@ def approve_follow_request_via_server(base_dir: str, session,
|
|||
url = actor + '/followapprove=' + approve_handle
|
||||
approve_html = \
|
||||
get_json(signing_priv_key_pem, session, url, headers, {}, debug,
|
||||
__version__, http_prefix, domain, 10, True)
|
||||
project_version, http_prefix, domain, 10, True)
|
||||
if not approve_html:
|
||||
if debug:
|
||||
print('DEBUG: GET approve follow request failed for c2s to ' + url)
|
||||
|
@ -1310,11 +1302,10 @@ def approve_follow_request_via_server(base_dir: str, session,
|
|||
return approve_html
|
||||
|
||||
|
||||
def deny_follow_request_via_server(base_dir: str, session,
|
||||
def deny_follow_request_via_server(session,
|
||||
nickname: str, password: str,
|
||||
domain: str, port: int,
|
||||
http_prefix: str, deny_handle: int,
|
||||
cached_webfingers: {}, person_cache: {},
|
||||
debug: bool, project_version: str,
|
||||
signing_priv_key_pem: str) -> str:
|
||||
"""Denies a follow request
|
||||
|
@ -1339,7 +1330,7 @@ def deny_follow_request_via_server(base_dir: str, session,
|
|||
url = actor + '/followdeny=' + deny_handle
|
||||
deny_html = \
|
||||
get_json(signing_priv_key_pem, session, url, headers, {}, debug,
|
||||
__version__, http_prefix, domain, 10, True)
|
||||
project_version, http_prefix, domain, 10, True)
|
||||
if not deny_html:
|
||||
if debug:
|
||||
print('DEBUG: GET deny follow request failed for c2s to ' + url)
|
||||
|
@ -1377,24 +1368,27 @@ def get_followers_of_actor(base_dir: str, actor: str, debug: bool) -> {}:
|
|||
# for each of the accounts
|
||||
for subdir, dirs, _ in os.walk(base_dir + '/accounts'):
|
||||
for account in dirs:
|
||||
if '@' in account and \
|
||||
not account.startswith('inbox@') and \
|
||||
not account.startswith('Actor@'):
|
||||
following_filename = \
|
||||
os.path.join(subdir, account) + '/following.txt'
|
||||
if '@' not in account:
|
||||
continue
|
||||
if account.startswith('inbox@'):
|
||||
continue
|
||||
if account.startswith('Actor@'):
|
||||
continue
|
||||
following_filename = \
|
||||
os.path.join(subdir, account) + '/following.txt'
|
||||
if debug:
|
||||
print('DEBUG: examining follows of ' + account)
|
||||
print(following_filename)
|
||||
if os.path.isfile(following_filename):
|
||||
# does this account follow the given actor?
|
||||
if debug:
|
||||
print('DEBUG: examining follows of ' + account)
|
||||
print(following_filename)
|
||||
if os.path.isfile(following_filename):
|
||||
# does this account follow the given actor?
|
||||
print('DEBUG: checking if ' + actor_handle +
|
||||
' in ' + following_filename)
|
||||
if actor_handle in open(following_filename).read():
|
||||
if debug:
|
||||
print('DEBUG: checking if ' + actor_handle +
|
||||
' in ' + following_filename)
|
||||
if actor_handle in open(following_filename).read():
|
||||
if debug:
|
||||
print('DEBUG: ' + account +
|
||||
' follows ' + actor_handle)
|
||||
recipients_dict[account] = None
|
||||
print('DEBUG: ' + account +
|
||||
' follows ' + actor_handle)
|
||||
recipients_dict[account] = None
|
||||
break
|
||||
return recipients_dict
|
||||
|
||||
|
|
19
inbox.py
19
inbox.py
|
@ -2318,7 +2318,7 @@ def _receive_announce(recent_posts_cache: {},
|
|||
http_prefix,
|
||||
nickname, domain,
|
||||
message_json,
|
||||
__version__, translate,
|
||||
__version__,
|
||||
yt_replace_domain,
|
||||
twitter_replacement_domain,
|
||||
allow_local_network_access,
|
||||
|
@ -3256,12 +3256,10 @@ def _bounce_dm(senderPostId: str, session, http_prefix: str,
|
|||
if ':' in sender_domain:
|
||||
sender_port = get_port_from_domain(sender_domain)
|
||||
sender_domain = remove_domain_port(sender_domain)
|
||||
cc_list = []
|
||||
|
||||
# create the bounce DM
|
||||
subject = None
|
||||
content = translate['DM bounce']
|
||||
followers_only = False
|
||||
save_to_file = False
|
||||
client_to_server = False
|
||||
comments_enabled = False
|
||||
|
@ -3280,7 +3278,7 @@ def _bounce_dm(senderPostId: str, session, http_prefix: str,
|
|||
low_bandwidth = False
|
||||
post_json_object = \
|
||||
create_direct_message_post(base_dir, nickname, domain, port,
|
||||
http_prefix, content, followers_only,
|
||||
http_prefix, content,
|
||||
save_to_file, client_to_server,
|
||||
comments_enabled,
|
||||
attach_image_filename, media_type,
|
||||
|
@ -3299,8 +3297,8 @@ def _bounce_dm(senderPostId: str, session, http_prefix: str,
|
|||
print('Sending bounce DM to ' + sending_handle)
|
||||
send_signed_json(post_json_object, session, base_dir,
|
||||
nickname, domain, port,
|
||||
sender_nickname, sender_domain, sender_port, cc_list,
|
||||
http_prefix, False, False, federation_list,
|
||||
sender_nickname, sender_domain, sender_port,
|
||||
http_prefix, False, federation_list,
|
||||
send_threads, post_log, cached_webfingers,
|
||||
person_cache, debug, __version__, None, group_account,
|
||||
signing_priv_key_pem, 7238634,
|
||||
|
@ -4083,7 +4081,6 @@ def _inbox_after_initial(server, inbox_start_time,
|
|||
|
||||
if is_image_media(session, base_dir, http_prefix,
|
||||
nickname, domain, post_json_object,
|
||||
translate,
|
||||
yt_replace_domain,
|
||||
twitter_replacement_domain,
|
||||
allow_local_network_access,
|
||||
|
@ -4652,9 +4649,8 @@ def _receive_follow_request(session, session_onion, session_i2p,
|
|||
nickname_to_follow)
|
||||
return True
|
||||
if max_followers > 0:
|
||||
if get_no_of_followers(base_dir,
|
||||
nickname_to_follow, domain_to_follow,
|
||||
True) > max_followers:
|
||||
if get_no_of_followers(base_dir, nickname_to_follow,
|
||||
domain_to_follow) > max_followers:
|
||||
print('WARN: ' + nickname_to_follow +
|
||||
' has reached their maximum number of followers')
|
||||
return True
|
||||
|
@ -4719,21 +4715,18 @@ def _receive_follow_request(session, session_onion, session_i2p,
|
|||
if domain.endswith('.onion'):
|
||||
if no_of_follow_requests(base_dir,
|
||||
nickname_to_follow, domain_to_follow,
|
||||
nickname, domain, from_port,
|
||||
'onion') > 5:
|
||||
print('Too many follow requests from onion addresses')
|
||||
return False
|
||||
elif domain.endswith('.i2p'):
|
||||
if no_of_follow_requests(base_dir,
|
||||
nickname_to_follow, domain_to_follow,
|
||||
nickname, domain, from_port,
|
||||
'i2p') > 5:
|
||||
print('Too many follow requests from i2p addresses')
|
||||
return False
|
||||
else:
|
||||
if no_of_follow_requests(base_dir,
|
||||
nickname_to_follow, domain_to_follow,
|
||||
nickname, domain, from_port,
|
||||
'') > 10:
|
||||
print('Too many follow requests')
|
||||
return False
|
||||
|
|
|
@ -46,8 +46,7 @@ def get_understood_languages(base_dir: str, http_prefix: str,
|
|||
return get_actor_languages_list(actor_json)
|
||||
|
||||
|
||||
def set_actor_languages(base_dir: str, actor_json: {},
|
||||
languages_str: str) -> None:
|
||||
def set_actor_languages(actor_json: {}, languages_str: str) -> None:
|
||||
"""Sets the languages understood by the given actor
|
||||
"""
|
||||
languages_str = languages_str.strip()
|
||||
|
|
6
like.py
6
like.py
|
@ -139,8 +139,7 @@ def _create_like(recent_posts_cache: {},
|
|||
nickname, domain, port,
|
||||
liked_post_nickname, liked_post_domain,
|
||||
liked_post_port,
|
||||
'https://www.w3.org/ns/activitystreams#Public',
|
||||
http_prefix, True, client_to_server, federation_list,
|
||||
http_prefix, client_to_server, federation_list,
|
||||
send_threads, post_log, cached_webfingers,
|
||||
person_cache,
|
||||
debug, project_version, None, group_account,
|
||||
|
@ -352,8 +351,7 @@ def send_undo_like_via_server(base_dir: str, session,
|
|||
|
||||
|
||||
def outbox_like(recent_posts_cache: {},
|
||||
base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
base_dir: str, nickname: str, domain: str,
|
||||
message_json: {}, debug: bool) -> None:
|
||||
""" When a like request is received by the outbox from c2s
|
||||
"""
|
||||
|
|
|
@ -631,7 +631,6 @@ def _convert_rss_to_activitypub(base_dir: str, http_prefix: str,
|
|||
# if len(item) > 8:
|
||||
# podcast_properties = item[8]
|
||||
|
||||
followers_only = False
|
||||
# NOTE: the id when the post is created will not be
|
||||
# consistent (it's based on the current time, not the
|
||||
# published time), so we change that later
|
||||
|
@ -645,7 +644,7 @@ def _convert_rss_to_activitypub(base_dir: str, http_prefix: str,
|
|||
blog = create_news_post(base_dir,
|
||||
domain, port, http_prefix,
|
||||
rss_description,
|
||||
followers_only, save_to_file,
|
||||
save_to_file,
|
||||
attach_image_filename, media_type,
|
||||
image_description, city,
|
||||
rss_title, system_language,
|
||||
|
|
|
@ -451,7 +451,6 @@ def post_message_to_outbox(session, translate: {},
|
|||
if is_image_media(session, base_dir, http_prefix,
|
||||
post_to_nickname, domain,
|
||||
message_json,
|
||||
translate,
|
||||
yt_replace_domain,
|
||||
twitter_replacement_domain,
|
||||
allow_local_network_access,
|
||||
|
@ -577,8 +576,7 @@ def post_message_to_outbox(session, translate: {},
|
|||
if debug:
|
||||
print('DEBUG: handle any like requests')
|
||||
outbox_like(recent_posts_cache,
|
||||
base_dir, http_prefix,
|
||||
post_to_nickname, domain, port,
|
||||
base_dir, post_to_nickname, domain,
|
||||
message_json, debug)
|
||||
if debug:
|
||||
print('DEBUG: handle any undo like requests')
|
||||
|
@ -637,9 +635,7 @@ def post_message_to_outbox(session, translate: {},
|
|||
|
||||
if debug:
|
||||
print('DEBUG: handle undo block requests')
|
||||
outbox_undo_block(base_dir, http_prefix,
|
||||
post_to_nickname, domain,
|
||||
port, message_json, debug)
|
||||
outbox_undo_block(base_dir, post_to_nickname, domain, message_json, debug)
|
||||
|
||||
if debug:
|
||||
print('DEBUG: handle mute requests')
|
||||
|
|
19
person.py
19
person.py
|
@ -1000,45 +1000,44 @@ def person_box_json(recent_posts_cache: {},
|
|||
return None
|
||||
if boxname == 'inbox':
|
||||
return create_inbox(recent_posts_cache,
|
||||
session, base_dir, nickname, domain, port,
|
||||
base_dir, nickname, domain, port,
|
||||
http_prefix,
|
||||
no_of_items, header_only, page_number)
|
||||
if boxname == 'dm':
|
||||
return create_dm_timeline(recent_posts_cache,
|
||||
session, base_dir, nickname, domain, port,
|
||||
base_dir, nickname, domain, port,
|
||||
http_prefix,
|
||||
no_of_items, header_only, page_number)
|
||||
if boxname in ('tlbookmarks', 'bookmarks'):
|
||||
return create_bookmarks_timeline(session, base_dir, nickname, domain,
|
||||
return create_bookmarks_timeline(base_dir, nickname, domain,
|
||||
port, http_prefix,
|
||||
no_of_items, header_only,
|
||||
page_number)
|
||||
if boxname == 'tlreplies':
|
||||
return create_replies_timeline(recent_posts_cache,
|
||||
session, base_dir, nickname, domain,
|
||||
base_dir, nickname, domain,
|
||||
port, http_prefix,
|
||||
no_of_items, header_only,
|
||||
page_number)
|
||||
if boxname == 'tlmedia':
|
||||
return create_media_timeline(session, base_dir, nickname, domain, port,
|
||||
return create_media_timeline(base_dir, nickname, domain, port,
|
||||
http_prefix, no_of_items, header_only,
|
||||
page_number)
|
||||
if boxname == 'tlnews':
|
||||
return create_news_timeline(session, base_dir, nickname, domain, port,
|
||||
return create_news_timeline(base_dir, domain, port,
|
||||
http_prefix, no_of_items, header_only,
|
||||
newswire_votes_threshold, positive_voting,
|
||||
voting_time_mins, page_number)
|
||||
if boxname == 'tlfeatures':
|
||||
return create_features_timeline(session, base_dir,
|
||||
nickname, domain, port,
|
||||
return create_features_timeline(base_dir, nickname, domain, port,
|
||||
http_prefix, no_of_items, header_only,
|
||||
page_number)
|
||||
if boxname == 'tlblogs':
|
||||
return create_blogs_timeline(session, base_dir, nickname, domain, port,
|
||||
return create_blogs_timeline(base_dir, nickname, domain, port,
|
||||
http_prefix, no_of_items, header_only,
|
||||
page_number)
|
||||
if boxname == 'outbox':
|
||||
return create_outbox(session, base_dir, nickname, domain, port,
|
||||
return create_outbox(base_dir, nickname, domain, port,
|
||||
http_prefix,
|
||||
no_of_items, header_only, authorized,
|
||||
page_number)
|
||||
|
|
191
posts.py
191
posts.py
|
@ -536,8 +536,7 @@ def is_create_inside_announce(item: {}) -> bool:
|
|||
def _get_posts(session, outbox_url: str, max_posts: int,
|
||||
max_mentions: int,
|
||||
max_emoji: int, max_attachments: int,
|
||||
federation_list: [],
|
||||
person_cache: {}, raw: bool,
|
||||
federation_list: [], raw: bool,
|
||||
simple: bool, debug: bool,
|
||||
project_version: str, http_prefix: str,
|
||||
origin_domain: str, system_language: str,
|
||||
|
@ -663,6 +662,10 @@ def _get_posts(session, outbox_url: str, max_posts: int,
|
|||
in_reply_to = this_item['inReplyTo']
|
||||
|
||||
if this_item.get('attachment'):
|
||||
if len(this_item['attachment']) > max_attachments:
|
||||
if debug:
|
||||
print('max attachments reached')
|
||||
continue
|
||||
if this_item['attachment']:
|
||||
for attach in this_item['attachment']:
|
||||
if attach.get('name') and attach.get('url'):
|
||||
|
@ -735,10 +738,10 @@ def _update_word_frequency(content: str, word_frequency: {}) -> None:
|
|||
words_list = plain_text.split(' ')
|
||||
common_words = _get_common_words()
|
||||
for word in words_list:
|
||||
wordLen = len(word)
|
||||
if wordLen < 3:
|
||||
word_len = len(word)
|
||||
if word_len < 3:
|
||||
continue
|
||||
if wordLen < 4:
|
||||
if word_len < 4:
|
||||
if word.upper() != word:
|
||||
continue
|
||||
if '&' in word or \
|
||||
|
@ -756,17 +759,10 @@ def _update_word_frequency(content: str, word_frequency: {}) -> None:
|
|||
word_frequency[word] = 1
|
||||
|
||||
|
||||
def get_post_domains(session, outbox_url: str, max_posts: int,
|
||||
max_mentions: int,
|
||||
max_emoji: int, max_attachments: int,
|
||||
federation_list: [],
|
||||
person_cache: {},
|
||||
debug: bool,
|
||||
project_version: str, http_prefix: str,
|
||||
domain: str,
|
||||
word_frequency: {},
|
||||
domain_list: [], system_language: str,
|
||||
signing_priv_key_pem: str) -> []:
|
||||
def get_post_domains(session, outbox_url: str, max_posts: int, debug: bool,
|
||||
project_version: str, http_prefix: str, domain: str,
|
||||
word_frequency: {}, domain_list: [],
|
||||
system_language: str, signing_priv_key_pem: str) -> []:
|
||||
"""Returns a list of domains referenced within public posts
|
||||
"""
|
||||
if not outbox_url:
|
||||
|
@ -803,7 +799,7 @@ def get_post_domains(session, outbox_url: str, max_posts: int,
|
|||
_update_word_frequency(content_str, word_frequency)
|
||||
if item['object'].get('inReplyTo'):
|
||||
if isinstance(item['object']['inReplyTo'], str):
|
||||
post_domain, post_port = \
|
||||
post_domain, _ = \
|
||||
get_domain_from_actor(item['object']['inReplyTo'])
|
||||
if post_domain not in post_domains:
|
||||
post_domains.append(post_domain)
|
||||
|
@ -1069,6 +1065,7 @@ def _create_post_cw_from_reply(base_dir: str, nickname: str, domain: str,
|
|||
"""If this is a reply and the original post has a CW
|
||||
then use the same CW
|
||||
"""
|
||||
reply_to_json = None
|
||||
if in_reply_to and not sensitive:
|
||||
# locate the post which this is a reply to and check if
|
||||
# it has a content warning. If it does then reproduce
|
||||
|
@ -1077,16 +1074,16 @@ def _create_post_cw_from_reply(base_dir: str, nickname: str, domain: str,
|
|||
locate_post(base_dir, nickname, domain, in_reply_to)
|
||||
if reply_post_filename:
|
||||
reply_to_json = load_json(reply_post_filename)
|
||||
if reply_to_json:
|
||||
if reply_to_json.get('object'):
|
||||
if reply_to_json['object'].get('sensitive'):
|
||||
if reply_to_json['object']['sensitive']:
|
||||
sensitive = True
|
||||
if reply_to_json['object'].get('summary'):
|
||||
summary = \
|
||||
get_summary_from_post(reply_to_json,
|
||||
system_language,
|
||||
languages_understood)
|
||||
if reply_to_json:
|
||||
if reply_to_json.get('object'):
|
||||
if reply_to_json['object'].get('sensitive'):
|
||||
if reply_to_json['object']['sensitive']:
|
||||
sensitive = True
|
||||
if reply_to_json['object'].get('summary'):
|
||||
summary = \
|
||||
get_summary_from_post(reply_to_json,
|
||||
system_language,
|
||||
languages_understood)
|
||||
|
||||
return sensitive, summary
|
||||
|
||||
|
@ -1407,7 +1404,7 @@ def get_actor_from_in_reply_to(in_reply_to: str) -> str:
|
|||
def _create_post_base(base_dir: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
to_url: str, cc_url: str, http_prefix: str, content: str,
|
||||
followers_only: bool, save_to_file: bool,
|
||||
save_to_file: bool,
|
||||
client_to_server: bool, comments_enabled: bool,
|
||||
attach_image_filename: str,
|
||||
media_type: str, image_description: str, city: str,
|
||||
|
@ -1667,8 +1664,7 @@ def outbox_message_create_wrap(http_prefix: str,
|
|||
return new_post
|
||||
|
||||
|
||||
def _post_is_addressed_to_followers(base_dir: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
def _post_is_addressed_to_followers(nickname: str, domain: str, port: int,
|
||||
http_prefix: str,
|
||||
post_json_object: {}) -> bool:
|
||||
"""Returns true if the given post is addressed to followers of the nickname
|
||||
|
@ -1704,7 +1700,7 @@ def _post_is_addressed_to_followers(base_dir: str,
|
|||
|
||||
|
||||
def pin_post(base_dir: str, nickname: str, domain: str,
|
||||
pinned_content: str, followers_only: bool) -> None:
|
||||
pinned_content: str) -> None:
|
||||
"""Pins the given post Id to the profile of then given account
|
||||
"""
|
||||
account_dir = acct_dir(base_dir, nickname, domain)
|
||||
|
@ -1830,7 +1826,7 @@ def regenerate_index_for_box(base_dir: str,
|
|||
|
||||
def create_public_post(base_dir: str,
|
||||
nickname: str, domain: str, port: int, http_prefix: str,
|
||||
content: str, followers_only: bool, save_to_file: bool,
|
||||
content: str, save_to_file: bool,
|
||||
client_to_server: bool, comments_enabled: bool,
|
||||
attach_image_filename: str, media_type: str,
|
||||
image_description: str, city: str,
|
||||
|
@ -1860,8 +1856,7 @@ def create_public_post(base_dir: str,
|
|||
return _create_post_base(base_dir, nickname, domain, port,
|
||||
'https://www.w3.org/ns/activitystreams#Public',
|
||||
local_actor + '/followers',
|
||||
http_prefix, content, followers_only,
|
||||
save_to_file,
|
||||
http_prefix, content, save_to_file,
|
||||
client_to_server, comments_enabled,
|
||||
attach_image_filename, media_type,
|
||||
image_description, city,
|
||||
|
@ -1925,7 +1920,7 @@ def create_blog_post(base_dir: str,
|
|||
blog_json = \
|
||||
create_public_post(base_dir,
|
||||
nickname, domain, port, http_prefix,
|
||||
content, followers_only, save_to_file,
|
||||
content, save_to_file,
|
||||
client_to_server, comments_enabled,
|
||||
attach_image_filename, media_type,
|
||||
image_description, city,
|
||||
|
@ -1944,7 +1939,7 @@ def create_blog_post(base_dir: str,
|
|||
|
||||
def create_news_post(base_dir: str,
|
||||
domain: str, port: int, http_prefix: str,
|
||||
content: str, followers_only: bool, save_to_file: bool,
|
||||
content: str, save_to_file: bool,
|
||||
attach_image_filename: str, media_type: str,
|
||||
image_description: str, city: str,
|
||||
subject: str, system_language: str,
|
||||
|
@ -1962,7 +1957,7 @@ def create_news_post(base_dir: str,
|
|||
blog = \
|
||||
create_public_post(base_dir,
|
||||
'news', domain, port, http_prefix,
|
||||
content, followers_only, save_to_file,
|
||||
content, save_to_file,
|
||||
client_to_server, False,
|
||||
attach_image_filename, media_type,
|
||||
image_description, city,
|
||||
|
@ -1980,7 +1975,7 @@ def create_question_post(base_dir: str,
|
|||
nickname: str, domain: str, port: int,
|
||||
http_prefix: str,
|
||||
content: str, q_options: [],
|
||||
followers_only: bool, save_to_file: bool,
|
||||
save_to_file: bool,
|
||||
client_to_server: bool, comments_enabled: bool,
|
||||
attach_image_filename: str, media_type: str,
|
||||
image_description: str, city: str,
|
||||
|
@ -1996,7 +1991,7 @@ def create_question_post(base_dir: str,
|
|||
_create_post_base(base_dir, nickname, domain, port,
|
||||
'https://www.w3.org/ns/activitystreams#Public',
|
||||
local_actor + '/followers',
|
||||
http_prefix, content, followers_only, save_to_file,
|
||||
http_prefix, content, save_to_file,
|
||||
client_to_server, comments_enabled,
|
||||
attach_image_filename, media_type,
|
||||
image_description, city,
|
||||
|
@ -2030,8 +2025,7 @@ def create_question_post(base_dir: str,
|
|||
def create_unlisted_post(base_dir: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
http_prefix: str,
|
||||
content: str, followers_only: bool,
|
||||
save_to_file: bool,
|
||||
content: str, save_to_file: bool,
|
||||
client_to_server: bool, comments_enabled: bool,
|
||||
attach_image_filename: str, media_type: str,
|
||||
image_description: str, city: str,
|
||||
|
@ -2049,8 +2043,7 @@ def create_unlisted_post(base_dir: str,
|
|||
return _create_post_base(base_dir, nickname, domain, port,
|
||||
local_actor + '/followers',
|
||||
'https://www.w3.org/ns/activitystreams#Public',
|
||||
http_prefix, content, followers_only,
|
||||
save_to_file,
|
||||
http_prefix, content, save_to_file,
|
||||
client_to_server, comments_enabled,
|
||||
attach_image_filename, media_type,
|
||||
image_description, city,
|
||||
|
@ -2066,8 +2059,7 @@ def create_unlisted_post(base_dir: str,
|
|||
|
||||
def create_followers_only_post(base_dir: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
http_prefix: str,
|
||||
content: str, followers_only: bool,
|
||||
http_prefix: str, content: str,
|
||||
save_to_file: bool,
|
||||
client_to_server: bool, comments_enabled: bool,
|
||||
attach_image_filename: str, media_type: str,
|
||||
|
@ -2087,8 +2079,7 @@ def create_followers_only_post(base_dir: str,
|
|||
local_actor = local_actor_url(http_prefix, nickname, domain_full)
|
||||
return _create_post_base(base_dir, nickname, domain, port,
|
||||
local_actor + '/followers', None,
|
||||
http_prefix, content, followers_only,
|
||||
save_to_file,
|
||||
http_prefix, content, save_to_file,
|
||||
client_to_server, comments_enabled,
|
||||
attach_image_filename, media_type,
|
||||
image_description, city,
|
||||
|
@ -2139,8 +2130,7 @@ def get_mentioned_people(base_dir: str, http_prefix: str,
|
|||
|
||||
def create_direct_message_post(base_dir: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
http_prefix: str,
|
||||
content: str, followers_only: bool,
|
||||
http_prefix: str, content: str,
|
||||
save_to_file: bool, client_to_server: bool,
|
||||
comments_enabled: bool,
|
||||
attach_image_filename: str, media_type: str,
|
||||
|
@ -2170,7 +2160,7 @@ def create_direct_message_post(base_dir: str,
|
|||
message_json = \
|
||||
_create_post_base(base_dir, nickname, domain, port,
|
||||
post_to, post_cc,
|
||||
http_prefix, content, followers_only, save_to_file,
|
||||
http_prefix, content, save_to_file,
|
||||
client_to_server, comments_enabled,
|
||||
attach_image_filename, media_type,
|
||||
image_description, city,
|
||||
|
@ -2197,7 +2187,7 @@ def create_direct_message_post(base_dir: str,
|
|||
|
||||
def create_report_post(base_dir: str,
|
||||
nickname: str, domain: str, port: int, http_prefix: str,
|
||||
content: str, followers_only: bool, save_to_file: bool,
|
||||
content: str, save_to_file: bool,
|
||||
client_to_server: bool, comments_enabled: bool,
|
||||
attach_image_filename: str, media_type: str,
|
||||
image_description: str, city: str,
|
||||
|
@ -2274,8 +2264,7 @@ def create_report_post(base_dir: str,
|
|||
post_json_object = \
|
||||
_create_post_base(base_dir, nickname, domain, port,
|
||||
to_url, post_cc,
|
||||
http_prefix, content, followers_only,
|
||||
save_to_file,
|
||||
http_prefix, content, save_to_file,
|
||||
client_to_server, comments_enabled,
|
||||
attach_image_filename, media_type,
|
||||
image_description, city,
|
||||
|
@ -2395,7 +2384,7 @@ def thread_send_post(session, post_json_str: str, federation_list: [],
|
|||
def send_post(signing_priv_key_pem: str, project_version: str,
|
||||
session, base_dir: str, nickname: str, domain: str, port: int,
|
||||
to_nickname: str, to_domain: str, to_port: int, cc_str: str,
|
||||
http_prefix: str, content: str, followers_only: bool,
|
||||
http_prefix: str, content: str,
|
||||
save_to_file: bool, client_to_server: bool,
|
||||
comments_enabled: bool,
|
||||
attach_image_filename: str, media_type: str,
|
||||
|
@ -2463,7 +2452,7 @@ def send_post(signing_priv_key_pem: str, project_version: str,
|
|||
post_json_object = \
|
||||
_create_post_base(base_dir, nickname, domain, port,
|
||||
to_person_id, cc_str, http_prefix, content,
|
||||
followers_only, save_to_file, client_to_server,
|
||||
save_to_file, client_to_server,
|
||||
comments_enabled,
|
||||
attach_image_filename, media_type,
|
||||
image_description, city,
|
||||
|
@ -2560,7 +2549,7 @@ def send_post_via_server(signing_priv_key_pem: str, project_version: str,
|
|||
from_domain: str, from_port: int,
|
||||
to_nickname: str, to_domain: str, to_port: int,
|
||||
cc_str: str,
|
||||
http_prefix: str, content: str, followers_only: bool,
|
||||
http_prefix: str, content: str,
|
||||
comments_enabled: bool,
|
||||
attach_image_filename: str, media_type: str,
|
||||
image_description: str, city: str,
|
||||
|
@ -2650,7 +2639,7 @@ def send_post_via_server(signing_priv_key_pem: str, project_version: str,
|
|||
_create_post_base(base_dir,
|
||||
from_nickname, from_domain, from_port,
|
||||
to_person_id, cc_str, http_prefix, content,
|
||||
followers_only, save_to_file, client_to_server,
|
||||
save_to_file, client_to_server,
|
||||
comments_enabled,
|
||||
attach_image_filename, media_type,
|
||||
image_description, city,
|
||||
|
@ -2762,8 +2751,7 @@ def _add_followers_to_public_post(post_json_object: {}) -> None:
|
|||
def send_signed_json(post_json_object: {}, session, base_dir: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
to_nickname: str, to_domain: str,
|
||||
to_port: int, cc_str: str,
|
||||
http_prefix: str, save_to_file: bool,
|
||||
to_port: int, http_prefix: str,
|
||||
client_to_server: bool, federation_list: [],
|
||||
send_threads: [], post_log: [], cached_webfingers: {},
|
||||
person_cache: {}, debug: bool, project_version: str,
|
||||
|
@ -3204,7 +3192,6 @@ def _send_to_named_addresses(server, session, session_onion, session_i2p,
|
|||
to_port = 80
|
||||
curr_proxy_type = 'i2p'
|
||||
session_type = 'i2p'
|
||||
cc_list = []
|
||||
|
||||
if debug:
|
||||
to_domain_full = get_full_domain(to_domain, to_port)
|
||||
|
@ -3236,7 +3223,7 @@ def _send_to_named_addresses(server, session, session_onion, session_i2p,
|
|||
send_signed_json(post_json_object, curr_session, base_dir,
|
||||
nickname, from_domain, port,
|
||||
to_nickname, to_domain, to_port,
|
||||
cc_list, from_http_prefix, True, client_to_server,
|
||||
from_http_prefix, client_to_server,
|
||||
federation_list,
|
||||
send_threads, post_log, cached_webfingers,
|
||||
person_cache, debug, project_version,
|
||||
|
@ -3336,7 +3323,7 @@ def send_to_followers(server, session, session_onion, session_i2p,
|
|||
"""sends a post to the followers of the given nickname
|
||||
"""
|
||||
print('send_to_followers')
|
||||
if not _post_is_addressed_to_followers(base_dir, nickname, domain,
|
||||
if not _post_is_addressed_to_followers(nickname, domain,
|
||||
port, http_prefix,
|
||||
post_json_object):
|
||||
if debug:
|
||||
|
@ -3438,8 +3425,6 @@ def send_to_followers(server, session, session_onion, session_i2p,
|
|||
to_port = get_port_from_domain(to_domain)
|
||||
to_domain = remove_domain_port(to_domain)
|
||||
|
||||
cc_list = ''
|
||||
|
||||
# if we are sending to an onion domain and we
|
||||
# have an alt onion domain then use the alt
|
||||
from_domain = domain
|
||||
|
@ -3498,7 +3483,7 @@ def send_to_followers(server, session, session_onion, session_i2p,
|
|||
send_signed_json(post_json_object, curr_session, base_dir,
|
||||
nickname, from_domain, port,
|
||||
to_nickname, to_domain, to_port,
|
||||
cc_list, from_http_prefix, True,
|
||||
from_http_prefix,
|
||||
client_to_server, federation_list,
|
||||
send_threads, post_log, cached_webfingers,
|
||||
person_cache, debug, project_version,
|
||||
|
@ -3531,7 +3516,7 @@ def send_to_followers(server, session, session_onion, session_i2p,
|
|||
send_signed_json(post_json_object, curr_session, base_dir,
|
||||
nickname, from_domain, port,
|
||||
to_nickname, to_domain, to_port,
|
||||
cc_list, from_http_prefix, True,
|
||||
from_http_prefix,
|
||||
client_to_server, federation_list,
|
||||
send_threads, post_log, cached_webfingers,
|
||||
person_cache, debug, project_version,
|
||||
|
@ -3591,92 +3576,92 @@ def send_to_followers_thread(server, session, session_onion, session_i2p,
|
|||
|
||||
|
||||
def create_inbox(recent_posts_cache: {},
|
||||
session, base_dir: str, nickname: str, domain: str, port: int,
|
||||
base_dir: str, nickname: str, domain: str, port: int,
|
||||
http_prefix: str, items_per_page: int, header_only: bool,
|
||||
page_number: int) -> {}:
|
||||
return _create_box_indexed(recent_posts_cache,
|
||||
session, base_dir, 'inbox',
|
||||
base_dir, 'inbox',
|
||||
nickname, domain, port, http_prefix,
|
||||
items_per_page, header_only, True,
|
||||
0, False, 0, page_number)
|
||||
|
||||
|
||||
def create_bookmarks_timeline(session, base_dir: str,
|
||||
def create_bookmarks_timeline(base_dir: str,
|
||||
nickname: str, domain: str,
|
||||
port: int, http_prefix: str, items_per_page: int,
|
||||
header_only: bool, page_number: int) -> {}:
|
||||
return _create_box_indexed({}, session, base_dir, 'tlbookmarks',
|
||||
return _create_box_indexed({}, base_dir, 'tlbookmarks',
|
||||
nickname, domain,
|
||||
port, http_prefix, items_per_page, header_only,
|
||||
True, 0, False, 0, page_number)
|
||||
|
||||
|
||||
def create_dm_timeline(recent_posts_cache: {},
|
||||
session, base_dir: str, nickname: str, domain: str,
|
||||
base_dir: str, nickname: str, domain: str,
|
||||
port: int, http_prefix: str, items_per_page: int,
|
||||
header_only: bool, page_number: int) -> {}:
|
||||
return _create_box_indexed(recent_posts_cache,
|
||||
session, base_dir, 'dm', nickname,
|
||||
base_dir, 'dm', nickname,
|
||||
domain, port, http_prefix, items_per_page,
|
||||
header_only, True, 0, False, 0, page_number)
|
||||
|
||||
|
||||
def create_replies_timeline(recent_posts_cache: {},
|
||||
session, base_dir: str, nickname: str, domain: str,
|
||||
base_dir: str, nickname: str, domain: str,
|
||||
port: int, http_prefix: str, items_per_page: int,
|
||||
header_only: bool, page_number: int) -> {}:
|
||||
return _create_box_indexed(recent_posts_cache, session,
|
||||
return _create_box_indexed(recent_posts_cache,
|
||||
base_dir, 'tlreplies',
|
||||
nickname, domain, port, http_prefix,
|
||||
items_per_page, header_only, True,
|
||||
0, False, 0, page_number)
|
||||
|
||||
|
||||
def create_blogs_timeline(session, base_dir: str, nickname: str, domain: str,
|
||||
def create_blogs_timeline(base_dir: str, nickname: str, domain: str,
|
||||
port: int, http_prefix: str, items_per_page: int,
|
||||
header_only: bool, page_number: int) -> {}:
|
||||
return _create_box_indexed({}, session, base_dir, 'tlblogs', nickname,
|
||||
return _create_box_indexed({}, base_dir, 'tlblogs', nickname,
|
||||
domain, port, http_prefix,
|
||||
items_per_page, header_only, True,
|
||||
0, False, 0, page_number)
|
||||
|
||||
|
||||
def create_features_timeline(session, base_dir: str,
|
||||
def create_features_timeline(base_dir: str,
|
||||
nickname: str, domain: str,
|
||||
port: int, http_prefix: str, items_per_page: int,
|
||||
header_only: bool, page_number: int) -> {}:
|
||||
return _create_box_indexed({}, session, base_dir, 'tlfeatures', nickname,
|
||||
return _create_box_indexed({}, base_dir, 'tlfeatures', nickname,
|
||||
domain, port, http_prefix,
|
||||
items_per_page, header_only, True,
|
||||
0, False, 0, page_number)
|
||||
|
||||
|
||||
def create_media_timeline(session, base_dir: str, nickname: str, domain: str,
|
||||
def create_media_timeline(base_dir: str, nickname: str, domain: str,
|
||||
port: int, http_prefix: str, items_per_page: int,
|
||||
header_only: bool, page_number: int) -> {}:
|
||||
return _create_box_indexed({}, session, base_dir, 'tlmedia', nickname,
|
||||
return _create_box_indexed({}, base_dir, 'tlmedia', nickname,
|
||||
domain, port, http_prefix,
|
||||
items_per_page, header_only, True,
|
||||
0, False, 0, page_number)
|
||||
|
||||
|
||||
def create_news_timeline(session, base_dir: str, nickname: str, domain: str,
|
||||
def create_news_timeline(base_dir: str, domain: str,
|
||||
port: int, http_prefix: str, items_per_page: int,
|
||||
header_only: bool, newswire_votes_threshold: int,
|
||||
positive_voting: bool, voting_time_mins: int,
|
||||
page_number: int) -> {}:
|
||||
return _create_box_indexed({}, session, base_dir, 'outbox', 'news',
|
||||
return _create_box_indexed({}, base_dir, 'outbox', 'news',
|
||||
domain, port, http_prefix,
|
||||
items_per_page, header_only, True,
|
||||
newswire_votes_threshold, positive_voting,
|
||||
voting_time_mins, page_number)
|
||||
|
||||
|
||||
def create_outbox(session, base_dir: str, nickname: str, domain: str,
|
||||
def create_outbox(base_dir: str, nickname: str, domain: str,
|
||||
port: int, http_prefix: str,
|
||||
items_per_page: int, header_only: bool, authorized: bool,
|
||||
page_number: int) -> {}:
|
||||
return _create_box_indexed({}, session, base_dir, 'outbox',
|
||||
return _create_box_indexed({}, base_dir, 'outbox',
|
||||
nickname, domain, port, http_prefix,
|
||||
items_per_page, header_only, authorized,
|
||||
0, False, 0, page_number)
|
||||
|
@ -3725,12 +3710,10 @@ def create_moderation(base_dir: str, nickname: str, domain: str, port: int,
|
|||
if len(lines) > 0:
|
||||
end_line_number = \
|
||||
len(lines) - 1 - int(items_per_page * page_number)
|
||||
if end_line_number < 0:
|
||||
end_line_number = 0
|
||||
end_line_number = max(end_line_number, 0)
|
||||
start_line_number = \
|
||||
len(lines) - 1 - int(items_per_page * (page_number - 1))
|
||||
if start_line_number < 0:
|
||||
start_line_number = 0
|
||||
start_line_number = max(start_line_number, 0)
|
||||
line_number = start_line_number
|
||||
while line_number >= end_line_number:
|
||||
line_no_str = lines[line_number].strip('\n').strip('\r')
|
||||
|
@ -3752,7 +3735,7 @@ def create_moderation(base_dir: str, nickname: str, domain: str, port: int,
|
|||
|
||||
def is_image_media(session, base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
post_json_object: {}, translate: {},
|
||||
post_json_object: {},
|
||||
yt_replace_domain: str,
|
||||
twitter_replacement_domain: str,
|
||||
allow_local_network_access: bool,
|
||||
|
@ -3768,7 +3751,7 @@ def is_image_media(session, base_dir: str, http_prefix: str,
|
|||
post_json_announce = \
|
||||
download_announce(session, base_dir, http_prefix,
|
||||
nickname, domain, post_json_object,
|
||||
__version__, translate,
|
||||
__version__,
|
||||
yt_replace_domain,
|
||||
twitter_replacement_domain,
|
||||
allow_local_network_access,
|
||||
|
@ -3957,7 +3940,7 @@ def _passed_newswire_voting(newswire_votes_threshold: int,
|
|||
|
||||
|
||||
def _create_box_indexed(recent_posts_cache: {},
|
||||
session, base_dir: str, boxname: str,
|
||||
base_dir: str, boxname: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
http_prefix: str,
|
||||
items_per_page: int, header_only: bool,
|
||||
|
@ -3994,8 +3977,7 @@ def _create_box_indexed(recent_posts_cache: {},
|
|||
|
||||
page_str = '?page=true'
|
||||
if page_number:
|
||||
if page_number < 1:
|
||||
page_number = 1
|
||||
page_number = max(page_number, 1)
|
||||
try:
|
||||
page_str = '?page=' + str(page_number)
|
||||
except BaseException:
|
||||
|
@ -4131,8 +4113,7 @@ def _create_box_indexed(recent_posts_cache: {},
|
|||
# Generate first and last entries within header
|
||||
if total_posts_count > 0:
|
||||
last_page = int(total_posts_count / items_per_page)
|
||||
if last_page < 1:
|
||||
last_page = 1
|
||||
last_page = max(last_page, 1)
|
||||
box_header['last'] = \
|
||||
local_actor_url(http_prefix, nickname, domain) + \
|
||||
'/' + boxname + '?page=' + str(last_page)
|
||||
|
@ -4442,8 +4423,7 @@ def get_public_posts_of_person(base_dir: str, nickname: str, domain: str,
|
|||
max_emoji = 10
|
||||
max_attachments = 5
|
||||
_get_posts(session, person_url, 30, max_mentions, max_emoji,
|
||||
max_attachments, federation_list,
|
||||
person_cache, raw, simple, debug,
|
||||
max_attachments, federation_list, raw, simple, debug,
|
||||
project_version, http_prefix, origin_domain, system_language,
|
||||
signing_priv_key_pem)
|
||||
|
||||
|
@ -4463,7 +4443,6 @@ def get_public_post_domains(session, base_dir: str, nickname: str, domain: str,
|
|||
return domain_list
|
||||
person_cache = {}
|
||||
cached_webfingers = {}
|
||||
federation_list = []
|
||||
|
||||
domain_full = get_full_domain(domain, port)
|
||||
handle = http_prefix + "://" + domain_full + "/@" + nickname
|
||||
|
@ -4486,13 +4465,8 @@ def get_public_post_domains(session, base_dir: str, nickname: str, domain: str,
|
|||
project_version, http_prefix,
|
||||
nickname, domain, 'outbox',
|
||||
92522)
|
||||
max_mentions = 99
|
||||
max_emoji = 99
|
||||
max_attachments = 5
|
||||
post_domains = \
|
||||
get_post_domains(session, person_url, 64, max_mentions, max_emoji,
|
||||
max_attachments, federation_list,
|
||||
person_cache, debug,
|
||||
get_post_domains(session, person_url, 64, debug,
|
||||
project_version, http_prefix, domain,
|
||||
word_frequency, domain_list, system_language,
|
||||
signing_priv_key_pem)
|
||||
|
@ -4588,10 +4562,7 @@ def get_public_post_info(session, base_dir: str, nickname: str, domain: str,
|
|||
max_attachments = 5
|
||||
max_posts = 64
|
||||
post_domains = \
|
||||
get_post_domains(session, person_url, max_posts,
|
||||
max_mentions, max_emoji,
|
||||
max_attachments, federation_list,
|
||||
person_cache, debug,
|
||||
get_post_domains(session, person_url, max_posts, debug,
|
||||
project_version, http_prefix, domain,
|
||||
word_frequency, [], system_language,
|
||||
signing_priv_key_pem)
|
||||
|
@ -4834,7 +4805,6 @@ def _reject_announce(announce_filename: str,
|
|||
def download_announce(session, base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
post_json_object: {}, project_version: str,
|
||||
translate: {},
|
||||
yt_replace_domain: str,
|
||||
twitter_replacement_domain: str,
|
||||
allow_local_network_access: bool,
|
||||
|
@ -5501,8 +5471,7 @@ def post_is_muted(base_dir: str, nickname: str, domain: str,
|
|||
return is_muted
|
||||
|
||||
|
||||
def c2s_box_json(base_dir: str, session,
|
||||
nickname: str, password: str,
|
||||
def c2s_box_json(session, nickname: str, password: str,
|
||||
domain: str, port: int,
|
||||
http_prefix: str,
|
||||
box_name: str, page_number: int,
|
||||
|
|
|
@ -138,8 +138,7 @@ def _reactionpost(recent_posts_cache: {},
|
|||
nickname, domain, port,
|
||||
reaction_post_nickname,
|
||||
reaction_post_domain, reaction_post_port,
|
||||
'https://www.w3.org/ns/activitystreams#Public',
|
||||
http_prefix, True, client_to_server, federation_list,
|
||||
http_prefix, client_to_server, federation_list,
|
||||
send_threads, post_log, cached_webfingers,
|
||||
person_cache,
|
||||
debug, project_version, None, group_account,
|
||||
|
|
|
@ -33,10 +33,6 @@ def instances_graph(base_dir: str, handles: str,
|
|||
|
||||
person_cache = {}
|
||||
cached_webfingers = {}
|
||||
federation_list = []
|
||||
max_mentions = 99
|
||||
max_emoji = 99
|
||||
max_attachments = 5
|
||||
|
||||
person_handles = handles.split(',')
|
||||
for handle in person_handles:
|
||||
|
@ -74,9 +70,7 @@ def instances_graph(base_dir: str, handles: str,
|
|||
27261)
|
||||
word_frequency = {}
|
||||
post_domains = \
|
||||
get_post_domains(session, person_url, 64, max_mentions, max_emoji,
|
||||
max_attachments, federation_list,
|
||||
person_cache, debug,
|
||||
get_post_domains(session, person_url, 64, debug,
|
||||
project_version, http_prefix, domain,
|
||||
word_frequency, [], system_language,
|
||||
signing_priv_key_pem)
|
||||
|
|
42
tests.py
42
tests.py
|
@ -741,7 +741,6 @@ def create_server_alice(path: str, domain: str, port: int,
|
|||
add_follower_of_person(path, nickname, domain, 'bob', bob_address,
|
||||
federation_list, False, False)
|
||||
if hasPosts:
|
||||
test_followers_only = False
|
||||
test_save_to_file = True
|
||||
client_to_server = False
|
||||
test_comments_enabled = True
|
||||
|
@ -762,7 +761,6 @@ def create_server_alice(path: str, domain: str, port: int,
|
|||
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
||||
create_public_post(path, nickname, domain, port, http_prefix,
|
||||
"No wise fish would go anywhere without a porpoise",
|
||||
test_followers_only,
|
||||
test_save_to_file,
|
||||
client_to_server,
|
||||
test_comments_enabled,
|
||||
|
@ -778,7 +776,6 @@ def create_server_alice(path: str, domain: str, port: int,
|
|||
languages_understood)
|
||||
create_public_post(path, nickname, domain, port, http_prefix,
|
||||
"Curiouser and curiouser!",
|
||||
test_followers_only,
|
||||
test_save_to_file,
|
||||
client_to_server,
|
||||
test_comments_enabled,
|
||||
|
@ -795,7 +792,6 @@ def create_server_alice(path: str, domain: str, port: int,
|
|||
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",
|
||||
test_followers_only,
|
||||
test_save_to_file,
|
||||
client_to_server,
|
||||
test_comments_enabled,
|
||||
|
@ -905,7 +901,6 @@ def create_server_bob(path: str, domain: str, port: int,
|
|||
'alice', alice_address, federation_list,
|
||||
False, False)
|
||||
if hasPosts:
|
||||
test_followers_only = False
|
||||
test_save_to_file = True
|
||||
test_comments_enabled = True
|
||||
test_attach_image_filename = None
|
||||
|
@ -925,7 +920,6 @@ def create_server_bob(path: str, domain: str, port: int,
|
|||
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
||||
create_public_post(path, nickname, domain, port, http_prefix,
|
||||
"It's your life, live it your way.",
|
||||
test_followers_only,
|
||||
test_save_to_file,
|
||||
client_to_server,
|
||||
test_comments_enabled,
|
||||
|
@ -942,7 +936,6 @@ def create_server_bob(path: str, domain: str, port: int,
|
|||
create_public_post(path, nickname, domain, port, http_prefix,
|
||||
"One of the things I've realised is that " +
|
||||
"I am very simple",
|
||||
test_followers_only,
|
||||
test_save_to_file,
|
||||
client_to_server,
|
||||
test_comments_enabled,
|
||||
|
@ -958,7 +951,6 @@ def create_server_bob(path: str, domain: str, port: int,
|
|||
languages_understood)
|
||||
create_public_post(path, nickname, domain, port, http_prefix,
|
||||
"Quantum physics is a bit of a passion of mine",
|
||||
test_followers_only,
|
||||
test_save_to_file,
|
||||
client_to_server,
|
||||
test_comments_enabled,
|
||||
|
@ -1275,7 +1267,6 @@ def test_post_message_between_servers(base_dir: str) -> None:
|
|||
in_reply_to_atom_uri = None
|
||||
subject = None
|
||||
alice_post_log = []
|
||||
followers_only = False
|
||||
save_to_file = True
|
||||
client_to_server = False
|
||||
cc_url = None
|
||||
|
@ -1304,7 +1295,6 @@ def test_post_message_between_servers(base_dir: str) -> None:
|
|||
'bob', bob_domain, bob_port, cc_url, http_prefix,
|
||||
'Why is a mouse when it spins? ' +
|
||||
'यह एक परीक्षण है #sillyquestion',
|
||||
followers_only,
|
||||
save_to_file, client_to_server, True,
|
||||
attached_image_filename, media_type,
|
||||
attached_image_description, city, federation_list,
|
||||
|
@ -1613,7 +1603,6 @@ def test_follow_between_servers(base_dir: str) -> None:
|
|||
in_reply_to_atom_uri = None
|
||||
subject = None
|
||||
alice_post_log = []
|
||||
followers_only = False
|
||||
save_to_file = True
|
||||
client_to_server = False
|
||||
cc_url = None
|
||||
|
@ -1675,7 +1664,7 @@ def test_follow_between_servers(base_dir: str) -> None:
|
|||
send_post(signing_priv_key_pem, __version__,
|
||||
session_alice, alice_dir, 'alice', alice_domain, alice_port,
|
||||
'bob', bob_domain, bob_port, cc_url,
|
||||
http_prefix, 'Alice message', followers_only, save_to_file,
|
||||
http_prefix, 'Alice message', save_to_file,
|
||||
client_to_server, True,
|
||||
None, None, None, city, federation_list,
|
||||
alice_send_threads, alice_post_log, alice_cached_webfingers,
|
||||
|
@ -1836,7 +1825,6 @@ def test_shared_items_federation(base_dir: str) -> None:
|
|||
in_reply_to_atom_uri = None
|
||||
subject = None
|
||||
alice_post_log = []
|
||||
followers_only = False
|
||||
save_to_file = True
|
||||
client_to_server = False
|
||||
cc_url = None
|
||||
|
@ -2039,7 +2027,7 @@ def test_shared_items_federation(base_dir: str) -> None:
|
|||
send_post(signing_priv_key_pem, __version__,
|
||||
session_alice, alice_dir, 'alice', alice_domain, alice_port,
|
||||
'bob', bob_domain, bob_port, cc_url,
|
||||
http_prefix, 'Alice message', followers_only, save_to_file,
|
||||
http_prefix, 'Alice message', save_to_file,
|
||||
client_to_server, True,
|
||||
None, None, None, city, federation_list,
|
||||
alice_send_threads, alice_post_log, alice_cached_webfingers,
|
||||
|
@ -2286,7 +2274,6 @@ def test_group_follow(base_dir: str) -> None:
|
|||
in_reply_to_atom_uri = None
|
||||
subject = None
|
||||
alice_post_log = []
|
||||
followers_only = False
|
||||
save_to_file = True
|
||||
client_to_server = False
|
||||
cc_url = None
|
||||
|
@ -2365,7 +2352,6 @@ def test_group_follow(base_dir: str) -> None:
|
|||
in_reply_to_atom_uri = None
|
||||
subject = None
|
||||
bob_post_log = []
|
||||
followers_only = False
|
||||
save_to_file = True
|
||||
client_to_server = False
|
||||
cc_url = None
|
||||
|
@ -2470,7 +2456,7 @@ def test_group_follow(base_dir: str) -> None:
|
|||
send_post(signing_priv_key_pem, __version__,
|
||||
session_alice, alice_dir, 'alice', alice_domain, alice_port,
|
||||
'testgroup', testgroup_domain, testgroupPort, cc_url,
|
||||
http_prefix, "Alice group message", followers_only,
|
||||
http_prefix, "Alice group message",
|
||||
save_to_file, client_to_server, True,
|
||||
None, None, None, city, federation_list,
|
||||
alice_send_threads, alice_post_log, alice_cached_webfingers,
|
||||
|
@ -2838,7 +2824,6 @@ def _test_create_person_account(base_dir: str):
|
|||
test_event_end_time = None
|
||||
test_location = None
|
||||
test_is_article = False
|
||||
followers_only = False
|
||||
save_to_file = True
|
||||
comments_enabled = True
|
||||
attach_image_filename = None
|
||||
|
@ -2853,7 +2838,7 @@ def _test_create_person_account(base_dir: str):
|
|||
"anything which challenges middle class sensibilities or incomes."
|
||||
test_post_json = \
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
content, followers_only, save_to_file,
|
||||
content, save_to_file,
|
||||
client_to_server,
|
||||
comments_enabled, attach_image_filename, media_type,
|
||||
'Not suitable for Vogons', 'London, England',
|
||||
|
@ -2879,7 +2864,7 @@ def _test_create_person_account(base_dir: str):
|
|||
'then email would be somequitelongword.\nAnotherlongwordhere sentence.'
|
||||
test_post_json = \
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
content, followers_only, save_to_file,
|
||||
content, save_to_file,
|
||||
client_to_server,
|
||||
comments_enabled, attach_image_filename, media_type,
|
||||
'Not suitable for Vogons', 'London, England',
|
||||
|
@ -3052,7 +3037,6 @@ def test_client_to_server(base_dir: str):
|
|||
print('EVENT: Alice sends to Bob via c2s')
|
||||
|
||||
session_alice = create_session(proxy_type)
|
||||
followers_only = False
|
||||
attached_image_filename = base_dir + '/img/logo.png'
|
||||
media_type = get_attachment_media_type(attached_image_filename)
|
||||
attached_image_description = 'Logo'
|
||||
|
@ -3096,8 +3080,7 @@ def test_client_to_server(base_dir: str):
|
|||
alice_domain, alice_port,
|
||||
'bob', bob_domain, bob_port, None,
|
||||
http_prefix, 'Sent from my ActivityPub client',
|
||||
followers_only, True,
|
||||
attached_image_filename, media_type,
|
||||
True, attached_image_filename, media_type,
|
||||
attached_image_description, city,
|
||||
cached_webfingers, person_cache, is_article,
|
||||
system_language, languages_understood,
|
||||
|
@ -4643,7 +4626,6 @@ def _test_reply_to_public_post(base_dir: str) -> None:
|
|||
post_id = \
|
||||
http_prefix + '://rat.site/users/ninjarodent/statuses/63746173435'
|
||||
content = "@ninjarodent@rat.site This is a test."
|
||||
followers_only = False
|
||||
save_to_file = False
|
||||
client_to_server = False
|
||||
comments_enabled = True
|
||||
|
@ -4665,7 +4647,7 @@ def _test_reply_to_public_post(base_dir: str) -> None:
|
|||
content_license_url = 'https://creativecommons.org/licenses/by/4.0'
|
||||
reply = \
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
content, followers_only, save_to_file,
|
||||
content, save_to_file,
|
||||
client_to_server, comments_enabled,
|
||||
attach_image_filename, media_type,
|
||||
image_description, city, test_in_reply_to,
|
||||
|
@ -5574,7 +5556,6 @@ def _test_links_within_post(base_dir: str) -> None:
|
|||
http_prefix = 'https'
|
||||
content = 'This is a test post with links.\n\n' + \
|
||||
'ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/v4/\n\nhttps://libreserver.org'
|
||||
followers_only = False
|
||||
save_to_file = False
|
||||
client_to_server = False
|
||||
comments_enabled = True
|
||||
|
@ -5597,7 +5578,7 @@ def _test_links_within_post(base_dir: str) -> None:
|
|||
|
||||
post_json_object = \
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
content, followers_only, save_to_file,
|
||||
content, save_to_file,
|
||||
client_to_server, comments_enabled,
|
||||
attach_image_filename, media_type,
|
||||
image_description, city,
|
||||
|
@ -5641,7 +5622,7 @@ def _test_links_within_post(base_dir: str) -> None:
|
|||
post_json_object = \
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
content,
|
||||
False, False,
|
||||
False,
|
||||
False, True,
|
||||
None, None,
|
||||
False, None,
|
||||
|
@ -6408,7 +6389,7 @@ def _test_set_actor_language():
|
|||
actor_json = {
|
||||
"attachment": []
|
||||
}
|
||||
set_actor_languages(None, actor_json, 'es, fr, en')
|
||||
set_actor_languages(actor_json, 'es, fr, en')
|
||||
assert len(actor_json['attachment']) == 1
|
||||
assert actor_json['attachment'][0]['name'] == 'Languages'
|
||||
assert actor_json['attachment'][0]['type'] == 'PropertyValue'
|
||||
|
@ -6590,7 +6571,6 @@ def _test_can_replyto(base_dir: str) -> None:
|
|||
http_prefix = 'https'
|
||||
content = 'This is a test post with links.\n\n' + \
|
||||
'ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/v4/\n\nhttps://libreserver.org'
|
||||
followers_only = False
|
||||
save_to_file = False
|
||||
client_to_server = False
|
||||
comments_enabled = True
|
||||
|
@ -6613,7 +6593,7 @@ def _test_can_replyto(base_dir: str) -> None:
|
|||
|
||||
post_json_object = \
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
content, followers_only, save_to_file,
|
||||
content, save_to_file,
|
||||
client_to_server, comments_enabled,
|
||||
attach_image_filename, media_type,
|
||||
image_description, city,
|
||||
|
|
|
@ -813,8 +813,7 @@ def _get_bookmark_icon_html(nickname: str, domain_full: str,
|
|||
return bookmark_str
|
||||
|
||||
|
||||
def _get_reaction_icon_html(nickname: str, domain_full: str,
|
||||
post_json_object: {},
|
||||
def _get_reaction_icon_html(nickname: str, post_json_object: {},
|
||||
is_moderation_post: bool,
|
||||
show_reaction_button: bool,
|
||||
translate: {},
|
||||
|
@ -1676,7 +1675,7 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
|||
post_json_announce = \
|
||||
download_announce(session, base_dir, http_prefix,
|
||||
nickname, domain, post_json_object,
|
||||
project_version, translate,
|
||||
project_version,
|
||||
yt_replace_domain,
|
||||
twitter_replacement_domain,
|
||||
allow_local_network_access,
|
||||
|
@ -1900,8 +1899,7 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
|||
_log_post_timing(enable_timing_log, post_start_time, '12.9')
|
||||
|
||||
reaction_str = \
|
||||
_get_reaction_icon_html(nickname, domain_full,
|
||||
post_json_object,
|
||||
_get_reaction_icon_html(nickname, post_json_object,
|
||||
is_moderation_post,
|
||||
show_reaction_button,
|
||||
translate,
|
||||
|
@ -2135,7 +2133,7 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
|||
content_str = add_embedded_elements(translate, content_str,
|
||||
peertube_instances)
|
||||
content_str = insert_question(base_dir, translate,
|
||||
nickname, domain, port,
|
||||
nickname, domain,
|
||||
content_str, post_json_object,
|
||||
page_number)
|
||||
else:
|
||||
|
@ -2157,7 +2155,7 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
|||
cw_content_str = add_embedded_elements(translate, cw_content_str,
|
||||
peertube_instances)
|
||||
cw_content_str = \
|
||||
insert_question(base_dir, translate, nickname, domain, port,
|
||||
insert_question(base_dir, translate, nickname, domain,
|
||||
cw_content_str, post_json_object, page_number)
|
||||
cw_content_str = \
|
||||
switch_words(base_dir, nickname, domain, cw_content_str)
|
||||
|
@ -2274,16 +2272,15 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
|||
return post_html
|
||||
|
||||
|
||||
def html_individual_post(css_cache: {},
|
||||
recent_posts_cache: {}, max_recent_posts: int,
|
||||
def html_individual_post(recent_posts_cache: {}, max_recent_posts: int,
|
||||
translate: {},
|
||||
base_dir: str, session, cached_webfingers: {},
|
||||
person_cache: {},
|
||||
nickname: str, domain: str, port: int,
|
||||
authorized: bool,
|
||||
post_json_object: {}, http_prefix: str,
|
||||
project_version: str, likedBy: str,
|
||||
reactBy: str, reactEmoji: str,
|
||||
project_version: str, liked_by: str,
|
||||
react_by: str, react_emoji: str,
|
||||
yt_replace_domain: str,
|
||||
twitter_replacement_domain: str,
|
||||
show_published_date_only: bool,
|
||||
|
@ -2301,13 +2298,13 @@ def html_individual_post(css_cache: {},
|
|||
by_str = ''
|
||||
by_text = ''
|
||||
by_text_extra = ''
|
||||
if likedBy:
|
||||
by_str = likedBy
|
||||
if liked_by:
|
||||
by_str = liked_by
|
||||
by_text = 'Liked by'
|
||||
elif reactBy and reactEmoji:
|
||||
by_str = reactBy
|
||||
elif react_by and react_emoji:
|
||||
by_str = react_by
|
||||
by_text = 'Reaction by'
|
||||
by_text_extra = ' ' + reactEmoji
|
||||
by_text_extra = ' ' + react_emoji
|
||||
|
||||
if by_str:
|
||||
by_str_nickname = get_nickname_from_actor(by_str)
|
||||
|
@ -2456,8 +2453,7 @@ def html_individual_post(css_cache: {},
|
|||
return header_str + post_str + html_footer()
|
||||
|
||||
|
||||
def html_post_replies(css_cache: {},
|
||||
recent_posts_cache: {}, max_recent_posts: int,
|
||||
def html_post_replies(recent_posts_cache: {}, max_recent_posts: int,
|
||||
translate: {}, base_dir: str,
|
||||
session, cached_webfingers: {}, person_cache: {},
|
||||
nickname: str, domain: str, port: int, replies_json: {},
|
||||
|
@ -2511,8 +2507,7 @@ def html_post_replies(css_cache: {},
|
|||
return header_str + replies_str + html_footer()
|
||||
|
||||
|
||||
def html_emoji_reaction_picker(css_cache: {},
|
||||
recent_posts_cache: {}, max_recent_posts: int,
|
||||
def html_emoji_reaction_picker(recent_posts_cache: {}, max_recent_posts: int,
|
||||
translate: {},
|
||||
base_dir: str, session, cached_webfingers: {},
|
||||
person_cache: {},
|
||||
|
|
|
@ -126,8 +126,7 @@ def _valid_profile_preview_post(post_json_object: {},
|
|||
return True, post_json_object
|
||||
|
||||
|
||||
def html_profile_after_search(css_cache: {},
|
||||
recent_posts_cache: {}, max_recent_posts: int,
|
||||
def html_profile_after_search(recent_posts_cache: {}, max_recent_posts: int,
|
||||
translate: {},
|
||||
base_dir: str, path: str, http_prefix: str,
|
||||
nickname: str, domain: str, port: int,
|
||||
|
@ -283,8 +282,7 @@ def html_profile_after_search(css_cache: {},
|
|||
joined_date = profile_json['published']
|
||||
|
||||
profile_str = \
|
||||
_get_profile_header_after_search(base_dir,
|
||||
nickname, default_timeline,
|
||||
_get_profile_header_after_search(nickname, default_timeline,
|
||||
search_nickname,
|
||||
search_domain_full,
|
||||
translate,
|
||||
|
@ -401,12 +399,10 @@ def html_profile_after_search(css_cache: {},
|
|||
profile_str + html_footer()
|
||||
|
||||
|
||||
def _get_profile_header(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
def _get_profile_header(http_prefix: str, nickname: str,
|
||||
domain_full: str, translate: {},
|
||||
default_timeline: str,
|
||||
display_name: str,
|
||||
avatar_description: str,
|
||||
profile_description_short: str,
|
||||
login_button: str, avatar_url: str,
|
||||
theme: str, moved_to: str,
|
||||
|
@ -506,8 +502,7 @@ def _get_profile_header(base_dir: str, http_prefix: str,
|
|||
return html_str
|
||||
|
||||
|
||||
def _get_profile_header_after_search(base_dir: str,
|
||||
nickname: str, default_timeline: str,
|
||||
def _get_profile_header_after_search(nickname: str, default_timeline: str,
|
||||
search_nickname: str,
|
||||
search_domain_full: str,
|
||||
translate: {},
|
||||
|
@ -899,11 +894,10 @@ def html_profile(signing_priv_key_pem: str,
|
|||
pinned_content = pin_file.read()
|
||||
|
||||
profile_header_str = \
|
||||
_get_profile_header(base_dir, http_prefix,
|
||||
nickname, domain,
|
||||
_get_profile_header(http_prefix,
|
||||
nickname,
|
||||
domain_full, translate,
|
||||
default_timeline, display_name,
|
||||
avatar_description,
|
||||
profile_description_short,
|
||||
login_button, avatar_url, theme,
|
||||
moved_to, also_known_as,
|
||||
|
@ -1040,7 +1034,7 @@ def html_profile(signing_priv_key_pem: str,
|
|||
profile_str += \
|
||||
_html_profile_following(translate, base_dir, http_prefix,
|
||||
authorized, nickname,
|
||||
domain, port, session,
|
||||
domain, session,
|
||||
cached_webfingers,
|
||||
person_cache, extra_json,
|
||||
project_version, ["unfollow"],
|
||||
|
@ -1053,7 +1047,7 @@ def html_profile(signing_priv_key_pem: str,
|
|||
profile_str += \
|
||||
_html_profile_following(translate, base_dir, http_prefix,
|
||||
authorized, nickname,
|
||||
domain, port, session,
|
||||
domain, session,
|
||||
cached_webfingers,
|
||||
person_cache, extra_json,
|
||||
project_version, ["block"],
|
||||
|
@ -1067,18 +1061,17 @@ def html_profile(signing_priv_key_pem: str,
|
|||
extra_json)
|
||||
elif selected == 'skills':
|
||||
profile_str += \
|
||||
_html_profile_skills(translate, nickname, domain_full,
|
||||
extra_json)
|
||||
_html_profile_skills(extra_json)
|
||||
# elif selected == 'shares':
|
||||
# profile_str += \
|
||||
# _html_profile_shares(actor, translate,
|
||||
# nickname, domain_full,
|
||||
# extra_json, 'shares') + license_str
|
||||
# domain_full,
|
||||
# extra_json, 'shares') + license_str
|
||||
# elif selected == 'wanted':
|
||||
# profile_str += \
|
||||
# _html_profile_shares(actor, translate,
|
||||
# nickname, domain_full,
|
||||
# extra_json, 'wanted') + license_str
|
||||
# domain_full,
|
||||
# extra_json, 'wanted') + license_str
|
||||
# end of #timeline
|
||||
profile_str += '</div>'
|
||||
|
||||
|
@ -1169,8 +1162,7 @@ def _html_profile_posts(recent_posts_cache: {}, max_recent_posts: int,
|
|||
|
||||
|
||||
def _html_profile_following(translate: {}, base_dir: str, http_prefix: str,
|
||||
authorized: bool,
|
||||
nickname: str, domain: str, port: int,
|
||||
authorized: bool, nickname: str, domain: str,
|
||||
session, cached_webfingers: {}, person_cache: {},
|
||||
following_json: {}, project_version: str,
|
||||
buttons: [],
|
||||
|
@ -1252,12 +1244,11 @@ def _html_profile_roles(translate: {}, nickname: str, domain: str,
|
|||
return profile_str
|
||||
|
||||
|
||||
def _html_profile_skills(translate: {}, nickname: str, domain: str,
|
||||
skillsJson: {}) -> str:
|
||||
def _html_profile_skills(skills_json: {}) -> str:
|
||||
"""Shows skills on the profile screen
|
||||
"""
|
||||
profile_str = ''
|
||||
for skill, level in skillsJson.items():
|
||||
for skill, level in skills_json.items():
|
||||
profile_str += \
|
||||
'<div>' + skill + \
|
||||
'<br><div id="myProgress"><div id="myBar" style="width:' + \
|
||||
|
@ -1269,7 +1260,7 @@ def _html_profile_skills(translate: {}, nickname: str, domain: str,
|
|||
|
||||
|
||||
def _html_profile_shares(actor: str, translate: {},
|
||||
nickname: str, domain: str, shares_json: {},
|
||||
domain: str, shares_json: {},
|
||||
shares_file_type: str) -> str:
|
||||
"""Shows shares on the profile screen
|
||||
"""
|
||||
|
@ -1556,8 +1547,7 @@ def _html_edit_profile_instance(base_dir: str, translate: {},
|
|||
libretranslate_url = get_config_param(base_dir, 'libretranslateUrl')
|
||||
libretranslate_api_key = get_config_param(base_dir, 'libretranslateApiKey')
|
||||
libretranslate_str = \
|
||||
_html_edit_profile_libre_translate(translate,
|
||||
libretranslate_url,
|
||||
_html_edit_profile_libre_translate(libretranslate_url,
|
||||
libretranslate_api_key)
|
||||
|
||||
return instance_str, role_assign_str, peertube_str, libretranslate_str
|
||||
|
@ -1907,8 +1897,7 @@ def _html_edit_profile_change_password(translate: {}) -> str:
|
|||
return edit_profile_form
|
||||
|
||||
|
||||
def _html_edit_profile_libre_translate(translate: {},
|
||||
libretranslate_url: str,
|
||||
def _html_edit_profile_libre_translate(libretranslate_url: str,
|
||||
libretranslate_api_key: str) -> str:
|
||||
"""Change automatic translation settings
|
||||
"""
|
||||
|
|
|
@ -14,8 +14,7 @@ from utils import acct_dir
|
|||
|
||||
|
||||
def insert_question(base_dir: str, translate: {},
|
||||
nickname: str, domain: str, port: int,
|
||||
content: str,
|
||||
nickname: str, domain: str, content: str,
|
||||
post_json_object: {}, page_number: int) -> str:
|
||||
""" Inserts question selection into a post
|
||||
"""
|
||||
|
|
|
@ -42,9 +42,7 @@ from webapp_post import individual_post_as_html
|
|||
from webapp_hashtagswarm import html_hash_tag_swarm
|
||||
|
||||
|
||||
def html_search_emoji(css_cache: {}, translate: {},
|
||||
base_dir: str, http_prefix: str,
|
||||
search_str: str) -> str:
|
||||
def html_search_emoji(translate: {}, base_dir: str, search_str: str) -> str:
|
||||
"""Search results for emoji
|
||||
"""
|
||||
# emoji.json is generated so that it can be customized and the changes
|
||||
|
@ -221,7 +219,7 @@ def _html_shares_result(base_dir: str, shares_json: {}, page_number: int,
|
|||
return results_exist, curr_page, ctr, shared_items_form
|
||||
|
||||
|
||||
def html_search_shared_items(css_cache: {}, translate: {},
|
||||
def html_search_shared_items(translate: {},
|
||||
base_dir: str, search_str: str,
|
||||
page_number: int,
|
||||
results_per_page: int,
|
||||
|
@ -331,7 +329,7 @@ def html_search_shared_items(css_cache: {}, translate: {},
|
|||
return shared_items_form
|
||||
|
||||
|
||||
def html_search_emoji_text_entry(css_cache: {}, translate: {},
|
||||
def html_search_emoji_text_entry(translate: {},
|
||||
base_dir: str, path: str) -> str:
|
||||
"""Search for an emoji by name
|
||||
"""
|
||||
|
@ -380,8 +378,7 @@ def html_search_emoji_text_entry(css_cache: {}, translate: {},
|
|||
return emoji_str
|
||||
|
||||
|
||||
def html_search(css_cache: {}, translate: {},
|
||||
base_dir: str, path: str, domain: str,
|
||||
def html_search(translate: {}, base_dir: str, path: str, domain: str,
|
||||
default_timeline: str, theme: str,
|
||||
text_mode_banner: str, access_keys: {}) -> str:
|
||||
"""Search called from the timeline icon
|
||||
|
@ -468,9 +465,7 @@ def html_search(css_cache: {}, translate: {},
|
|||
return follow_str
|
||||
|
||||
|
||||
def html_skills_search(actor: str,
|
||||
css_cache: {}, translate: {}, base_dir: str,
|
||||
http_prefix: str,
|
||||
def html_skills_search(actor: str, translate: {}, base_dir: str,
|
||||
skillsearch: str, instance_only: bool,
|
||||
posts_per_page: int) -> str:
|
||||
"""Show a page containing search results for a skill
|
||||
|
@ -601,7 +596,7 @@ def html_skills_search(actor: str,
|
|||
return skill_search_form
|
||||
|
||||
|
||||
def html_history_search(css_cache: {}, translate: {}, base_dir: str,
|
||||
def html_history_search(translate: {}, base_dir: str,
|
||||
http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
historysearch: str,
|
||||
|
@ -721,8 +716,7 @@ def html_history_search(css_cache: {}, translate: {}, base_dir: str,
|
|||
return history_search_form
|
||||
|
||||
|
||||
def html_hashtag_search(css_cache: {},
|
||||
nickname: str, domain: str, port: int,
|
||||
def html_hashtag_search(nickname: str, domain: str, port: int,
|
||||
recent_posts_cache: {}, max_recent_posts: int,
|
||||
translate: {},
|
||||
base_dir: str, hashtag: str, page_number: int,
|
||||
|
|
|
@ -16,7 +16,7 @@ from webapp_utils import html_footer
|
|||
from markdown import markdown_to_html
|
||||
|
||||
|
||||
def html_terms_of_service(css_cache: {}, base_dir: str,
|
||||
def html_terms_of_service(base_dir: str,
|
||||
http_prefix: str, domain_full: str) -> str:
|
||||
"""Show the terms of service screen
|
||||
"""
|
||||
|
|
|
@ -42,8 +42,7 @@ def get_broken_link_substitute() -> str:
|
|||
"/icons/avatar_default.png'\""
|
||||
|
||||
|
||||
def html_following_list(css_cache: {}, base_dir: str,
|
||||
following_filename: str) -> str:
|
||||
def html_following_list(base_dir: str, following_filename: str) -> str:
|
||||
"""Returns a list of handles being followed
|
||||
"""
|
||||
with open(following_filename, 'r') as following_file:
|
||||
|
@ -70,7 +69,7 @@ def html_following_list(css_cache: {}, base_dir: str,
|
|||
return ''
|
||||
|
||||
|
||||
def html_hashtag_blocked(css_cache: {}, base_dir: str, translate: {}) -> str:
|
||||
def html_hashtag_blocked(base_dir: str, translate: {}) -> str:
|
||||
"""Show the screen for a blocked hashtag
|
||||
"""
|
||||
blocked_hashtag_form = ''
|
||||
|
@ -492,7 +491,7 @@ def post_contains_public(post_json_object: {}) -> bool:
|
|||
|
||||
|
||||
def _get_image_file(base_dir: str, name: str, directory: str,
|
||||
nickname: str, domain: str, theme: str) -> (str, str):
|
||||
theme: str) -> (str, str):
|
||||
"""
|
||||
returns the filenames for an image with the given name
|
||||
"""
|
||||
|
@ -524,8 +523,7 @@ def get_banner_file(base_dir: str,
|
|||
"""Gets the image for the timeline banner
|
||||
"""
|
||||
account_dir = acct_dir(base_dir, nickname, domain)
|
||||
return _get_image_file(base_dir, 'banner', account_dir,
|
||||
nickname, domain, theme)
|
||||
return _get_image_file(base_dir, 'banner', account_dir, theme)
|
||||
|
||||
|
||||
def get_search_banner_file(base_dir: str,
|
||||
|
@ -534,8 +532,7 @@ def get_search_banner_file(base_dir: str,
|
|||
"""Gets the image for the search banner
|
||||
"""
|
||||
account_dir = acct_dir(base_dir, nickname, domain)
|
||||
return _get_image_file(base_dir, 'search_banner', account_dir,
|
||||
nickname, domain, theme)
|
||||
return _get_image_file(base_dir, 'search_banner', account_dir, theme)
|
||||
|
||||
|
||||
def get_left_image_file(base_dir: str,
|
||||
|
@ -543,8 +540,7 @@ def get_left_image_file(base_dir: str,
|
|||
"""Gets the image for the left column
|
||||
"""
|
||||
account_dir = acct_dir(base_dir, nickname, domain)
|
||||
return _get_image_file(base_dir, 'left_col_image', account_dir,
|
||||
nickname, domain, theme)
|
||||
return _get_image_file(base_dir, 'left_col_image', account_dir, theme)
|
||||
|
||||
|
||||
def get_right_image_file(base_dir: str,
|
||||
|
@ -552,8 +548,7 @@ def get_right_image_file(base_dir: str,
|
|||
"""Gets the image for the right column
|
||||
"""
|
||||
account_dir = acct_dir(base_dir, nickname, domain)
|
||||
return _get_image_file(base_dir, 'right_col_image',
|
||||
account_dir, nickname, domain, theme)
|
||||
return _get_image_file(base_dir, 'right_col_image', account_dir, theme)
|
||||
|
||||
|
||||
def _get_variable_from_css(css_str: str, variable: str) -> str:
|
||||
|
@ -1357,8 +1352,7 @@ def html_highlight_label(label: str, highlight: bool) -> str:
|
|||
return '*' + str(label) + '*'
|
||||
|
||||
|
||||
def get_avatar_image_url(session,
|
||||
base_dir: str, http_prefix: str,
|
||||
def get_avatar_image_url(session, base_dir: str, http_prefix: str,
|
||||
post_actor: str, person_cache: {},
|
||||
avatar_url: str, allow_downloads: bool,
|
||||
signing_priv_key_pem: str) -> str:
|
||||
|
|
|
@ -16,8 +16,7 @@ from webapp_utils import html_footer
|
|||
from markdown import markdown_to_html
|
||||
|
||||
|
||||
def html_welcome_final(base_dir: str, nickname: str, domain: str,
|
||||
http_prefix: str, domain_full: str,
|
||||
def html_welcome_final(base_dir: str, nickname: str,
|
||||
language: str, translate: {},
|
||||
theme_name: str) -> str:
|
||||
"""Returns the final welcome screen after first login
|
||||
|
|
Loading…
Reference in New Issue