Show status on profile, if available

main
Bob Mottram 2025-05-15 18:05:24 +01:00
parent 80f9c72d2f
commit b98a965d19
1 changed files with 21 additions and 2 deletions

View File

@ -666,6 +666,7 @@ def _get_profile_header(base_dir: str, http_prefix: str, nickname: str,
domain: str, domain_full: str, translate: {}, domain: str, domain_full: str, translate: {},
default_timeline: str, default_timeline: str,
display_name: str, pronouns: str, display_name: str, pronouns: str,
profile_status: str,
profile_description_short: str, profile_description_short: str,
featured_hashtags: str, featured_hashtags: str,
login_button: str, avatar_url: str, login_button: str, avatar_url: str,
@ -803,7 +804,12 @@ def _get_profile_header(base_dir: str, http_prefix: str, nickname: str,
'/qrcode.png" alt="' + translate['QR Code'] + '" title="' + \ '/qrcode.png" alt="' + translate['QR Code'] + '" title="' + \
translate['QR Code'] + '" tabindex="1">' + \ translate['QR Code'] + '" tabindex="1">' + \
'<img class="qrcode" alt="' + translate['QR Code'] + \ '<img class="qrcode" alt="' + translate['QR Code'] + \
'" src="/icons/qrcode.png" /></a></p>\n' + \ '" src="/icons/qrcode.png" /></a></p>\n'
if profile_status:
# https://codeberg.org/fediverse/fep/src/branch/main/
# fep/82f6/fep-82f6.md
html_str += ' <p>' + profile_status + '</p>\n'
html_str += \
' <p>' + profile_description_short + '</p>\n' + \ ' <p>' + profile_description_short + '</p>\n' + \
featured_hashtags + login_button featured_hashtags + login_button
if pinned_content: if pinned_content:
@ -1108,6 +1114,18 @@ def html_profile(signing_priv_key_pem: str,
nickname, domain, nickname, domain,
display_name, False, translate) display_name, False, translate)
domain_full = get_full_domain(domain, port) domain_full = get_full_domain(domain, port)
profile_status = ''
if profile_json.get('sm:status'):
if isinstance(profile_json['sm:status'], str):
profile_status = remove_html(profile_json['sm:status'])
if len(profile_status) < 100:
profile_status = standardize_text(profile_status)
profile_status = \
remove_link_trackers_from_content(profile_status)
profile_status = \
add_emoji_to_display_name(session, base_dir, http_prefix,
nickname, domain,
profile_status, False, translate)
if not dangerous_markup(profile_json['summary'], False, []): if not dangerous_markup(profile_json['summary'], False, []):
profile_description = profile_json['summary'] profile_description = profile_json['summary']
else: else:
@ -1488,7 +1506,8 @@ def html_profile(signing_priv_key_pem: str,
nickname, nickname,
domain, domain_full, translate, domain, domain_full, translate,
default_timeline, display_name, default_timeline, display_name,
pronouns, profile_description_short, pronouns, profile_status,
profile_description_short,
featured_hashtags, featured_hashtags,
login_button, avatar_url, theme, login_button, avatar_url, theme,
moved_to, also_known_as, moved_to, also_known_as,