main
Bob Mottram 2024-04-11 11:42:57 +01:00
parent 40221f0efd
commit a651dc0e98
2 changed files with 109 additions and 48 deletions

View File

@ -4338,7 +4338,43 @@ def daemon_http_get(self) -> None:
getreq_start_time, getreq_start_time,
proxy_type, proxy_type,
cookie, self.server.debug, cookie, self.server.debug,
curr_session): curr_session,
self.server.access_keys,
self.server.key_shortcuts,
self.server.city,
self.server.account_timezone,
self.server.bold_reading,
self.server.max_shares_on_profile,
self.server.sites_unavailable,
self.server.fitness,
self.server.signing_priv_key_pem,
self.server.rss_icon_at_top,
self.server.icons_as_buttons,
self.server.default_timeline,
self.server.recent_posts_cache,
self.server.max_recent_posts,
self.server.translate,
self.server.project_version,
self.server.cached_webfingers,
self.server.person_cache,
self.server.yt_replace_domain,
self.server.twitter_replacement_domain,
self.server.show_published_date_only,
self.server.newswire,
self.server.theme_name,
self.server.dormant_months,
self.server.peertube_instances,
self.server.allow_local_network_access,
self.server.text_mode_banner,
self.server.system_language,
self.server.max_like_count,
self.server.shared_items_federated_domains,
self.server.cw_lists,
self.server.lists_enabled,
self.server.content_license_url,
self.server.buy_sites,
self.server.no_of_books,
self.server.auto_cw_cache):
self.server.getreq_busy = False self.server.getreq_busy = False
return return

View File

@ -43,7 +43,42 @@ def show_person_profile(self, authorized: bool,
getreq_start_time, getreq_start_time,
proxy_type: str, cookie: str, proxy_type: str, cookie: str,
debug: str, debug: str,
curr_session) -> bool: curr_session,
access_keys: {},
key_shortcuts: {}, city: str,
account_timezone: {},
bold_reading_nicknames: {},
max_shares_on_profile: int,
sites_unavailable: [],
fitness: {},
signing_priv_key_pem: str,
rss_icon_at_top: bool,
icons_as_buttons: bool,
default_timeline: str,
recent_posts_cache: {},
max_recent_posts: int,
translate: {},
project_version: str,
cached_webfingers: {},
person_cache: {},
yt_replace_domain: str,
twitter_replacement_domain: str,
show_published_date_only: bool,
newswire: str,
theme_name: str,
dormant_months: int,
peertube_instances: [],
allow_local_network_access: bool,
text_mode_banner: str,
system_language: str,
max_like_count: int,
shared_items_federated_domains: [],
cw_lists: [],
lists_enabled: {},
content_license_url: str,
buy_sites: [],
no_of_books: int,
auto_cw_cache: {}) -> bool:
"""Shows the profile for a person """Shows the profile for a person
""" """
# look up a person # look up a person
@ -60,73 +95,64 @@ def show_person_profile(self, authorized: bool,
http_404(self, 86) http_404(self, 86)
return True return True
access_keys = self.server.access_keys
city = None city = None
timezone = None timezone = None
if '/users/' in path: if '/users/' in path:
nickname = path.split('/users/')[1] nickname = path.split('/users/')[1]
if '/' in nickname: if '/' in nickname:
nickname = nickname.split('/')[0] nickname = nickname.split('/')[0]
if self.server.key_shortcuts.get(nickname): if key_shortcuts.get(nickname):
access_keys = \ access_keys = key_shortcuts[nickname]
self.server.key_shortcuts[nickname]
city = get_spoofed_city(self.server.city, city = get_spoofed_city(city, base_dir, nickname, domain)
base_dir, nickname, domain) if account_timezone.get(nickname):
if self.server.account_timezone.get(nickname): timezone = account_timezone.get(nickname)
timezone = \
self.server.account_timezone.get(nickname)
bold_reading = False bold_reading = False
if self.server.bold_reading.get(nickname): if bold_reading_nicknames.get(nickname):
bold_reading = True bold_reading = True
max_shares_on_profile = \
self.server.max_shares_on_profile
sites_unavailable = \
self.server.sites_unavailable
msg = \ msg = \
html_profile(self.server.signing_priv_key_pem, html_profile(signing_priv_key_pem,
self.server.rss_icon_at_top, rss_icon_at_top,
self.server.icons_as_buttons, icons_as_buttons,
self.server.default_timeline, default_timeline,
self.server.recent_posts_cache, recent_posts_cache,
self.server.max_recent_posts, max_recent_posts,
self.server.translate, translate,
self.server.project_version, project_version,
base_dir, http_prefix, authorized, base_dir, http_prefix, authorized,
actor_json, 'posts', curr_session, actor_json, 'posts', curr_session,
self.server.cached_webfingers, cached_webfingers,
self.server.person_cache, person_cache,
self.server.yt_replace_domain, yt_replace_domain,
self.server.twitter_replacement_domain, twitter_replacement_domain,
self.server.show_published_date_only, show_published_date_only,
self.server.newswire, newswire,
self.server.theme_name, theme_name,
self.server.dormant_months, dormant_months,
self.server.peertube_instances, peertube_instances,
self.server.allow_local_network_access, allow_local_network_access,
self.server.text_mode_banner, text_mode_banner,
debug, debug,
access_keys, city, access_keys, city,
self.server.system_language, system_language,
self.server.max_like_count, max_like_count,
self.server.shared_items_federated_domains, shared_items_federated_domains,
None, None, None, None, None, None,
self.server.cw_lists, cw_lists,
self.server.lists_enabled, lists_enabled,
self.server.content_license_url, content_license_url,
timezone, bold_reading, timezone, bold_reading,
self.server.buy_sites, buy_sites,
None, None,
max_shares_on_profile, max_shares_on_profile,
sites_unavailable, sites_unavailable,
self.server.no_of_books, no_of_books,
self.server.auto_cw_cache).encode('utf-8') auto_cw_cache).encode('utf-8')
msglen = len(msg) msglen = len(msg)
set_headers(self, 'text/html', msglen, set_headers(self, 'text/html', msglen,
cookie, calling_domain, False) cookie, calling_domain, False)
write2(self, msg) write2(self, msg)
fitness_performance(getreq_start_time, fitness_performance(getreq_start_time, fitness,
self.server.fitness,
'_GET', '_show_person_profile', '_GET', '_show_person_profile',
debug) debug)
if debug: if debug:
@ -154,8 +180,7 @@ def show_person_profile(self, authorized: bool,
set_headers(self, 'application/activity+json', msglen, set_headers(self, 'application/activity+json', msglen,
cookie, calling_domain, False) cookie, calling_domain, False)
write2(self, msg) write2(self, msg)
fitness_performance(getreq_start_time, fitness_performance(getreq_start_time, fitness,
self.server.fitness,
'_GET', '_show_person_profile json', '_GET', '_show_person_profile json',
debug) debug)
if debug: if debug: