mirror of https://gitlab.com/bashrc2/epicyon
merge-requests/30/head
commit
192d9079cb
104
daemon.py
104
daemon.py
|
@ -3086,6 +3086,103 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if '&submitView=' in options_confirm_params:
|
if '&submitView=' in options_confirm_params:
|
||||||
if debug:
|
if debug:
|
||||||
print('Viewing ' + options_actor)
|
print('Viewing ' + options_actor)
|
||||||
|
|
||||||
|
show_published_date_only = \
|
||||||
|
self.server.show_published_date_only
|
||||||
|
allow_local_network_access = \
|
||||||
|
self.server.allow_local_network_access
|
||||||
|
|
||||||
|
access_keys = self.server.access_keys
|
||||||
|
if self.server.key_shortcuts.get(chooser_nickname):
|
||||||
|
access_keys = self.server.key_shortcuts[chooser_nickname]
|
||||||
|
|
||||||
|
signing_priv_key_pem = \
|
||||||
|
self.server.signing_priv_key_pem
|
||||||
|
twitter_replacement_domain = \
|
||||||
|
self.server.twitter_replacement_domain
|
||||||
|
peertube_instances = \
|
||||||
|
self.server.peertube_instances
|
||||||
|
yt_replace_domain = \
|
||||||
|
self.server.yt_replace_domain
|
||||||
|
cached_webfingers = \
|
||||||
|
self.server.cached_webfingers
|
||||||
|
recent_posts_cache = \
|
||||||
|
self.server.recent_posts_cache
|
||||||
|
timezone = None
|
||||||
|
if self.server.account_timezone.get(chooser_nickname):
|
||||||
|
timezone = \
|
||||||
|
self.server.account_timezone.get(chooser_nickname)
|
||||||
|
|
||||||
|
profile_handle = remove_eol(options_actor).strip()
|
||||||
|
|
||||||
|
# establish the session
|
||||||
|
curr_proxy_type = self.server.proxy_type
|
||||||
|
if '.onion/' in profile_handle or \
|
||||||
|
profile_handle.endswith('.onion'):
|
||||||
|
curr_proxy_type = 'tor'
|
||||||
|
curr_session = self.server.session_onion
|
||||||
|
elif ('.i2p/' in profile_handle or
|
||||||
|
profile_handle.endswith('.i2p')):
|
||||||
|
curr_proxy_type = 'i2p'
|
||||||
|
curr_session = self.server.session_i2p
|
||||||
|
|
||||||
|
curr_session = \
|
||||||
|
self._establish_session("handle search",
|
||||||
|
curr_session,
|
||||||
|
curr_proxy_type)
|
||||||
|
if not curr_session:
|
||||||
|
self.server.postreq_busy = False
|
||||||
|
return
|
||||||
|
|
||||||
|
bold_reading = False
|
||||||
|
if self.server.bold_reading.get(chooser_nickname):
|
||||||
|
bold_reading = True
|
||||||
|
|
||||||
|
min_images_for_accounts = \
|
||||||
|
self.server.min_images_for_accounts
|
||||||
|
profile_str = \
|
||||||
|
html_profile_after_search(recent_posts_cache,
|
||||||
|
self.server.max_recent_posts,
|
||||||
|
self.server.translate,
|
||||||
|
base_dir,
|
||||||
|
users_path,
|
||||||
|
http_prefix,
|
||||||
|
chooser_nickname,
|
||||||
|
domain,
|
||||||
|
port,
|
||||||
|
profile_handle,
|
||||||
|
curr_session,
|
||||||
|
cached_webfingers,
|
||||||
|
self.server.person_cache,
|
||||||
|
self.server.debug,
|
||||||
|
self.server.project_version,
|
||||||
|
yt_replace_domain,
|
||||||
|
twitter_replacement_domain,
|
||||||
|
show_published_date_only,
|
||||||
|
self.server.default_timeline,
|
||||||
|
peertube_instances,
|
||||||
|
allow_local_network_access,
|
||||||
|
self.server.theme_name,
|
||||||
|
access_keys,
|
||||||
|
self.server.system_language,
|
||||||
|
self.server.max_like_count,
|
||||||
|
signing_priv_key_pem,
|
||||||
|
self.server.cw_lists,
|
||||||
|
self.server.lists_enabled,
|
||||||
|
timezone,
|
||||||
|
self.server.onion_domain,
|
||||||
|
self.server.i2p_domain,
|
||||||
|
bold_reading,
|
||||||
|
self.server.dogwhistles,
|
||||||
|
min_images_for_accounts)
|
||||||
|
if profile_str:
|
||||||
|
msg = profile_str.encode('utf-8')
|
||||||
|
msglen = len(msg)
|
||||||
|
self._login_headers('text/html',
|
||||||
|
msglen, calling_domain)
|
||||||
|
self._write(msg)
|
||||||
|
self.server.postreq_busy = False
|
||||||
|
return
|
||||||
self._redirect_headers(options_actor,
|
self._redirect_headers(options_actor,
|
||||||
cookie, calling_domain)
|
cookie, calling_domain)
|
||||||
self.server.postreq_busy = False
|
self.server.postreq_busy = False
|
||||||
|
@ -4487,6 +4584,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
elif ('@' in search_str or
|
elif ('@' in search_str or
|
||||||
('://' in search_str and
|
('://' in search_str and
|
||||||
has_users_path(search_str))):
|
has_users_path(search_str))):
|
||||||
|
remote_only = False
|
||||||
|
if search_str.endswith(';remote'):
|
||||||
|
search_str = search_str.replace(';remote', '')
|
||||||
|
remote_only = True
|
||||||
if search_str.endswith(':') or \
|
if search_str.endswith(':') or \
|
||||||
search_str.endswith(';') or \
|
search_str.endswith(';') or \
|
||||||
search_str.endswith('.'):
|
search_str.endswith('.'):
|
||||||
|
@ -4506,7 +4607,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
profile_path_str = path.replace('/searchhandle', '')
|
profile_path_str = path.replace('/searchhandle', '')
|
||||||
|
|
||||||
# are we already following the searched for handle?
|
# are we already following the searched for handle?
|
||||||
if is_following_actor(base_dir, nickname, domain, search_str):
|
if not remote_only and \
|
||||||
|
is_following_actor(base_dir, nickname, domain, search_str):
|
||||||
# get the actor
|
# get the actor
|
||||||
if not has_users_path(search_str):
|
if not has_users_path(search_str):
|
||||||
search_nickname = get_nickname_from_actor(search_str)
|
search_nickname = get_nickname_from_actor(search_str)
|
||||||
|
|
|
@ -2370,7 +2370,9 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
||||||
if content_license_url:
|
if content_license_url:
|
||||||
footer_str += _get_copyright_footer(content_license_url,
|
footer_str += _get_copyright_footer(content_license_url,
|
||||||
time_class)
|
time_class)
|
||||||
footer_str += '<a href="' + published_link + \
|
conv_link = '/users/' + nickname + '?convthread=' + \
|
||||||
|
published_link.replace('/', '--')
|
||||||
|
footer_str += '<a href="' + conv_link + \
|
||||||
'" class="' + time_class + '" tabindex="10">' + \
|
'" class="' + time_class + '" tabindex="10">' + \
|
||||||
published_str + '</a>\n'
|
published_str + '</a>\n'
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -62,6 +62,7 @@ from cwtch import get_cwtch_address
|
||||||
from filters import is_filtered
|
from filters import is_filtered
|
||||||
from follow import is_follower_of_person
|
from follow import is_follower_of_person
|
||||||
from follow import get_follower_domains
|
from follow import get_follower_domains
|
||||||
|
from follow import is_following_actor
|
||||||
from webapp_frontscreen import html_front_screen
|
from webapp_frontscreen import html_front_screen
|
||||||
from webapp_utils import html_following_dropdown
|
from webapp_utils import html_following_dropdown
|
||||||
from webapp_utils import edit_number_field
|
from webapp_utils import edit_number_field
|
||||||
|
@ -338,8 +339,11 @@ def html_profile_after_search(recent_posts_cache: {}, max_recent_posts: int,
|
||||||
' <center>\n'
|
' <center>\n'
|
||||||
profile_str += \
|
profile_str += \
|
||||||
' <input type="hidden" name="actor" value="' + \
|
' <input type="hidden" name="actor" value="' + \
|
||||||
person_url + '">\n' + \
|
person_url + '">\n'
|
||||||
' <button type="submit" class="button" name="submitYes" ' + \
|
if not is_following_actor(base_dir, nickname, domain, person_url):
|
||||||
|
profile_str += \
|
||||||
|
' <button type="submit" class="button" ' + \
|
||||||
|
'name="submitYes" ' + \
|
||||||
'accesskey="' + access_keys['followButton'] + '">' + \
|
'accesskey="' + access_keys['followButton'] + '">' + \
|
||||||
translate[follow_str] + '</button>\n'
|
translate[follow_str] + '</button>\n'
|
||||||
profile_str += \
|
profile_str += \
|
||||||
|
@ -376,6 +380,7 @@ def html_profile_after_search(recent_posts_cache: {}, max_recent_posts: int,
|
||||||
session, outbox_url, as_header, project_version,
|
session, outbox_url, as_header, project_version,
|
||||||
http_prefix, from_domain, debug)
|
http_prefix, from_domain, debug)
|
||||||
if user_feed:
|
if user_feed:
|
||||||
|
text_mode_separator = '<div class="transparent"><hr></div>'
|
||||||
minimize_all_images = False
|
minimize_all_images = False
|
||||||
if nickname in min_images_for_accounts:
|
if nickname in min_images_for_accounts:
|
||||||
minimize_all_images = True
|
minimize_all_images = True
|
||||||
|
@ -387,6 +392,7 @@ def html_profile_after_search(recent_posts_cache: {}, max_recent_posts: int,
|
||||||
continue
|
continue
|
||||||
|
|
||||||
profile_str += \
|
profile_str += \
|
||||||
|
text_mode_separator + \
|
||||||
individual_post_as_html(signing_priv_key_pem,
|
individual_post_as_html(signing_priv_key_pem,
|
||||||
True, recent_posts_cache,
|
True, recent_posts_cache,
|
||||||
max_recent_posts,
|
max_recent_posts,
|
||||||
|
@ -417,7 +423,7 @@ def html_profile_after_search(recent_posts_cache: {}, max_recent_posts: int,
|
||||||
instance_title = get_config_param(base_dir, 'instanceTitle')
|
instance_title = get_config_param(base_dir, 'instanceTitle')
|
||||||
return html_header_with_external_style(css_filename,
|
return html_header_with_external_style(css_filename,
|
||||||
instance_title, None) + \
|
instance_title, None) + \
|
||||||
profile_str + html_footer()
|
profile_str + text_mode_separator + html_footer()
|
||||||
|
|
||||||
|
|
||||||
def _get_profile_header(base_dir: str, http_prefix: str, nickname: str,
|
def _get_profile_header(base_dir: str, http_prefix: str, nickname: str,
|
||||||
|
|
Loading…
Reference in New Issue