main
Bob Mottram 2024-04-11 14:01:18 +01:00
parent 1d4b356dce
commit 9e2be9a1e8
2 changed files with 108 additions and 64 deletions

View File

@ -3892,7 +3892,46 @@ 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.default_timeline,
self.server.recent_posts_cache,
self.server.cached_webfingers,
self.server.yt_replace_domain,
self.server.twitter_replacement_domain,
self.server.show_published_date_only,
self.server.icons_as_buttons,
self.server.allow_local_network_access,
self.server.access_keys,
self.server.key_shortcuts,
self.server.shared_items_federated_domains,
self.server.signing_priv_key_pem,
self.server.content_license_url,
self.server.peertube_instances,
self.server.city,
self.server.account_timezone,
self.server.bold_reading,
self.server.max_shares_on_profile,
self.server.rss_icon_at_top,
self.server.max_recent_posts,
self.server.translate,
self.server.project_version,
self.server.person_cache,
self.server.newswire,
self.server.theme_name,
self.server.dormant_months,
self.server.text_mode_banner,
self.server.system_language,
self.server.max_like_count,
self.server.cw_lists,
self.server.lists_enabled,
self.server.buy_sites,
self.server.sites_unavailable,
self.server.no_of_books,
self.server.auto_cw_cache,
self.server.fitness,
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain):
self.server.getreq_busy = False self.server.getreq_busy = False
return return

View File

