Add chat links when creating post html

merge-requests/30/head
Bob Mottram 2023-07-10 11:49:13 +01:00
parent a6aa49b540
commit 63dc7e54e3
27 changed files with 78 additions and 27 deletions

View File

@ -626,5 +626,6 @@
"Proxy": "الوكيل", "Proxy": "الوكيل",
"Only allow replies from followers": "السماح فقط بالردود من المتابعين", "Only allow replies from followers": "السماح فقط بالردود من المتابعين",
"Only allow replies from mutuals": "السماح فقط بالردود من المتبادلين", "Only allow replies from mutuals": "السماح فقط بالردود من المتبادلين",
"Reason": "سبب" "Reason": "سبب",
"Chat": "محادثة"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "প্রক্সি", "Proxy": "প্রক্সি",
"Only allow replies from followers": "শুধুমাত্র অনুসরণকারীদের কাছ থেকে উত্তরের অনুমতি দিন", "Only allow replies from followers": "শুধুমাত্র অনুসরণকারীদের কাছ থেকে উত্তরের অনুমতি দিন",
"Only allow replies from mutuals": "শুধুমাত্র মিউচুয়াল থেকে উত্তরের অনুমতি দিন", "Only allow replies from mutuals": "শুধুমাত্র মিউচুয়াল থেকে উত্তরের অনুমতি দিন",
"Reason": "কারণ" "Reason": "কারণ",
"Chat": "চ্যাট"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "Proxy", "Proxy": "Proxy",
"Only allow replies from followers": "Només permet respostes dels seguidors", "Only allow replies from followers": "Només permet respostes dels seguidors",
"Only allow replies from mutuals": "Només permet respostes de mútues", "Only allow replies from mutuals": "Només permet respostes de mútues",
"Reason": "Raó" "Reason": "Raó",
"Chat": "Xatejar"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "Dirprwy", "Proxy": "Dirprwy",
"Only allow replies from followers": "Caniatewch atebion gan ddilynwyr yn unig", "Only allow replies from followers": "Caniatewch atebion gan ddilynwyr yn unig",
"Only allow replies from mutuals": "Caniatewch atebion gan gwmnïau cydfuddiannol yn unig", "Only allow replies from mutuals": "Caniatewch atebion gan gwmnïau cydfuddiannol yn unig",
"Reason": "Rheswm" "Reason": "Rheswm",
"Chat": "Sgwrsio"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "Stellvertreterin", "Proxy": "Stellvertreterin",
"Only allow replies from followers": "Erlauben Sie nur Antworten von Followern", "Only allow replies from followers": "Erlauben Sie nur Antworten von Followern",
"Only allow replies from mutuals": "Erlauben Sie nur Antworten von Gegenseitigkeitsgesellschaften", "Only allow replies from mutuals": "Erlauben Sie nur Antworten von Gegenseitigkeitsgesellschaften",
"Reason": "Grund" "Reason": "Grund",
"Chat": "Plaudern"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "Πληρεξούσιο", "Proxy": "Πληρεξούσιο",
"Only allow replies from followers": "Επιτρέπονται μόνο οι απαντήσεις από τους ακόλουθους", "Only allow replies from followers": "Επιτρέπονται μόνο οι απαντήσεις από τους ακόλουθους",
"Only allow replies from mutuals": "Επιτρέπονται μόνο απαντήσεις από αμοιβαία μέλη", "Only allow replies from mutuals": "Επιτρέπονται μόνο απαντήσεις από αμοιβαία μέλη",
"Reason": "Λόγος" "Reason": "Λόγος",
"Chat": "Κουβέντα"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "Proxy", "Proxy": "Proxy",
"Only allow replies from followers": "Only allow replies from followers", "Only allow replies from followers": "Only allow replies from followers",
"Only allow replies from mutuals": "Only allow replies from mutuals", "Only allow replies from mutuals": "Only allow replies from mutuals",
"Reason": "Reason" "Reason": "Reason",
"Chat": "Chat"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "Apoderada", "Proxy": "Apoderada",
"Only allow replies from followers": "Permitir solo respuestas de seguidores", "Only allow replies from followers": "Permitir solo respuestas de seguidores",
"Only allow replies from mutuals": "Permitir solo respuestas de mutuas", "Only allow replies from mutuals": "Permitir solo respuestas de mutuas",
"Reason": "Razón" "Reason": "Razón",
"Chat": "Charlar"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "پروکسی", "Proxy": "پروکسی",
"Only allow replies from followers": "فقط اجازه پاسخ از طرفداران را بدهید", "Only allow replies from followers": "فقط اجازه پاسخ از طرفداران را بدهید",
"Only allow replies from mutuals": "فقط اجازه پاسخ از طرف متقابل را بدهید", "Only allow replies from mutuals": "فقط اجازه پاسخ از طرف متقابل را بدهید",
"Reason": "دلیل" "Reason": "دلیل",
"Chat": "چت کنید"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "Procuration", "Proxy": "Procuration",
"Only allow replies from followers": "Autoriser uniquement les réponses des abonnés", "Only allow replies from followers": "Autoriser uniquement les réponses des abonnés",
"Only allow replies from mutuals": "Autoriser uniquement les réponses des mutuelles", "Only allow replies from mutuals": "Autoriser uniquement les réponses des mutuelles",
"Reason": "Raison" "Reason": "Raison",
"Chat": "Discuter"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "Seachfhreastalaí", "Proxy": "Seachfhreastalaí",
"Only allow replies from followers": "Ná ceadaigh ach freagraí ó leantóirí", "Only allow replies from followers": "Ná ceadaigh ach freagraí ó leantóirí",
"Only allow replies from mutuals": "Ná ceadaigh ach freagraí ó chomhlachtaí frithpháirteacha", "Only allow replies from mutuals": "Ná ceadaigh ach freagraí ó chomhlachtaí frithpháirteacha",
"Reason": "Cúis" "Reason": "Cúis",
"Chat": "Comhrá"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "प्रतिनिधि", "Proxy": "प्रतिनिधि",
"Only allow replies from followers": "केवल अनुयायियों के उत्तरों की अनुमति दें", "Only allow replies from followers": "केवल अनुयायियों के उत्तरों की अनुमति दें",
"Only allow replies from mutuals": "केवल पारस्परिक उत्तरों की अनुमति दें", "Only allow replies from mutuals": "केवल पारस्परिक उत्तरों की अनुमति दें",
"Reason": "कारण" "Reason": "कारण",
"Chat": "बात करना"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "Delega", "Proxy": "Delega",
"Only allow replies from followers": "Consenti solo risposte dai follower", "Only allow replies from followers": "Consenti solo risposte dai follower",
"Only allow replies from mutuals": "Consenti solo risposte da mutue", "Only allow replies from mutuals": "Consenti solo risposte da mutue",
"Reason": "Motivo" "Reason": "Motivo",
"Chat": "Chiacchierata"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "プロキシー", "Proxy": "プロキシー",
"Only allow replies from followers": "フォロワーからの返信のみを許可する", "Only allow replies from followers": "フォロワーからの返信のみを許可する",
"Only allow replies from mutuals": "相互からの返信のみを許可する", "Only allow replies from mutuals": "相互からの返信のみを許可する",
"Reason": "理由" "Reason": "理由",
"Chat": "チャット"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "대리", "Proxy": "대리",
"Only allow replies from followers": "팔로어의 답글만 허용", "Only allow replies from followers": "팔로어의 답글만 허용",
"Only allow replies from mutuals": "상호 간의 답장만 허용", "Only allow replies from mutuals": "상호 간의 답장만 허용",
"Reason": "이유" "Reason": "이유",
"Chat": "채팅"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "Proxy", "Proxy": "Proxy",
"Only allow replies from followers": "Tenê destûr bidin bersivên ji şagirtan", "Only allow replies from followers": "Tenê destûr bidin bersivên ji şagirtan",
"Only allow replies from mutuals": "Tenê destûr bidin bersivên ji hevdu", "Only allow replies from mutuals": "Tenê destûr bidin bersivên ji hevdu",
"Reason": "Semed" "Reason": "Semed",
"Chat": "Galgalkirin"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "Volmacht", "Proxy": "Volmacht",
"Only allow replies from followers": "Sta alleen reacties van volgers toe", "Only allow replies from followers": "Sta alleen reacties van volgers toe",
"Only allow replies from mutuals": "Sta alleen reacties van onderlinge maatschappijen toe", "Only allow replies from mutuals": "Sta alleen reacties van onderlinge maatschappijen toe",
"Reason": "Reden" "Reason": "Reden",
"Chat": "Chatten"
} }

