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

merge-requests/30/head
Bob Mottram 2022-08-16 15:15:29 +01:00
commit 67a91630d0
1 changed files with 124 additions and 268 deletions

392
daemon.py
View File

@ -3231,9 +3231,8 @@ class PubServer(BaseHTTPRequestHandler):
self._write(msg) self._write(msg)
self.server.postreq_busy = False self.server.postreq_busy = False
return return
else: self._404()
self._404() return
return
# person options screen, snooze button # person options screen, snooze button
# See html_person_options # See html_person_options
@ -4174,7 +4173,7 @@ class PubServer(BaseHTTPRequestHandler):
getreq_start_time, getreq_start_time,
onion_domain, i2p_domain, onion_domain, i2p_domain,
cookie, debug, authorized, cookie, debug, authorized,
curr_session, curr_proxy_type) curr_session)
return return
else: else:
show_published_date_only = \ show_published_date_only = \
@ -4270,13 +4269,12 @@ class PubServer(BaseHTTPRequestHandler):
self._write(msg) self._write(msg)
self.server.postreq_busy = False self.server.postreq_busy = False
return return
else: actor_str = \
actor_str = \ self._get_instance_url(calling_domain) + users_path
self._get_instance_url(calling_domain) + users_path self._redirect_headers(actor_str + '/search',
self._redirect_headers(actor_str + '/search', cookie, calling_domain)
cookie, calling_domain) self.server.postreq_busy = False
self.server.postreq_busy = False return
return
elif (search_str.startswith(':') or elif (search_str.startswith(':') or
search_str.endswith(' emoji')): search_str.endswith(' emoji')):
# eg. "cat emoji" # eg. "cat emoji"
@ -7894,11 +7892,8 @@ class PubServer(BaseHTTPRequestHandler):
self._404() self._404()
def _get_newswire_feed(self, calling_domain: str, path: str, def _get_newswire_feed(self, calling_domain: str, path: str,
base_dir: str, http_prefix: str, proxy_type: str, getreq_start_time,
domain: str, port: int, proxy_type: str, debug: bool, curr_session) -> None:
getreq_start_time,
debug: bool,
curr_session) -> None:
"""Returns the newswire feed """Returns the newswire feed
""" """
curr_session = \ curr_session = \
@ -7931,10 +7926,8 @@ class PubServer(BaseHTTPRequestHandler):
path + ' ' + calling_domain) path + ' ' + calling_domain)
self._404() self._404()
def _get_hashtag_categories_feed(self, authorized: bool, def _get_hashtag_categories_feed(self, calling_domain: str, path: str,
calling_domain: str, path: str, base_dir: str, proxy_type: str,
base_dir: str, http_prefix: str,
domain: str, port: int, proxy_type: str,
getreq_start_time, getreq_start_time,
debug: bool, debug: bool,
curr_session) -> None: curr_session) -> None:
@ -8016,7 +8009,7 @@ class PubServer(BaseHTTPRequestHandler):
onion_domain: str, i2p_domain: str, onion_domain: str, i2p_domain: str,
cookie: str, debug: bool, cookie: str, debug: bool,
authorized: bool, authorized: bool,
curr_session, proxy_type: str) -> None: curr_session) -> None:
"""Show person options screen """Show person options screen
""" """
back_to_path = '' back_to_path = ''
@ -8175,8 +8168,7 @@ class PubServer(BaseHTTPRequestHandler):
self._redirect_headers(origin_path_str_absolute, cookie, self._redirect_headers(origin_path_str_absolute, cookie,
calling_domain) calling_domain)
def _show_media(self, calling_domain: str, def _show_media(self, path: str, base_dir: str,
path: str, base_dir: str,
getreq_start_time) -> None: getreq_start_time) -> None:
"""Returns a media file """Returns a media file
""" """
@ -8263,7 +8255,7 @@ class PubServer(BaseHTTPRequestHandler):
return return
self._404() self._404()
def _show_emoji(self, calling_domain: str, path: str, def _show_emoji(self, path: str,
base_dir: str, getreq_start_time) -> None: base_dir: str, getreq_start_time) -> None:
"""Returns an emoji image """Returns an emoji image
""" """
@ -8297,7 +8289,7 @@ class PubServer(BaseHTTPRequestHandler):
return return
self._404() self._404()
def _show_icon(self, calling_domain: str, path: str, def _show_icon(self, path: str,
base_dir: str, getreq_start_time) -> None: base_dir: str, getreq_start_time) -> None:
"""Shows an icon """Shows an icon
""" """
@ -8332,26 +8324,25 @@ class PubServer(BaseHTTPRequestHandler):
fitness_performance(getreq_start_time, self.server.fitness, fitness_performance(getreq_start_time, self.server.fitness,
'_GET', '_show_icon', self.server.debug) '_GET', '_show_icon', self.server.debug)
return return
else: if os.path.isfile(media_filename):
if os.path.isfile(media_filename): media_binary = None
media_binary = None try:
try: with open(media_filename, 'rb') as av_file:
with open(media_filename, 'rb') as av_file: media_binary = av_file.read()
media_binary = av_file.read() except OSError:
except OSError: print('EX: unable to read icon image ' + media_filename)
print('EX: unable to read icon image ' + media_filename) if media_binary:
if media_binary: mime_type = media_file_mime_type(media_filename)
mime_type = media_file_mime_type(media_filename) self._set_headers_etag(media_filename,
self._set_headers_etag(media_filename, mime_type,
mime_type, media_binary, None,
media_binary, None, self.server.domain_full,
self.server.domain_full, False, None)
False, None) self._write(media_binary)
self._write(media_binary) self.server.iconsCache[media_str] = media_binary
self.server.iconsCache[media_str] = media_binary fitness_performance(getreq_start_time, self.server.fitness,
fitness_performance(getreq_start_time, self.server.fitness, '_GET', '_show_icon', self.server.debug)
'_GET', '_show_icon', self.server.debug) return
return
self._404() self._404()
def _show_specification_image(self, path: str, def _show_specification_image(self, path: str,
@ -8535,7 +8526,7 @@ class PubServer(BaseHTTPRequestHandler):
domain: str, domain_full: str, port: int, domain: str, domain_full: str, port: int,
onion_domain: str, i2p_domain: str, onion_domain: str, i2p_domain: str,
getreq_start_time, getreq_start_time,
curr_session, proxy_type: str) -> None: curr_session) -> None:
"""Return the result of a hashtag search """Return the result of a hashtag search
""" """
page_number = 1 page_number = 1
@ -8721,11 +8712,11 @@ class PubServer(BaseHTTPRequestHandler):
calling_domain) calling_domain)
return return
if self.server.onion_domain: if onion_domain:
if '.onion/' in actor: if '.onion/' in actor:
curr_session = self.server.session_onion curr_session = self.server.session_onion
proxy_type = 'tor' proxy_type = 'tor'
if self.server.i2p_domain: if i2p_domain:
if '.onion/' in actor: if '.onion/' in actor:
curr_session = self.server.session_i2p curr_session = self.server.session_i2p
proxy_type = 'i2p' proxy_type = 'i2p'
@ -8760,8 +8751,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.project_version, self.server.project_version,
self.server.signing_priv_key_pem, self.server.signing_priv_key_pem,
self.server.domain, self.server.domain,
self.server.onion_domain, onion_domain,
self.server.i2p_domain) i2p_domain)
announce_filename = None announce_filename = None
if announce_json: if announce_json:
# save the announce straight to the outbox # save the announce straight to the outbox
@ -8905,11 +8896,11 @@ class PubServer(BaseHTTPRequestHandler):
calling_domain) calling_domain)
return return
if self.server.onion_domain: if onion_domain:
if '.onion/' in actor: if '.onion/' in actor:
curr_session = self.server.session_onion curr_session = self.server.session_onion
proxy_type = 'tor' proxy_type = 'tor'
if self.server.i2p_domain: if i2p_domain:
if '.onion/' in actor: if '.onion/' in actor:
curr_session = self.server.session_i2p curr_session = self.server.session_i2p
proxy_type = 'i2p' proxy_type = 'i2p'
@ -9262,11 +9253,11 @@ class PubServer(BaseHTTPRequestHandler):
calling_domain) calling_domain)
return return
if self.server.onion_domain: if onion_domain:
if '.onion/' in actor: if '.onion/' in actor:
curr_session = self.server.session_onion curr_session = self.server.session_onion
proxy_type = 'tor' proxy_type = 'tor'
if self.server.i2p_domain: if i2p_domain:
if '.onion/' in actor: if '.onion/' in actor:
curr_session = self.server.session_i2p curr_session = self.server.session_i2p
proxy_type = 'i2p' proxy_type = 'i2p'
@ -9456,11 +9447,11 @@ class PubServer(BaseHTTPRequestHandler):
calling_domain) calling_domain)
return return
if self.server.onion_domain: if onion_domain:
if '.onion/' in actor: if '.onion/' in actor:
curr_session = self.server.session_onion curr_session = self.server.session_onion
proxy_type = 'tor' proxy_type = 'tor'
if self.server.i2p_domain: if i2p_domain:
if '.onion/' in actor: if '.onion/' in actor:
curr_session = self.server.session_i2p curr_session = self.server.session_i2p
proxy_type = 'i2p' proxy_type = 'i2p'
@ -9655,11 +9646,11 @@ class PubServer(BaseHTTPRequestHandler):
calling_domain) calling_domain)
return return
if self.server.onion_domain: if onion_domain:
if '.onion/' in actor: if '.onion/' in actor:
curr_session = self.server.session_onion curr_session = self.server.session_onion
proxy_type = 'tor' proxy_type = 'tor'
if self.server.i2p_domain: if i2p_domain:
if '.onion/' in actor: if '.onion/' in actor:
curr_session = self.server.session_i2p curr_session = self.server.session_i2p
proxy_type = 'i2p' proxy_type = 'i2p'
@ -9870,11 +9861,11 @@ class PubServer(BaseHTTPRequestHandler):
return return
emoji_content = urllib.parse.unquote_plus(emoji_content_encoded) emoji_content = urllib.parse.unquote_plus(emoji_content_encoded)
if self.server.onion_domain: if onion_domain:
if '.onion/' in actor: if '.onion/' in actor:
curr_session = self.server.session_onion curr_session = self.server.session_onion
proxy_type = 'tor' proxy_type = 'tor'
if self.server.i2p_domain: if i2p_domain:
if '.onion/' in actor: if '.onion/' in actor:
curr_session = self.server.session_i2p curr_session = self.server.session_i2p
proxy_type = 'i2p' proxy_type = 'i2p'
@ -10161,11 +10152,11 @@ class PubServer(BaseHTTPRequestHandler):
calling_domain) calling_domain)
return return
if self.server.onion_domain: if onion_domain:
if '.onion/' in actor: if '.onion/' in actor:
curr_session = self.server.session_onion curr_session = self.server.session_onion
proxy_type = 'tor' proxy_type = 'tor'
if self.server.i2p_domain: if i2p_domain:
if '.onion/' in actor: if '.onion/' in actor:
curr_session = self.server.session_i2p curr_session = self.server.session_i2p
proxy_type = 'i2p' proxy_type = 'i2p'
@ -10308,11 +10299,11 @@ class PubServer(BaseHTTPRequestHandler):
calling_domain) calling_domain)
return return
if self.server.onion_domain: if onion_domain:
if '.onion/' in actor: if '.onion/' in actor:
curr_session = self.server.session_onion curr_session = self.server.session_onion
proxy_type = 'tor' proxy_type = 'tor'
if self.server.i2p_domain: if i2p_domain:
if '.onion/' in actor: if '.onion/' in actor:
curr_session = self.server.session_i2p curr_session = self.server.session_i2p
proxy_type = 'i2p' proxy_type = 'i2p'
@ -10783,7 +10774,6 @@ class PubServer(BaseHTTPRequestHandler):
path: str, path: str,
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
domain: str, domain_full: str, port: int, domain: str, domain_full: str, port: int,
onion_domain: str, i2p_domain: str,
getreq_start_time, getreq_start_time,
proxy_type: str, cookie: str, proxy_type: str, cookie: str,
debug: str, debug: str,
@ -11027,15 +11017,10 @@ class PubServer(BaseHTTPRequestHandler):
return True return True
return False return False
def _show_roles(self, authorized: bool, def _show_roles(self, calling_domain: str, referer_domain: str,
calling_domain: str, referer_domain: str, path: str, base_dir: str, http_prefix: str,
path: str, domain: str, getreq_start_time,
base_dir: str, http_prefix: str, proxy_type: str, cookie: str, debug: str,
domain: str, domain_full: str, port: int,
onion_domain: str, i2p_domain: str,
getreq_start_time,
proxy_type: str, cookie: str,
debug: str,
curr_session) -> bool: curr_session) -> bool:
"""Show roles within profile screen """Show roles within profile screen
""" """
@ -11151,16 +11136,10 @@ class PubServer(BaseHTTPRequestHandler):
return True return True
return False return False
def _show_skills(self, authorized: bool, def _show_skills(self, calling_domain: str, referer_domain: str,
calling_domain: str, referer_domain: str, path: str, base_dir: str, http_prefix: str,
path: str, domain: str, getreq_start_time, proxy_type: str,
base_dir: str, http_prefix: str, cookie: str, debug: str, curr_session) -> bool:
domain: str, domain_full: str, port: int,
onion_domain: str, i2p_domain: str,
getreq_start_time,
proxy_type: str, cookie: str,
debug: str,
curr_session) -> bool:
"""Show skills on the profile screen """Show skills on the profile screen
""" """
named_status = path.split('/users/')[1] named_status = path.split('/users/')[1]
@ -11287,7 +11266,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.fitness, self.server.fitness,
'_GET', '_GET',
'_show_skills json', '_show_skills json',
self.server.debug) debug)
else: else:
self._404() self._404()
return True return True
@ -11385,10 +11364,9 @@ class PubServer(BaseHTTPRequestHandler):
result = self._show_post_from_file(post_filename, liked_by, result = self._show_post_from_file(post_filename, liked_by,
react_by, react_emoji, react_by, react_emoji,
authorized, calling_domain, authorized, calling_domain,
referer_domain, path, referer_domain,
base_dir, http_prefix, nickname, base_dir, http_prefix, nickname,
domain, domain_full, port, domain, port,
onion_domain, i2p_domain,
getreq_start_time, getreq_start_time,
proxy_type, cookie, debug, proxy_type, cookie, debug,
include_create_wrapper, include_create_wrapper,
@ -11401,12 +11379,9 @@ class PubServer(BaseHTTPRequestHandler):
def _show_likers_of_post(self, authorized: bool, def _show_likers_of_post(self, authorized: bool,
calling_domain: str, path: str, calling_domain: str, path: str,
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
domain: str, domain_full: str, port: int, domain: str, port: int,
onion_domain: str, i2p_domain: str, getreq_start_time, cookie: str,
getreq_start_time, debug: str, curr_session) -> bool:
proxy_type: str, cookie: str,
debug: str,
curr_session) -> bool:
"""Show the likers of a post """Show the likers of a post
""" """
if not authorized: if not authorized:
@ -11461,18 +11436,15 @@ class PubServer(BaseHTTPRequestHandler):
self._write(msg) self._write(msg)
fitness_performance(getreq_start_time, self.server.fitness, fitness_performance(getreq_start_time, self.server.fitness,
'_GET', '_show_likers_of_post', '_GET', '_show_likers_of_post',
self.server.debug) debug)
return True return True
def _show_announcers_of_post(self, authorized: bool, def _show_announcers_of_post(self, authorized: bool,
calling_domain: str, path: str, calling_domain: str, path: str,
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
domain: str, domain_full: str, port: int, domain: str, port: int,
onion_domain: str, i2p_domain: str, getreq_start_time, cookie: str,
getreq_start_time, debug: str, curr_session) -> bool:
proxy_type: str, cookie: str,
debug: str,
curr_session) -> bool:
"""Show the announcers of a post """Show the announcers of a post
""" """
if not authorized: if not authorized:
@ -11529,17 +11501,15 @@ class PubServer(BaseHTTPRequestHandler):
self._write(msg) self._write(msg)
fitness_performance(getreq_start_time, self.server.fitness, fitness_performance(getreq_start_time, self.server.fitness,
'_GET', '_show_announcers_of_post', '_GET', '_show_announcers_of_post',
self.server.debug) debug)
return True return True
def _show_post_from_file(self, post_filename: str, liked_by: str, def _show_post_from_file(self, post_filename: str, liked_by: str,
react_by: str, react_emoji: str, react_by: str, react_emoji: str,
authorized: bool, authorized: bool,
calling_domain: str, referer_domain: str, calling_domain: str, referer_domain: str,
path: str,
base_dir: str, http_prefix: str, nickname: str, base_dir: str, http_prefix: str, nickname: str,
domain: str, domain_full: str, port: int, domain: str, port: int,
onion_domain: str, i2p_domain: str,
getreq_start_time, getreq_start_time,
proxy_type: str, cookie: str, proxy_type: str, cookie: str,
debug: str, include_create_wrapper: bool, debug: str, include_create_wrapper: bool,
@ -11616,7 +11586,7 @@ class PubServer(BaseHTTPRequestHandler):
self._write(msg) self._write(msg)
fitness_performance(getreq_start_time, self.server.fitness, fitness_performance(getreq_start_time, self.server.fitness,
'_GET', '_show_post_from_file', '_GET', '_show_post_from_file',
self.server.debug) debug)
else: else:
if self._secure_mode(curr_session, proxy_type): if self._secure_mode(curr_session, proxy_type):
if not include_create_wrapper and \ if not include_create_wrapper and \
@ -11641,7 +11611,7 @@ class PubServer(BaseHTTPRequestHandler):
self._write(msg) self._write(msg)
fitness_performance(getreq_start_time, self.server.fitness, fitness_performance(getreq_start_time, self.server.fitness,
'_GET', '_show_post_from_file json', '_GET', '_show_post_from_file json',
self.server.debug) debug)
else: else:
self._404() self._404()
self.server.getreq_busy = False self.server.getreq_busy = False
@ -11652,7 +11622,6 @@ class PubServer(BaseHTTPRequestHandler):
path: str, path: str,
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
domain: str, domain_full: str, port: int, domain: str, domain_full: str, port: int,
onion_domain: str, i2p_domain: str,
getreq_start_time, getreq_start_time,
proxy_type: str, cookie: str, proxy_type: str, cookie: str,
debug: str, debug: str,
@ -11730,10 +11699,9 @@ class PubServer(BaseHTTPRequestHandler):
result = self._show_post_from_file(post_filename, liked_by, result = self._show_post_from_file(post_filename, liked_by,
react_by, react_emoji, react_by, react_emoji,
authorized, calling_domain, authorized, calling_domain,
referer_domain, path, referer_domain,
base_dir, http_prefix, nickname, base_dir, http_prefix, nickname,
domain, domain_full, port, domain, port,
onion_domain, i2p_domain,
getreq_start_time, getreq_start_time,
proxy_type, cookie, debug, proxy_type, cookie, debug,
include_create_wrapper, include_create_wrapper,
@ -11747,8 +11715,7 @@ class PubServer(BaseHTTPRequestHandler):
calling_domain: str, referer_domain: str, calling_domain: str, referer_domain: str,
path: str, path: str,
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
domain: str, domain_full: str, port: int, domain: str, port: int,
onion_domain: str, i2p_domain: str,
getreq_start_time, getreq_start_time,
proxy_type: str, cookie: str, proxy_type: str, cookie: str,
debug: str, debug: str,
@ -11779,10 +11746,9 @@ class PubServer(BaseHTTPRequestHandler):
result = self._show_post_from_file(post_filename, liked_by, result = self._show_post_from_file(post_filename, liked_by,
react_by, react_emoji, react_by, react_emoji,
authorized, calling_domain, authorized, calling_domain,
referer_domain, path, referer_domain,
base_dir, http_prefix, nickname, base_dir, http_prefix, nickname,
domain, domain_full, port, domain, port,
onion_domain, i2p_domain,
getreq_start_time, getreq_start_time,
proxy_type, cookie, debug, proxy_type, cookie, debug,
include_create_wrapper, include_create_wrapper,
@ -11796,11 +11762,9 @@ class PubServer(BaseHTTPRequestHandler):
calling_domain: str, referer_domain: str, calling_domain: str, referer_domain: str,
path: str, path: str,
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
domain: str, domain_full: str, port: int, domain: str, port: int,
onion_domain: str, i2p_domain: str,
getreq_start_time, getreq_start_time,
proxy_type: str, cookie: str, cookie: str, debug: str,
debug: str,
recent_posts_cache: {}, curr_session, recent_posts_cache: {}, curr_session,
default_timeline: str, default_timeline: str,
max_recent_posts: int, max_recent_posts: int,
@ -11982,13 +11946,10 @@ class PubServer(BaseHTTPRequestHandler):
def _show_dms(self, authorized: bool, def _show_dms(self, authorized: bool,
calling_domain: str, referer_domain: str, calling_domain: str, referer_domain: str,
path: str, path: str, base_dir: str, http_prefix: str,
base_dir: str, http_prefix: str, domain: str, port: int,
domain: str, domain_full: str, port: int,
onion_domain: str, i2p_domain: str,
getreq_start_time, getreq_start_time,
proxy_type: str, cookie: str, cookie: str, debug: str,
debug: str,
curr_session, ua_str: str) -> bool: curr_session, ua_str: str) -> bool:
"""Shows the DMs timeline """Shows the DMs timeline
""" """
@ -12145,10 +12106,9 @@ class PubServer(BaseHTTPRequestHandler):
calling_domain: str, referer_domain: str, calling_domain: str, referer_domain: str,
path: str, path: str,
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
domain: str, domain_full: str, port: int, domain: str, port: int,
onion_domain: str, i2p_domain: str,
getreq_start_time, getreq_start_time,
proxy_type: str, cookie: str, debug: str, cookie: str, debug: str,
curr_session, ua_str: str) -> bool: curr_session, ua_str: str) -> bool:
"""Shows the replies timeline """Shows the replies timeline
""" """
@ -12305,11 +12265,9 @@ class PubServer(BaseHTTPRequestHandler):
calling_domain: str, referer_domain: str, calling_domain: str, referer_domain: str,
path: str, path: str,
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
domain: str, domain_full: str, port: int, domain: str, port: int,
onion_domain: str, i2p_domain: str,
getreq_start_time, getreq_start_time,
proxy_type: str, cookie: str, cookie: str, debug: str,
debug: str,
curr_session, ua_str: str) -> bool: curr_session, ua_str: str) -> bool:
"""Shows the media timeline """Shows the media timeline
""" """
@ -12463,11 +12421,9 @@ class PubServer(BaseHTTPRequestHandler):
calling_domain: str, referer_domain: str, calling_domain: str, referer_domain: str,
path: str, path: str,
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
domain: str, domain_full: str, port: int, domain: str, port: int,
onion_domain: str, i2p_domain: str,
getreq_start_time, getreq_start_time,
proxy_type: str, cookie: str, cookie: str, debug: str,
debug: str,
curr_session, ua_str: str) -> bool: curr_session, ua_str: str) -> bool:
"""Shows the blogs timeline """Shows the blogs timeline
""" """
@ -12622,11 +12578,9 @@ class PubServer(BaseHTTPRequestHandler):
calling_domain: str, referer_domain: str, calling_domain: str, referer_domain: str,
path: str, path: str,
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
domain: str, domain_full: str, port: int, domain: str, port: int,
onion_domain: str, i2p_domain: str,
getreq_start_time, getreq_start_time,
proxy_type: str, cookie: str, cookie: str, debug: str,
debug: str,
curr_session, ua_str: str) -> bool: curr_session, ua_str: str) -> bool:
"""Shows the news timeline """Shows the news timeline
""" """
@ -12786,13 +12740,10 @@ class PubServer(BaseHTTPRequestHandler):
def _show_features_timeline(self, authorized: bool, def _show_features_timeline(self, authorized: bool,
calling_domain: str, referer_domain: str, calling_domain: str, referer_domain: str,
path: str, path: str, base_dir: str, http_prefix: str,
base_dir: str, http_prefix: str, domain: str, port: int,
domain: str, domain_full: str, port: int,
onion_domain: str, i2p_domain: str,
getreq_start_time, getreq_start_time,
proxy_type: str, cookie: str, cookie: str, debug: str,
debug: str,
curr_session, ua_str: str) -> bool: curr_session, ua_str: str) -> bool:
"""Shows the features timeline (all local blogs) """Shows the features timeline (all local blogs)
""" """
@ -12957,11 +12908,9 @@ class PubServer(BaseHTTPRequestHandler):
def _show_shares_timeline(self, authorized: bool, def _show_shares_timeline(self, authorized: bool,
calling_domain: str, path: str, calling_domain: str, path: str,
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
domain: str, domain_full: str, port: int, domain: str, port: int,
onion_domain: str, i2p_domain: str,
getreq_start_time, getreq_start_time,
proxy_type: str, cookie: str, cookie: str, debug: str,
debug: str,
curr_session, ua_str: str) -> bool: curr_session, ua_str: str) -> bool:
"""Shows the shares timeline """Shows the shares timeline
""" """
@ -13052,11 +13001,9 @@ class PubServer(BaseHTTPRequestHandler):
def _show_wanted_timeline(self, authorized: bool, def _show_wanted_timeline(self, authorized: bool,
calling_domain: str, path: str, calling_domain: str, path: str,
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
domain: str, domain_full: str, port: int, domain: str, port: int,
onion_domain: str, i2p_domain: str,
getreq_start_time, getreq_start_time,
proxy_type: str, cookie: str, cookie: str, debug: str,
debug: str,
curr_session, ua_str: str) -> bool: curr_session, ua_str: str) -> bool:
"""Shows the wanted timeline """Shows the wanted timeline
""" """
@ -13147,11 +13094,9 @@ class PubServer(BaseHTTPRequestHandler):
calling_domain: str, referer_domain: str, calling_domain: str, referer_domain: str,
path: str, path: str,
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
domain: str, domain_full: str, port: int, domain: str, port: int,
onion_domain: str, i2p_domain: str,
getreq_start_time, getreq_start_time,
proxy_type: str, cookie: str, cookie: str, debug: str,
debug: str,
curr_session, ua_str: str) -> bool: curr_session, ua_str: str) -> bool:
"""Shows the bookmarks timeline """Shows the bookmarks timeline
""" """
@ -13308,12 +13253,11 @@ class PubServer(BaseHTTPRequestHandler):
calling_domain: str, referer_domain: str, calling_domain: str, referer_domain: str,
path: str, path: str,
base_dir: str, http_prefix: str, base_dir: str, http_prefix: str,
domain: str, domain_full: str, port: int, domain: str, port: int,
onion_domain: str, i2p_domain: str,
getreq_start_time, getreq_start_time,
proxy_type: str, cookie: str, cookie: str, debug: str,
debug: str, curr_session, ua_str: str,
curr_session, ua_str: str) -> bool: proxy_type: str) -> bool:
"""Shows the outbox timeline """Shows the outbox timeline
""" """
# get outbox feed for a person # get outbox feed for a person
@ -13422,7 +13366,7 @@ class PubServer(BaseHTTPRequestHandler):
fitness_performance(getreq_start_time, fitness_performance(getreq_start_time,
self.server.fitness, self.server.fitness,
'_GET', '_show_outbox_timeline', '_GET', '_show_outbox_timeline',
self.server.debug) debug)
else: else:
if self._secure_mode(curr_session, proxy_type): if self._secure_mode(curr_session, proxy_type):
msg_str = json.dumps(outbox_feed, msg_str = json.dumps(outbox_feed,
@ -13438,7 +13382,7 @@ class PubServer(BaseHTTPRequestHandler):
fitness_performance(getreq_start_time, fitness_performance(getreq_start_time,
self.server.fitness, self.server.fitness,
'_GET', '_show_outbox_timeline json', '_GET', '_show_outbox_timeline json',
self.server.debug) debug)
else: else:
self._404() self._404()
return True return True
@ -13446,13 +13390,9 @@ class PubServer(BaseHTTPRequestHandler):
def _show_mod_timeline(self, authorized: bool, def _show_mod_timeline(self, authorized: bool,
calling_domain: str, referer_domain: str, calling_domain: str, referer_domain: str,
path: str, path: str, base_dir: str, http_prefix: str,
base_dir: str, http_prefix: str, domain: str, port: int, getreq_start_time,
domain: str, domain_full: str, port: int, cookie: str, debug: str,
onion_domain: str, i2p_domain: str,
getreq_start_time,
proxy_type: str, cookie: str,
debug: str,
curr_session, ua_str: str) -> bool: curr_session, ua_str: str) -> bool:
"""Shows the moderation timeline """Shows the moderation timeline
""" """
@ -15796,12 +15736,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.debug) self.server.debug)
if self.path == '/categories.xml': if self.path == '/categories.xml':
self._get_hashtag_categories_feed(authorized, self._get_hashtag_categories_feed(calling_domain, self.path,
calling_domain, self.path,
self.server.base_dir, self.server.base_dir,
self.server.http_prefix,
self.server.domain,
self.server.port,
proxy_type, proxy_type,
getreq_start_time, getreq_start_time,
self.server.debug, self.server.debug,
@ -15810,10 +15746,6 @@ class PubServer(BaseHTTPRequestHandler):
if self.path == '/newswire.xml': if self.path == '/newswire.xml':
self._get_newswire_feed(calling_domain, self.path, self._get_newswire_feed(calling_domain, self.path,
self.server.base_dir,
self.server.http_prefix,
self.server.domain,
self.server.port,
proxy_type, proxy_type,
getreq_start_time, getreq_start_time,
self.server.debug, self.server.debug,
@ -16195,8 +16127,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.i2p_domain, self.server.i2p_domain,
cookie, self.server.debug, cookie, self.server.debug,
authorized, authorized,
curr_session, curr_session)
proxy_type)
return return
fitness_performance(getreq_start_time, self.server.fitness, fitness_performance(getreq_start_time, self.server.fitness,
@ -16910,8 +16841,7 @@ class PubServer(BaseHTTPRequestHandler):
# emoji images # emoji images
if '/emoji/' in self.path: if '/emoji/' in self.path:
self._show_emoji(calling_domain, self.path, self._show_emoji(self.path, self.server.base_dir,
self.server.base_dir,
getreq_start_time) getreq_start_time)
return return
@ -16926,8 +16856,7 @@ class PubServer(BaseHTTPRequestHandler):
self.path = self.path.replace('/system/media_attachments/files/', self.path = self.path.replace('/system/media_attachments/files/',
'/media/') '/media/')
if '/media/' in self.path: if '/media/' in self.path:
self._show_media(calling_domain, self._show_media(self.path, self.server.base_dir,
self.path, self.server.base_dir,
getreq_start_time) getreq_start_time)
return return
@ -16958,8 +16887,8 @@ class PubServer(BaseHTTPRequestHandler):
# icon images # icon images
# Note that this comes before the busy flag to avoid conflicts # Note that this comes before the busy flag to avoid conflicts
if self.path.startswith('/icons/'): if self.path.startswith('/icons/'):
self._show_icon(calling_domain, self.path, self._show_icon(self.path, self.server.base_dir,
self.server.base_dir, getreq_start_time) getreq_start_time)
return return
# show images within https://instancedomain/activitypub # show images within https://instancedomain/activitypub
@ -17211,8 +17140,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.onion_domain, self.server.onion_domain,
self.server.i2p_domain, self.server.i2p_domain,
getreq_start_time, getreq_start_time,
curr_session, curr_session)
proxy_type)
self.server.getreq_busy = False self.server.getreq_busy = False
return return
@ -18038,12 +17966,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.base_dir, self.server.base_dir,
self.server.http_prefix, self.server.http_prefix,
self.server.domain, self.server.domain,
self.server.domain_full,
self.server.port, self.server.port,
self.server.onion_domain,
self.server.i2p_domain,
getreq_start_time, getreq_start_time,
proxy_type,
cookie, self.server.debug, cookie, self.server.debug,
curr_session): curr_session):
self.server.getreq_busy = False self.server.getreq_busy = False
@ -18055,12 +17979,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.base_dir, self.server.base_dir,
self.server.http_prefix, self.server.http_prefix,
self.server.domain, self.server.domain,
self.server.domain_full,
self.server.port, self.server.port,
self.server.onion_domain,
self.server.i2p_domain,
getreq_start_time, getreq_start_time,
proxy_type,
cookie, self.server.debug, cookie, self.server.debug,
curr_session): curr_session):
self.server.getreq_busy = False self.server.getreq_busy = False
@ -18080,8 +18000,6 @@ class PubServer(BaseHTTPRequestHandler):
self.server.domain, self.server.domain,
self.server.domain_full, self.server.domain_full,
self.server.port, self.server.port,
self.server.onion_domain,
self.server.i2p_domain,
getreq_start_time, getreq_start_time,
proxy_type, cookie, proxy_type, cookie,
self.server.debug, self.server.debug,
@ -18095,16 +18013,11 @@ class PubServer(BaseHTTPRequestHandler):
# roles on profile screen # roles on profile screen
if self.path.endswith('/roles') and users_in_path: if self.path.endswith('/roles') and users_in_path:
if self._show_roles(authorized, if self._show_roles(calling_domain, referer_domain,
calling_domain, referer_domain,
self.path, self.path,
self.server.base_dir, self.server.base_dir,
self.server.http_prefix, self.server.http_prefix,
self.server.domain, self.server.domain,
self.server.domain_full,
self.server.port,
self.server.onion_domain,
self.server.i2p_domain,
getreq_start_time, getreq_start_time,
proxy_type, proxy_type,
cookie, self.server.debug, cookie, self.server.debug,
@ -18118,16 +18031,11 @@ class PubServer(BaseHTTPRequestHandler):
# show skills on the profile page # show skills on the profile page
if self.path.endswith('/skills') and users_in_path: if self.path.endswith('/skills') and users_in_path:
if self._show_skills(authorized, if self._show_skills(calling_domain, referer_domain,
calling_domain, referer_domain,
self.path, self.path,
self.server.base_dir, self.server.base_dir,
self.server.http_prefix, self.server.http_prefix,
self.server.domain, self.server.domain,
self.server.domain_full,
self.server.port,
self.server.onion_domain,
self.server.i2p_domain,
getreq_start_time, getreq_start_time,
proxy_type, proxy_type,
cookie, self.server.debug, cookie, self.server.debug,
@ -18146,10 +18054,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.base_dir, self.server.base_dir,
self.server.http_prefix, self.server.http_prefix,
self.server.domain, self.server.domain,
self.server.domain_full,
self.server.port, self.server.port,
self.server.onion_domain,
self.server.i2p_domain,
getreq_start_time, getreq_start_time,
proxy_type, proxy_type,
cookie, self.server.debug, cookie, self.server.debug,
@ -18168,8 +18073,6 @@ class PubServer(BaseHTTPRequestHandler):
self.server.domain, self.server.domain,
self.server.domain_full, self.server.domain_full,
self.server.port, self.server.port,
self.server.onion_domain,
self.server.i2p_domain,
getreq_start_time, getreq_start_time,
proxy_type, proxy_type,
cookie, self.server.debug, cookie, self.server.debug,
@ -18189,12 +18092,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.base_dir, self.server.base_dir,
self.server.http_prefix, self.server.http_prefix,
self.server.domain, self.server.domain,
self.server.domain_full,
self.server.port, self.server.port,
self.server.onion_domain,
self.server.i2p_domain,
getreq_start_time, getreq_start_time,
proxy_type,
cookie, self.server.debug, cookie, self.server.debug,
self.server.recent_posts_cache, self.server.recent_posts_cache,
curr_session, curr_session,
@ -18223,12 +18122,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.base_dir, self.server.base_dir,
self.server.http_prefix, self.server.http_prefix,
self.server.domain, self.server.domain,
self.server.domain_full,
self.server.port, self.server.port,
self.server.onion_domain,
self.server.i2p_domain,
getreq_start_time, getreq_start_time,
proxy_type,
cookie, self.server.debug, cookie, self.server.debug,
curr_session, ua_str): curr_session, ua_str):
self.server.getreq_busy = False self.server.getreq_busy = False
@ -18246,12 +18141,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.base_dir, self.server.base_dir,
self.server.http_prefix, self.server.http_prefix,
self.server.domain, self.server.domain,
self.server.domain_full,
self.server.port, self.server.port,
self.server.onion_domain,
self.server.i2p_domain,
getreq_start_time, getreq_start_time,
proxy_type,
cookie, self.server.debug, cookie, self.server.debug,
curr_session, ua_str): curr_session, ua_str):
self.server.getreq_busy = False self.server.getreq_busy = False
@ -18269,12 +18160,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.base_dir, self.server.base_dir,
self.server.http_prefix, self.server.http_prefix,
self.server.domain, self.server.domain,
self.server.domain_full,
self.server.port, self.server.port,
self.server.onion_domain,
self.server.i2p_domain,
getreq_start_time, getreq_start_time,
proxy_type,
cookie, self.server.debug, cookie, self.server.debug,
curr_session, ua_str): curr_session, ua_str):
self.server.getreq_busy = False self.server.getreq_busy = False
@ -18292,12 +18179,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.base_dir, self.server.base_dir,
self.server.http_prefix, self.server.http_prefix,
self.server.domain, self.server.domain,
self.server.domain_full,
self.server.port, self.server.port,
self.server.onion_domain,
self.server.i2p_domain,
getreq_start_time, getreq_start_time,
proxy_type,
cookie, self.server.debug, cookie, self.server.debug,
curr_session, ua_str): curr_session, ua_str):
self.server.getreq_busy = False self.server.getreq_busy = False
@ -18315,12 +18198,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.base_dir, self.server.base_dir,
self.server.http_prefix, self.server.http_prefix,
self.server.domain, self.server.domain,
self.server.domain_full,
self.server.port, self.server.port,
self.server.onion_domain,
self.server.i2p_domain,
getreq_start_time, getreq_start_time,
proxy_type,
cookie, self.server.debug, cookie, self.server.debug,
curr_session, ua_str): curr_session, ua_str):
self.server.getreq_busy = False self.server.getreq_busy = False
@ -18335,12 +18214,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.base_dir, self.server.base_dir,
self.server.http_prefix, self.server.http_prefix,
self.server.domain, self.server.domain,
self.server.domain_full,
self.server.port, self.server.port,
self.server.onion_domain,
self.server.i2p_domain,
getreq_start_time, getreq_start_time,
proxy_type,
cookie, self.server.debug, cookie, self.server.debug,
curr_session, ua_str): curr_session, ua_str):
self.server.getreq_busy = False self.server.getreq_busy = False
@ -18357,12 +18232,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.base_dir, self.server.base_dir,
self.server.http_prefix, self.server.http_prefix,
self.server.domain, self.server.domain,
self.server.domain_full,
self.server.port, self.server.port,
self.server.onion_domain,
self.server.i2p_domain,
getreq_start_time, getreq_start_time,
proxy_type,
cookie, self.server.debug, cookie, self.server.debug,
curr_session, ua_str): curr_session, ua_str):
self.server.getreq_busy = False self.server.getreq_busy = False
@ -18375,12 +18246,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.base_dir, self.server.base_dir,
self.server.http_prefix, self.server.http_prefix,
self.server.domain, self.server.domain,
self.server.domain_full,
self.server.port, self.server.port,
self.server.onion_domain,
self.server.i2p_domain,
getreq_start_time, getreq_start_time,
proxy_type,
cookie, self.server.debug, cookie, self.server.debug,
curr_session, ua_str): curr_session, ua_str):
self.server.getreq_busy = False self.server.getreq_busy = False
@ -18477,12 +18344,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.base_dir, self.server.base_dir,
self.server.http_prefix, self.server.http_prefix,
self.server.domain, self.server.domain,
self.server.domain_full,
self.server.port, self.server.port,
self.server.onion_domain,
self.server.i2p_domain,
getreq_start_time, getreq_start_time,
proxy_type,
cookie, self.server.debug, cookie, self.server.debug,
curr_session, ua_str): curr_session, ua_str):
self.server.getreq_busy = False self.server.getreq_busy = False
@ -18501,14 +18364,11 @@ class PubServer(BaseHTTPRequestHandler):
self.server.base_dir, self.server.base_dir,
self.server.http_prefix, self.server.http_prefix,
self.server.domain, self.server.domain,
self.server.domain_full,
self.server.port, self.server.port,
self.server.onion_domain,
self.server.i2p_domain,
getreq_start_time, getreq_start_time,
proxy_type,
cookie, self.server.debug, cookie, self.server.debug,
curr_session, ua_str): curr_session, ua_str,
proxy_type):
self.server.getreq_busy = False self.server.getreq_busy = False
return return
@ -18525,12 +18385,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.base_dir, self.server.base_dir,
self.server.http_prefix, self.server.http_prefix,
self.server.domain, self.server.domain,
self.server.domain_full,
self.server.port, self.server.port,
self.server.onion_domain,
self.server.i2p_domain,
getreq_start_time, getreq_start_time,
proxy_type,
cookie, self.server.debug, cookie, self.server.debug,
curr_session, ua_str): curr_session, ua_str):
self.server.getreq_busy = False self.server.getreq_busy = False