mirror of https://gitlab.com/bashrc2/epicyon
Screen showing announcers of a post
parent
b644523d30
commit
742c69163a
78
daemon.py
78
daemon.py
|
@ -10486,6 +10486,68 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.debug)
|
self.server.debug)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def _show_announcers_of_post(self, authorized: bool,
|
||||||
|
calling_domain: str, path: str,
|
||||||
|
base_dir: str, http_prefix: str,
|
||||||
|
domain: str, domain_full: str, port: int,
|
||||||
|
onion_domain: str, i2p_domain: str,
|
||||||
|
getreq_start_time,
|
||||||
|
proxy_type: str, cookie: str,
|
||||||
|
debug: str) -> bool:
|
||||||
|
"""Show the announcers of a post
|
||||||
|
"""
|
||||||
|
if not authorized:
|
||||||
|
return False
|
||||||
|
if '?announcers=' not in path:
|
||||||
|
return False
|
||||||
|
if '/users/' not in path:
|
||||||
|
return False
|
||||||
|
nickname = path.split('/users/')[1]
|
||||||
|
if '?' in nickname:
|
||||||
|
nickname = nickname.split('?')[0]
|
||||||
|
post_url = path.split('?announcers=')[1]
|
||||||
|
if '?' in post_url:
|
||||||
|
post_url = post_url.split('?')[0]
|
||||||
|
post_url = post_url.replace('--', '/')
|
||||||
|
|
||||||
|
# note that the likers function is reused, but with 'shares'
|
||||||
|
msg = \
|
||||||
|
html_likers_of_post(base_dir, nickname, domain, port,
|
||||||
|
post_url, self.server.translate,
|
||||||
|
http_prefix,
|
||||||
|
self.server.theme_name,
|
||||||
|
self.server.access_keys,
|
||||||
|
self.server.recent_posts_cache,
|
||||||
|
self.server.max_recent_posts,
|
||||||
|
self.server.session,
|
||||||
|
self.server.cached_webfingers,
|
||||||
|
self.server.person_cache,
|
||||||
|
self.server.project_version,
|
||||||
|
self.server.yt_replace_domain,
|
||||||
|
self.server.twitter_replacement_domain,
|
||||||
|
self.server.show_published_date_only,
|
||||||
|
self.server.peertube_instances,
|
||||||
|
self.server.allow_local_network_access,
|
||||||
|
self.server.system_language,
|
||||||
|
self.server.max_like_count,
|
||||||
|
self.server.signing_priv_key_pem,
|
||||||
|
self.server.cw_lists,
|
||||||
|
self.server.lists_enabled,
|
||||||
|
'inbox', self.server.default_timeline,
|
||||||
|
'shares')
|
||||||
|
if not msg:
|
||||||
|
self._404()
|
||||||
|
return True
|
||||||
|
msg = msg.encode('utf-8')
|
||||||
|
msglen = len(msg)
|
||||||
|
self._set_headers('text/html', msglen,
|
||||||
|
cookie, calling_domain, False)
|
||||||
|
self._write(msg)
|
||||||
|
fitness_performance(getreq_start_time, self.server.fitness,
|
||||||
|
'_GET', '_show_announcers_of_post',
|
||||||
|
self.server.debug)
|
||||||
|
return True
|
||||||
|
|
||||||
def _show_post_from_file(self, post_filename: str, liked_by: str,
|
def _show_post_from_file(self, post_filename: str, liked_by: str,
|
||||||
react_by: str, react_emoji: str,
|
react_by: str, react_emoji: str,
|
||||||
authorized: bool,
|
authorized: bool,
|
||||||
|
@ -16568,6 +16630,22 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.getreq_busy = False
|
self.server.getreq_busy = False
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# show the announcers/repeaters of a post
|
||||||
|
if self._show_announcers_of_post(authorized,
|
||||||
|
calling_domain, self.path,
|
||||||
|
self.server.base_dir,
|
||||||
|
self.server.http_prefix,
|
||||||
|
self.server.domain,
|
||||||
|
self.server.domain_full,
|
||||||
|
self.server.port,
|
||||||
|
self.server.onion_domain,
|
||||||
|
self.server.i2p_domain,
|
||||||
|
getreq_start_time,
|
||||||
|
self.server.proxy_type,
|
||||||
|
cookie, self.server.debug):
|
||||||
|
self.server.getreq_busy = False
|
||||||
|
return
|
||||||
|
|
||||||
fitness_performance(getreq_start_time, self.server.fitness,
|
fitness_performance(getreq_start_time, self.server.fitness,
|
||||||
'_GET', 'individual post done',
|
'_GET', 'individual post done',
|
||||||
self.server.debug)
|
self.server.debug)
|
||||||
|
|
|
@ -513,5 +513,6 @@
|
||||||
"It is done": "تم",
|
"It is done": "تم",
|
||||||
"Time Zone": "وحدة زمنية",
|
"Time Zone": "وحدة زمنية",
|
||||||
"Show who liked this post": "أظهر من أحب هذا المنشور",
|
"Show who liked this post": "أظهر من أحب هذا المنشور",
|
||||||
"Show who repeated this post": "أظهر من كرر هذا المنصب"
|
"Show who repeated this post": "أظهر من كرر هذا المنصب",
|
||||||
|
"Repeated by": "يتكرر بواسطة"
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,5 +513,6 @@
|
||||||
"It is done": "Esta fet",
|
"It is done": "Esta fet",
|
||||||
"Time Zone": "Fus horari",
|
"Time Zone": "Fus horari",
|
||||||
"Show who liked this post": "Mostra a qui li agrada aquesta publicació",
|
"Show who liked this post": "Mostra a qui li agrada aquesta publicació",
|
||||||
"Show who repeated this post": "Mostra qui ha repetit aquesta publicació"
|
"Show who repeated this post": "Mostra qui ha repetit aquesta publicació",
|
||||||
|
"Repeated by": "Repetit per"
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,5 +513,6 @@
|
||||||
"It is done": "Mae'n cael ei wneud",
|
"It is done": "Mae'n cael ei wneud",
|
||||||
"Time Zone": "Parth Amser",
|
"Time Zone": "Parth Amser",
|
||||||
"Show who liked this post": "Dangoswch pwy oedd yn hoffi'r post hwn",
|
"Show who liked this post": "Dangoswch pwy oedd yn hoffi'r post hwn",
|
||||||
"Show who repeated this post": "Dangoswch pwy ailadroddodd y post hwn"
|
"Show who repeated this post": "Dangoswch pwy ailadroddodd y post hwn",
|
||||||
|
"Repeated by": "Ailadrodd gan"
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,5 +513,6 @@
|
||||||
"It is done": "Es ist vollbracht",
|
"It is done": "Es ist vollbracht",
|
||||||
"Time Zone": "Zeitzone",
|
"Time Zone": "Zeitzone",
|
||||||
"Show who liked this post": "Zeigen, wem dieser Beitrag gefallen hat",
|
"Show who liked this post": "Zeigen, wem dieser Beitrag gefallen hat",
|
||||||
"Show who repeated this post": "Zeigen Sie, wer diesen Beitrag wiederholt hat"
|
"Show who repeated this post": "Zeigen Sie, wer diesen Beitrag wiederholt hat",
|
||||||
|
"Repeated by": "Wiederholt von"
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,5 +513,6 @@
|
||||||
"It is done": "It is done",
|
"It is done": "It is done",
|
||||||
"Time Zone": "Time Zone",
|
"Time Zone": "Time Zone",
|
||||||
"Show who liked this post": "Show who liked this post",
|
"Show who liked this post": "Show who liked this post",
|
||||||
"Show who repeated this post": "Show who repeated this post"
|
"Show who repeated this post": "Show who repeated this post",
|
||||||
|
"Repeated by": "Repeated by"
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,5 +513,6 @@
|
||||||
"It is done": "Se hace",
|
"It is done": "Se hace",
|
||||||
"Time Zone": "Zona horaria",
|
"Time Zone": "Zona horaria",
|
||||||
"Show who liked this post": "Mostrar a quién le gustó esta publicación",
|
"Show who liked this post": "Mostrar a quién le gustó esta publicación",
|
||||||
"Show who repeated this post": "Mostrar quién repitió esta publicación"
|
"Show who repeated this post": "Mostrar quién repitió esta publicación",
|
||||||
|
"Repeated by": "Repetido por"
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,5 +513,6 @@
|
||||||
"It is done": "C'est fait",
|
"It is done": "C'est fait",
|
||||||
"Time Zone": "Fuseau horaire",
|
"Time Zone": "Fuseau horaire",
|
||||||
"Show who liked this post": "Montrer qui a aimé ce post",
|
"Show who liked this post": "Montrer qui a aimé ce post",
|
||||||
"Show who repeated this post": "Montrer qui a répété ce post"
|
"Show who repeated this post": "Montrer qui a répété ce post",
|
||||||
|
"Repeated by": "Répété par"
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,5 +513,6 @@
|
||||||
"It is done": "Déantar é",
|
"It is done": "Déantar é",
|
||||||
"Time Zone": "Crios Ama",
|
"Time Zone": "Crios Ama",
|
||||||
"Show who liked this post": "Taispeáin cé a thaitin an postáil seo",
|
"Show who liked this post": "Taispeáin cé a thaitin an postáil seo",
|
||||||
"Show who repeated this post": "Taispeáin cé a rinne an postáil seo arís"
|
"Show who repeated this post": "Taispeáin cé a rinne an postáil seo arís",
|
||||||
|
"Repeated by": "Arís agus arís eile ag"
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,5 +513,6 @@
|
||||||
"It is done": "हो गया है",
|
"It is done": "हो गया है",
|
||||||
"Time Zone": "समय क्षेत्र",
|
"Time Zone": "समय क्षेत्र",
|
||||||
"Show who liked this post": "दिखाएँ कि इस पोस्ट को किसने पसंद किया",
|
"Show who liked this post": "दिखाएँ कि इस पोस्ट को किसने पसंद किया",
|
||||||
"Show who repeated this post": "दिखाएं कि इस पोस्ट को किसने दोहराया"
|
"Show who repeated this post": "दिखाएं कि इस पोस्ट को किसने दोहराया",
|
||||||
|
"Repeated by": "द्वारा दोहराया गया"
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,5 +513,6 @@
|
||||||
"It is done": "È fatta",
|
"It is done": "È fatta",
|
||||||
"Time Zone": "Fuso orario",
|
"Time Zone": "Fuso orario",
|
||||||
"Show who liked this post": "Mostra a chi è piaciuto questo post",
|
"Show who liked this post": "Mostra a chi è piaciuto questo post",
|
||||||
"Show who repeated this post": "Mostra chi ha ripetuto questo post"
|
"Show who repeated this post": "Mostra chi ha ripetuto questo post",
|
||||||
|
"Repeated by": "Ripetuto da"
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,5 +513,6 @@
|
||||||
"It is done": "されております",
|
"It is done": "されております",
|
||||||
"Time Zone": "タイムゾーン",
|
"Time Zone": "タイムゾーン",
|
||||||
"Show who liked this post": "この投稿を高く評価した人を表示する",
|
"Show who liked this post": "この投稿を高く評価した人を表示する",
|
||||||
"Show who repeated this post": "この投稿を繰り返した人を表示する"
|
"Show who repeated this post": "この投稿を繰り返した人を表示する",
|
||||||
|
"Repeated by": "によって繰り返される"
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,5 +513,6 @@
|
||||||
"It is done": "Tê kirin",
|
"It is done": "Tê kirin",
|
||||||
"Time Zone": "Qada demê",
|
"Time Zone": "Qada demê",
|
||||||
"Show who liked this post": "Nîşan bide kê ev post eciband",
|
"Show who liked this post": "Nîşan bide kê ev post eciband",
|
||||||
"Show who repeated this post": "Nîşan bide kê ev post dubare kiriye"
|
"Show who repeated this post": "Nîşan bide kê ev post dubare kiriye",
|
||||||
|
"Repeated by": "Ji hêla dubare kirin"
|
||||||
}
|
}
|
||||||
|
|
|
@ -509,5 +509,6 @@
|
||||||
"It is done": "It is done",
|
"It is done": "It is done",
|
||||||
"Time Zone": "Time Zone",
|
"Time Zone": "Time Zone",
|
||||||
"Show who liked this post": "Show who liked this post",
|
"Show who liked this post": "Show who liked this post",
|
||||||
"Show who repeated this post": "Show who repeated this post"
|
"Show who repeated this post": "Show who repeated this post",
|
||||||
|
"Repeated by": "Repeated by"
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,5 +513,6 @@
|
||||||
"It is done": "Está feito",
|
"It is done": "Está feito",
|
||||||
"Time Zone": "Fuso horário",
|
"Time Zone": "Fuso horário",
|
||||||
"Show who liked this post": "Mostrar quem gostou deste post",
|
"Show who liked this post": "Mostrar quem gostou deste post",
|
||||||
"Show who repeated this post": "Mostrar quem repetiu esta postagem"
|
"Show who repeated this post": "Mostrar quem repetiu esta postagem",
|
||||||
|
"Repeated by": "Repetido por"
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,5 +513,6 @@
|
||||||
"It is done": "Сделано",
|
"It is done": "Сделано",
|
||||||
"Time Zone": "Часовой пояс",
|
"Time Zone": "Часовой пояс",
|
||||||
"Show who liked this post": "Показать, кому понравился этот пост",
|
"Show who liked this post": "Показать, кому понравился этот пост",
|
||||||
"Show who repeated this post": "Показать, кто повторил этот пост"
|
"Show who repeated this post": "Показать, кто повторил этот пост",
|
||||||
|
"Repeated by": "Повторено"
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,5 +513,6 @@
|
||||||
"It is done": "Imefanyika",
|
"It is done": "Imefanyika",
|
||||||
"Time Zone": "Eneo la Saa",
|
"Time Zone": "Eneo la Saa",
|
||||||
"Show who liked this post": "Onyesha ni nani aliyependa chapisho hili",
|
"Show who liked this post": "Onyesha ni nani aliyependa chapisho hili",
|
||||||
"Show who repeated this post": "Onyesha ni nani aliyerudia chapisho hili"
|
"Show who repeated this post": "Onyesha ni nani aliyerudia chapisho hili",
|
||||||
|
"Repeated by": "Imerudiwa na"
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,5 +513,6 @@
|
||||||
"It is done": "完成了",
|
"It is done": "完成了",
|
||||||
"Time Zone": "时区",
|
"Time Zone": "时区",
|
||||||
"Show who liked this post": "显示谁喜欢这篇文章",
|
"Show who liked this post": "显示谁喜欢这篇文章",
|
||||||
"Show who repeated this post": "显示谁重复了这篇文章"
|
"Show who repeated this post": "显示谁重复了这篇文章",
|
||||||
|
"Repeated by": "重复"
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,8 @@ def html_likers_of_post(base_dir: str, nickname: str,
|
||||||
system_language: str,
|
system_language: str,
|
||||||
max_like_count: int, signing_priv_key_pem: str,
|
max_like_count: int, signing_priv_key_pem: str,
|
||||||
cw_lists: {}, lists_enabled: str,
|
cw_lists: {}, lists_enabled: str,
|
||||||
boxName: str, default_timeline: str) -> str:
|
boxName: str, default_timeline: str,
|
||||||
|
dict_name: str = 'likes') -> str:
|
||||||
"""Returns html for a screen showing who liked a post
|
"""Returns html for a screen showing who liked a post
|
||||||
"""
|
"""
|
||||||
css_filename = base_dir + '/epicyon-profile.css'
|
css_filename = base_dir + '/epicyon-profile.css'
|
||||||
|
@ -107,17 +108,22 @@ def html_likers_of_post(base_dir: str, nickname: str,
|
||||||
obj = post_json_object
|
obj = post_json_object
|
||||||
if has_object_dict(post_json_object):
|
if has_object_dict(post_json_object):
|
||||||
obj = post_json_object['object']
|
obj = post_json_object['object']
|
||||||
if not obj.get('likes'):
|
if not obj.get(dict_name):
|
||||||
return None
|
return None
|
||||||
if not isinstance(obj['likes'], dict):
|
if not isinstance(obj[dict_name], dict):
|
||||||
return None
|
return None
|
||||||
if not obj['likes'].get('items'):
|
if not obj[dict_name].get('items'):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
html_str += '<center><h2>' + translate['Liked by'] + '</h2></center>\n'
|
if dict_name == 'likes':
|
||||||
|
html_str += \
|
||||||
|
'<center><h2>' + translate['Liked by'] + '</h2></center>\n'
|
||||||
|
else:
|
||||||
|
html_str += \
|
||||||
|
'<center><h2>' + translate['Repeated by'] + '</h2></center>\n'
|
||||||
|
|
||||||
likers_list = ''
|
likers_list = ''
|
||||||
for like_item in obj['likes']['items']:
|
for like_item in obj[dict_name]['items']:
|
||||||
if not like_item.get('actor'):
|
if not like_item.get('actor'):
|
||||||
continue
|
continue
|
||||||
liker_actor = like_item['actor']
|
liker_actor = like_item['actor']
|
||||||
|
|
Loading…
Reference in New Issue