More general

main
Bob Mottram 2023-05-12 15:39:26 +01:00
parent e39fa0132a
commit dc73a666f3
2 changed files with 7 additions and 7 deletions

View File

@ -4347,15 +4347,15 @@ def harmless_markup(post_json_object: {}) -> None:
content
def actor_proxy_type(actor: {}) -> str:
"""Returns a string indicating the proxy for an actor
def ap_proxy_type(json_object: {}) -> str:
"""Returns a string indicating the proxy for an activitypub post
or None if not proxied
"""
if not actor.get('proxyOf'):
if not json_object.get('proxyOf'):
return None
if not isinstance(actor['proxyOf'], list):
if not isinstance(json_object['proxyOf'], list):
return None
for proxy_dict in actor['proxyOf']:
for proxy_dict in json_object['proxyOf']:
if proxy_dict.get('protocol'):
if isinstance(proxy_dict['protocol'], str):
return proxy_dict['protocol']

View File

@ -10,7 +10,7 @@ __module_group__ = "Web Interface"
import os
from pprint import pprint
from webfinger import webfinger_handle
from utils import actor_proxy_type
from utils import ap_proxy_type
from utils import remove_id_ending
from utils import standardize_text
from utils import get_display_name
@ -328,7 +328,7 @@ def html_profile_after_search(recent_posts_cache: {}, max_recent_posts: int,
if 'T' in profile_json['published']:
joined_date = profile_json['published']
actor_proxied = actor_proxy_type(profile_json)
actor_proxied = ap_proxy_type(profile_json)
profile_str = \
_get_profile_header_after_search(nickname, default_timeline,