View File

@ -622,5 +622,6 @@
"Proxy": "Proxy", "Proxy": "Proxy",
"Only allow replies from followers": "Only allow replies from followers", "Only allow replies from followers": "Only allow replies from followers",
"Only allow replies from mutuals": "Only allow replies from mutuals", "Only allow replies from mutuals": "Only allow replies from mutuals",
"Reason": "Reason" "Reason": "Reason",
"Chat": "Chat"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "Pełnomocnik", "Proxy": "Pełnomocnik",
"Only allow replies from followers": "Zezwalaj tylko na odpowiedzi od obserwujących", "Only allow replies from followers": "Zezwalaj tylko na odpowiedzi od obserwujących",
"Only allow replies from mutuals": "Zezwalaj tylko na odpowiedzi od towarzystw wzajemnych", "Only allow replies from mutuals": "Zezwalaj tylko na odpowiedzi od towarzystw wzajemnych",
"Reason": "Powód" "Reason": "Powód",
"Chat": "Czat"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "Proxy", "Proxy": "Proxy",
"Only allow replies from followers": "Permitir apenas respostas de seguidores", "Only allow replies from followers": "Permitir apenas respostas de seguidores",
"Only allow replies from mutuals": "Permitir apenas respostas de mútuos", "Only allow replies from mutuals": "Permitir apenas respostas de mútuos",
"Reason": "Razão" "Reason": "Razão",
"Chat": "Bater papo"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "Прокси", "Proxy": "Прокси",
"Only allow replies from followers": "Разрешить ответы только от подписчиков", "Only allow replies from followers": "Разрешить ответы только от подписчиков",
"Only allow replies from mutuals": "Разрешить ответы только от взаимных", "Only allow replies from mutuals": "Разрешить ответы только от взаимных",
"Reason": "Причина" "Reason": "Причина",
"Chat": "Чат"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "Wakala", "Proxy": "Wakala",
"Only allow replies from followers": "Ruhusu tu majibu kutoka kwa wafuasi", "Only allow replies from followers": "Ruhusu tu majibu kutoka kwa wafuasi",
"Only allow replies from mutuals": "Ruhusu tu majibu kutoka kwa pande zote mbili", "Only allow replies from mutuals": "Ruhusu tu majibu kutoka kwa pande zote mbili",
"Reason": "Sababu" "Reason": "Sababu",
"Chat": "Soga"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "Vekil", "Proxy": "Vekil",
"Only allow replies from followers": "Yalnızca takipçilerden gelen yanıtlara izin ver", "Only allow replies from followers": "Yalnızca takipçilerden gelen yanıtlara izin ver",
"Only allow replies from mutuals": "Yalnızca ortaklardan gelen yanıtlara izin ver", "Only allow replies from mutuals": "Yalnızca ortaklardan gelen yanıtlara izin ver",
"Reason": "Sebep" "Reason": "Sebep",
"Chat": "Sohbet"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "Проксі", "Proxy": "Проксі",
"Only allow replies from followers": "Дозволити відповіді лише від підписників", "Only allow replies from followers": "Дозволити відповіді лише від підписників",
"Only allow replies from mutuals": "Дозволити відповіді лише від взаємних клієнтів", "Only allow replies from mutuals": "Дозволити відповіді лише від взаємних клієнтів",
"Reason": "Причина" "Reason": "Причина",
"Chat": "Чат"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "פראקסי", "Proxy": "פראקסי",
"Only allow replies from followers": "נאָר לאָזן ענטפֿערס פון אנהענגערס", "Only allow replies from followers": "נאָר לאָזן ענטפֿערס פון אנהענגערס",
"Only allow replies from mutuals": "לאָזן בלויז ענטפֿערס פון מיוטשואַלז", "Only allow replies from mutuals": "לאָזן בלויז ענטפֿערס פון מיוטשואַלז",
"Reason": "סיבה" "Reason": "סיבה",
"Chat": "שמועסן"
} }