@ -339,7 +339,45 @@ def show_roles(self, calling_domain: str, referer_domain: str,
def show_skills(self, calling_domain: str, referer_domain: str, def show_skills(self, calling_domain: str, referer_domain: str,
path: str, base_dir: str, http_prefix: str, path: str, base_dir: str, http_prefix: str,
domain: str, getreq_start_time, proxy_type: str, domain: str, getreq_start_time, proxy_type: str,
cookie: str, debug: str, curr_session) -> bool: cookie: str, debug: str, curr_session,
default_timeline: str,
recent_posts_cache: {},
cached_webfingers: {},
yt_replace_domain: str,
twitter_replacement_domain: str,
show_published_date_only: bool,
icons_as_buttons: bool,
allow_local_network_access: bool,
access_keys: {},
key_shortcuts: {},
shared_items_federated_domains: [],
signing_priv_key_pem: str,
content_license_url: str,
peertube_instances: [], city: str,
account_timezone: {},
bold_reading_nicknames: [],
max_shares_on_profile: int,
rss_icon_at_top: bool,
max_recent_posts: int,
translate: {},
project_version: str,
person_cache: {},
newswire: str,
theme_name: str,
dormant_months: int,
text_mode_banner: str,
system_language: str,
max_like_count: int,
cw_lists: {},
lists_enabled: {},
buy_sites: [],
sites_unavailable: [],
no_of_books: int,
auto_cw_cache: {},
fitness: {},
domain_full: str,
onion_domain: str,
i2p_domain: str) -> 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]
@ -357,99 +395,70 @@ def show_skills(self, calling_domain: str, referer_domain: str,
path.replace('/skills', ''), path.replace('/skills', ''),
base_dir) base_dir)
if get_person: if get_person:
default_timeline = \ if key_shortcuts.get(nickname):
self.server.default_timeline access_keys = key_shortcuts[nickname]
recent_posts_cache = \
self.server.recent_posts_cache
cached_webfingers = \
self.server.cached_webfingers
yt_replace_domain = \
self.server.yt_replace_domain
twitter_replacement_domain = \
self.server.twitter_replacement_domain
show_published_date_only = \
self.server.show_published_date_only
icons_as_buttons = \
self.server.icons_as_buttons
allow_local_network_access = \
self.server.allow_local_network_access
access_keys = self.server.access_keys
if self.server.key_shortcuts.get(nickname):
access_keys = \
self.server.key_shortcuts[nickname]
actor_skills_list = \ actor_skills_list = \
get_occupation_skills(actor_json) get_occupation_skills(actor_json)
skills = \ skills = \
get_skills_from_list(actor_skills_list) get_skills_from_list(actor_skills_list)
city = get_spoofed_city(self.server.city, city = get_spoofed_city(city, base_dir,
base_dir,
nickname, domain) nickname, domain)
shared_items_fed_domains = \ shared_items_fed_domains = \
self.server.shared_items_federated_domains shared_items_federated_domains
signing_priv_key_pem = \
self.server.signing_priv_key_pem
content_license_url = \
self.server.content_license_url
peertube_instances = \
self.server.peertube_instances
timezone = None timezone = None
nick = nickname nick = nickname
if self.server.account_timezone.get(nick): if account_timezone.get(nick):
timezone = \ timezone = account_timezone.get(nick)
self.server.account_timezone.get(nick)
bold_reading = False bold_reading = False
if self.server.bold_reading.get(nick): if bold_reading_nicknames.get(nick):
bold_reading = True bold_reading = True
max_shares_on_profile = \
self.server.max_shares_on_profile
msg = \ msg = \
html_profile(signing_priv_key_pem, html_profile(signing_priv_key_pem,
self.server.rss_icon_at_top, rss_icon_at_top,
icons_as_buttons, icons_as_buttons,
default_timeline, default_timeline,
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, True, base_dir, http_prefix, True,
get_person, 'skills', get_person, 'skills',
curr_session, curr_session,
cached_webfingers, cached_webfingers,
self.server.person_cache, person_cache,
yt_replace_domain, yt_replace_domain,
twitter_replacement_domain, twitter_replacement_domain,
show_published_date_only, show_published_date_only,
self.server.newswire, newswire,
self.server.theme_name, theme_name,
self.server.dormant_months, dormant_months,
peertube_instances, peertube_instances,
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,
shared_items_fed_domains, shared_items_fed_domains,
skills, skills,
None, None, None, None,
self.server.cw_lists, cw_lists,
self.server.lists_enabled, lists_enabled,
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,
self.server.sites_unavailable, sites_unavailable,
self.server.no_of_books, no_of_books,
self.server.auto_cw_cache) auto_cw_cache)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
set_headers(self, 'text/html', msglen, set_headers(self, 'text/html', msglen,
cookie, calling_domain, cookie, calling_domain,
False) False)
write2(self, msg) write2(self, msg)
fitness_performance(getreq_start_time, fitness_performance(getreq_start_time, fitness,
self.server.fitness,
'_GET', '_show_skills', '_GET', '_show_skills',
debug) debug)
else: else:
@ -457,7 +466,7 @@ def show_skills(self, calling_domain: str, referer_domain: str,
proxy_type, False, proxy_type, False,
self.server, self.server,
self.headers, self.headers,
self.path): path):
actor_skills_list = \ actor_skills_list = \
get_occupation_skills(actor_json) get_occupation_skills(actor_json)
skills = \ skills = \
@ -481,8 +490,7 @@ def show_skills(self, calling_domain: str, referer_domain: str,
set_headers(self, protocol_str, msglen, None, set_headers(self, protocol_str, msglen, None,
calling_domain, False) calling_domain, False)
write2(self, msg) write2(self, msg)
fitness_performance(getreq_start_time, fitness_performance(getreq_start_time, fitness,
self.server.fitness,
'_GET', '_GET',
'_show_skills json', '_show_skills json',
debug) debug)
@ -491,11 +499,8 @@ def show_skills(self, calling_domain: str, referer_domain: str,
return True return True
actor = path.replace('/skills', '') actor = path.replace('/skills', '')
actor_absolute = \ actor_absolute = \
get_instance_url(calling_domain, get_instance_url(calling_domain, http_prefix, domain_full,
http_prefix, onion_domain, i2p_domain) + \
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain) + \
actor actor
redirect_headers(self, actor_absolute, cookie, calling_domain) redirect_headers(self, actor_absolute, cookie, calling_domain)
return True return True