mirror of https://gitlab.com/bashrc2/epicyon
actor status can be an activity
parent
9a41b51fd2
commit
783c598c26
|
|
@ -26,6 +26,7 @@ from blocking import is_blocked_nickname
|
||||||
from blocking import is_blocked_domain
|
from blocking import is_blocked_domain
|
||||||
from content import valid_url_lengths
|
from content import valid_url_lengths
|
||||||
from posts import add_to_field
|
from posts import add_to_field
|
||||||
|
from utils import get_actor_status
|
||||||
from utils import detect_mitm
|
from utils import detect_mitm
|
||||||
from utils import data_dir
|
from utils import data_dir
|
||||||
from utils import load_json
|
from utils import load_json
|
||||||
|
|
@ -702,11 +703,7 @@ def show_person_options(self, calling_domain: str, path: str,
|
||||||
if actor_json.get('alsoKnownAs'):
|
if actor_json.get('alsoKnownAs'):
|
||||||
also_known_as = remove_html(actor_json['alsoKnownAs'])
|
also_known_as = remove_html(actor_json['alsoKnownAs'])
|
||||||
repo_url = get_repo_url(actor_json)
|
repo_url = get_repo_url(actor_json)
|
||||||
# https://codeberg.org/fediverse/fep/src/branch/main/
|
status = get_actor_status(actor_json)
|
||||||
# fep/82f6/fep-82f6.md
|
|
||||||
if actor_json.get('sm:status'):
|
|
||||||
if isinstance(actor_json['sm:status'], str):
|
|
||||||
status = actor_json['sm:status']
|
|
||||||
|
|
||||||
access_keys = self.server.access_keys
|
access_keys = self.server.access_keys
|
||||||
nickname = 'instance'
|
nickname = 'instance'
|
||||||
|
|
|
||||||
15
utils.py
15
utils.py
|
|
@ -5548,3 +5548,18 @@ def get_event_categories() -> []:
|
||||||
'THEATRE',
|
'THEATRE',
|
||||||
'WORKSHOPS_SKILL_SHARING'
|
'WORKSHOPS_SKILL_SHARING'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def get_actor_status(profile_json: {}) -> str:
|
||||||
|
"""returns the actor status if it exists
|
||||||
|
https://codeberg.org/fediverse/fep/src/branch/main/fep/82f6/fep-82f6.md
|
||||||
|
"""
|
||||||
|
if not profile_json.get('sm:status'):
|
||||||
|
return ''
|
||||||
|
if isinstance(profile_json['sm:status'], str):
|
||||||
|
return profile_json['sm:status']
|
||||||
|
if isinstance(profile_json['sm:status'], dict):
|
||||||
|
if profile_json['sm:status'].get('content'):
|
||||||
|
if isinstance(profile_json['sm:status']['content'], str):
|
||||||
|
return profile_json['sm:status']['content']
|
||||||
|
return ''
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ from flags import is_system_account
|
||||||
from flags import is_group_account
|
from flags import is_group_account
|
||||||
from flags import is_valid_date
|
from flags import is_valid_date
|
||||||
from flags import is_premium_account
|
from flags import is_premium_account
|
||||||
|
from utils import get_actor_status
|
||||||
from utils import get_person_icon
|
from utils import get_person_icon
|
||||||
from utils import text_mode_removals
|
from utils import text_mode_removals
|
||||||
from utils import replace_strings
|
from utils import replace_strings
|
||||||
|
|
@ -361,18 +362,17 @@ def html_profile_after_search(authorized: bool,
|
||||||
search_nickname,
|
search_nickname,
|
||||||
search_domain_full)
|
search_domain_full)
|
||||||
|
|
||||||
profile_status = ''
|
profile_status = get_actor_status(profile_json)
|
||||||
if profile_json.get('sm:status'):
|
if profile_status:
|
||||||
if isinstance(profile_json['sm:status'], str):
|
profile_status = remove_html(profile_status)
|
||||||
profile_status = remove_html(profile_json['sm:status'])
|
if len(profile_status) < 100:
|
||||||
if len(profile_status) < 100:
|
profile_status = standardize_text(profile_status)
|
||||||
profile_status = standardize_text(profile_status)
|
profile_status = \
|
||||||
profile_status = \
|
remove_link_trackers_from_content(profile_status)
|
||||||
remove_link_trackers_from_content(profile_status)
|
profile_status = \
|
||||||
profile_status = \
|
add_emoji_to_display_name(session, base_dir, http_prefix,
|
||||||
add_emoji_to_display_name(session, base_dir, http_prefix,
|
nickname, domain,
|
||||||
nickname, domain,
|
profile_status, False, translate)
|
||||||
profile_status, False, translate)
|
|
||||||
profile_description = ''
|
profile_description = ''
|
||||||
if profile_json.get('summary'):
|
if profile_json.get('summary'):
|
||||||
if not dangerous_markup(profile_json['summary'],
|
if not dangerous_markup(profile_json['summary'],
|
||||||
|
|
@ -1114,18 +1114,17 @@ 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 = ''
|
profile_status = get_actor_status(profile_json)
|
||||||
if profile_json.get('sm:status'):
|
if profile_status:
|
||||||
if isinstance(profile_json['sm:status'], str):
|
profile_status = remove_html(profile_status)
|
||||||
profile_status = remove_html(profile_json['sm:status'])
|
if len(profile_status) < 100:
|
||||||
if len(profile_status) < 100:
|
profile_status = standardize_text(profile_status)
|
||||||
profile_status = standardize_text(profile_status)
|
profile_status = \
|
||||||
profile_status = \
|
remove_link_trackers_from_content(profile_status)
|
||||||
remove_link_trackers_from_content(profile_status)
|
profile_status = \
|
||||||
profile_status = \
|
add_emoji_to_display_name(session, base_dir, http_prefix,
|
||||||
add_emoji_to_display_name(session, base_dir, http_prefix,
|
nickname, domain,
|
||||||
nickname, domain,
|
profile_status, False, translate)
|
||||||
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:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue