Show lxmf address on profile after search

main
bashrc 2026-03-04 12:58:54 +00:00
parent 38c5535d51
commit 36da2e4e15
2 changed files with 10 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import pyqrcode
from utils import get_attachment_property_value from utils import get_attachment_property_value
from utils import acct_dir from utils import acct_dir
from utils import load_json from utils import load_json
from utils import string_contains
VALID_LXMF_CHARS = set('0123456789abcdefghijklmnopqrstuvwxyz') VALID_LXMF_CHARS = set('0123456789abcdefghijklmnopqrstuvwxyz')
@ -75,7 +76,9 @@ def get_lxmf_address(actor_json: {}) -> str:
name_value = property_value['schema:name'] name_value = property_value['schema:name']
if not name_value: if not name_value:
continue continue
if not name_value.lower().startswith('lxmf'): name_value_lower = name_value.lower()
if not string_contains(name_value_lower,
('lxmf', 'reticulum', 'nomadnet')):
continue continue
if not property_value.get('type'): if not property_value.get('type'):
continue continue

View File

@ -384,6 +384,7 @@ def html_profile_after_search(authorized: bool,
pixelfed = get_pixelfed(profile_json) pixelfed = get_pixelfed(profile_json)
donate_url = get_donation_url(profile_json) donate_url = get_donation_url(profile_json)
blog_url = get_blog_address(profile_json) blog_url = get_blog_address(profile_json)
lxmf_address = get_lxmf_address(profile_json)
moved_to = '' moved_to = ''
if profile_json.get('movedTo') or profile_json.get('copiedTo'): if profile_json.get('movedTo') or profile_json.get('copiedTo'):
@ -523,6 +524,7 @@ def html_profile_after_search(authorized: bool,
joined_date, actor_proxied, joined_date, actor_proxied,
attached_shared_items, attached_shared_items,
website_url, blog_url, website_url, blog_url,
lxmf_address,
repo_url, send_blocks_str, repo_url, send_blocks_str,
authorized, authorized,
person_url, no_of_books, person_url, no_of_books,
@ -930,6 +932,7 @@ def _get_profile_header_after_search(base_dir: str,
attached_shared_items: str, attached_shared_items: str,
website_url: str, website_url: str,
blog_url: str, blog_url: str,
lxmf_address: str,
repo_url: str, repo_url: str,
send_blocks_str: str, send_blocks_str: str,
authorized: bool, authorized: bool,
@ -1061,6 +1064,9 @@ def _get_profile_header_after_search(base_dir: str,
blog_str = translate['Blog'] blog_str = translate['Blog']
html_str += ' <p>' + blog_str + ': <a href="' + blog_url + '">' + \ html_str += ' <p>' + blog_str + ': <a href="' + blog_url + '">' + \
blog_url + '</a></p>\n' blog_url + '</a></p>\n'
if lxmf_address:
html_str += \
' <p>LXMF: ' + lxmf_address + '</p>\n'
if youtube: if youtube:
html_str += ' <p>YouTube: <a href="' + youtube + '">' + \ html_str += ' <p>YouTube: <a href="' + youtube + '">' + \
youtube + '</a></p>\n' youtube + '</a></p>\n'