View File

@ -626,5 +626,6 @@
"Proxy": "代理人", "Proxy": "代理人",
"Only allow replies from followers": "只允许关注者回复", "Only allow replies from followers": "只允许关注者回复",
"Only allow replies from mutuals": "只允许来自相互的回复", "Only allow replies from mutuals": "只允许来自相互的回复",
"Reason": "原因" "Reason": "原因",
"Chat": "聊天"
} }

View File

@ -1332,12 +1332,37 @@ def get_post_attachments_as_html(base_dir: str,
attachment_ctr = 0 attachment_ctr = 0
attachment_str = '' attachment_str = ''
chat_link_str = ''
media_style_added = False media_style_added = False
post_id = None post_id = None
if post_json_object['object'].get('id'): if post_json_object['object'].get('id'):
post_id = post_json_object['object']['id'] post_id = post_json_object['object']['id']
post_id = remove_id_ending(post_id).replace('/', '--') post_id = remove_id_ending(post_id).replace('/', '--')
# chat links
# https://codeberg.org/fediverse/fep/src/branch/main/fep/1970/fep-1970.md
for attach in post_json_object['object']['attachment']:
if not attach.get('type') or \
not attach.get('name') or \
not attach.get('href') or \
not attach.get('rel'):
continue
if not isinstance(attach['type'], str) or \
not isinstance(attach['name'], str) or \
not isinstance(attach['href'], str) or \
not isinstance(attach['rel'], str):
continue
if attach['type'] != 'Link' or \
attach['name'] != 'Chat' or \
attach['rel'] != 'discussion' or \
'://' not in attach['href'] or \
'.' not in attach['href']:
continue
chat_link_str += \
'<p><a href="' + attach['href'] + \
'" target="_blank" rel="nofollow noopener noreferrer">' + \
'💬 ' + translate['Chat'] + '</a></p>'
# obtain transcripts # obtain transcripts
transcripts = {} transcripts = {}
for attach in post_json_object['object']['attachment']: for attach in post_json_object['object']['attachment']:
@ -1698,7 +1723,7 @@ def get_post_attachments_as_html(base_dir: str,
attachment_ctr += 1 attachment_ctr += 1
if media_style_added: if media_style_added:
attachment_str += '</div><br>' attachment_str += '</div><br>'
return attachment_str, gallery_str return attachment_str + chat_link_str, gallery_str
def html_post_separator(base_dir: str, column: str) -> str: def html_post_separator(base_dir: str, column: str) -> str: