__filename__ = "webapp_likers.py"
__author__ = "Bob Mottram"
__license__ = "AGPL3+"
__version__ = "1.3.0"
__maintainer__ = "Bob Mottram"
__email__ = "bob@libreserver.org"
__status__ = "Production"
__module_group__ = "ActivityPub"
import os
from utils import locate_post
from utils import get_config_param
from utils import get_account_timezone
from utils import get_display_name
from utils import get_nickname_from_actor
from utils import has_object_dict
from utils import load_json
from person import get_person_avatar_url
from webapp_utils import html_header_with_external_style
from webapp_utils import html_footer
from webapp_utils import get_banner_file
from webapp_utils import add_emoji_to_display_name
from webapp_post import individual_post_as_html
def html_likers_of_post(base_dir: str, nickname: str,
domain: str, port: int,
post_url: str, translate: {},
http_prefix: str,
theme: str, access_keys: {},
recent_posts_cache: {}, max_recent_posts: int,
session, cached_webfingers: {},
person_cache: {},
project_version: str,
yt_replace_domain: str,
twitter_replacement_domain: str,
show_published_date_only: bool,
peertube_instances: [],
allow_local_network_access: bool,
system_language: str,
max_like_count: int, signing_priv_key_pem: str,
cw_lists: {}, lists_enabled: str,
boxName: str, default_timeline: str,
dict_name: str = 'likes') -> str:
"""Returns html for a screen showing who liked a post
"""
css_filename = base_dir + '/epicyon-profile.css'
if os.path.isfile(base_dir + '/epicyon.css'):
css_filename = base_dir + '/epicyon.css'
instance_title = get_config_param(base_dir, 'instanceTitle')
html_str = \
html_header_with_external_style(css_filename, instance_title, None)
# get the post which was liked
filename = locate_post(base_dir, nickname, domain, post_url)
if not filename:
return None
post_json_object = load_json(filename)
if not post_json_object:
return None
if not post_json_object.get('actor') or not post_json_object.get('object'):
return None
# show the top banner
banner_file, _ = \
get_banner_file(base_dir, nickname, domain, theme)
html_str += \
'