Add chat links when creating post html

main
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": "الوكيل",
"Only allow replies from followers": "السماح فقط بالردود من المتابعين",
"Only allow replies from mutuals": "السماح فقط بالردود من المتبادلين",
"Reason": "سبب"
"Reason": "سبب",
"Chat": "محادثة"
}

View File

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

View File

@ -626,5 +626,6 @@
"Proxy": "Proxy",
"Only allow replies from followers": "Només permet respostes dels seguidors",
"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",
"Only allow replies from followers": "Caniatewch atebion gan ddilynwyr 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",
"Only allow replies from followers": "Erlauben Sie nur Antworten von Followern",
"Only allow replies from mutuals": "Erlauben Sie nur Antworten von Gegenseitigkeitsgesellschaften",
"Reason": "Grund"
"Reason": "Grund",
"Chat": "Plaudern"
}

View File

@ -626,5 +626,6 @@
"Proxy": "Πληρεξούσιο",
"Only allow replies from followers": "Επιτρέπονται μόνο οι απαντήσεις από τους ακόλουθους",
"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"
"Reason": "Reason",
"Chat": "Chat"
}

View File

@ -626,5 +626,6 @@
"Proxy": "Apoderada",
"Only allow replies from followers": "Permitir solo respuestas de seguidores",
"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": "پروکسی",
"Only allow replies from followers": "فقط اجازه پاسخ از طرفداران را بدهید",
"Only allow replies from mutuals": "فقط اجازه پاسخ از طرف متقابل را بدهید",
"Reason": "دلیل"
"Reason": "دلیل",
"Chat": "چت کنید"
}

View File

@ -626,5 +626,6 @@
"Proxy": "Procuration",
"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",
"Reason": "Raison"
"Reason": "Raison",
"Chat": "Discuter"
}

View File

@ -626,5 +626,6 @@
"Proxy": "Seachfhreastalaí",
"Only allow replies from followers": "Ná ceadaigh ach freagraí ó leantóirí",
"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": "प्रतिनिधि",
"Only allow replies from followers": "केवल अनुयायियों के उत्तरों की अनुमति दें",
"Only allow replies from mutuals": "केवल पारस्परिक उत्तरों की अनुमति दें",
"Reason": "कारण"
"Reason": "कारण",
"Chat": "बात करना"
}

View File

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

View File

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

View File

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

View File

@ -626,5 +626,6 @@
"Proxy": "Proxy",
"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",
"Reason": "Semed"
"Reason": "Semed",
"Chat": "Galgalkirin"
}

View File

@ -626,5 +626,6 @@
"Proxy": "Volmacht",
"Only allow replies from followers": "Sta alleen reacties van volgers 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",
"Only allow replies from followers": "Only allow replies from followers",
"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",
"Only allow replies from followers": "Zezwalaj tylko na odpowiedzi od obserwujących",
"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",
"Only allow replies from followers": "Permitir apenas respostas de seguidores",
"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": "Прокси",
"Only allow replies from followers": "Разрешить ответы только от подписчиков",
"Only allow replies from mutuals": "Разрешить ответы только от взаимных",
"Reason": "Причина"
"Reason": "Причина",
"Chat": "Чат"
}

View File

@ -626,5 +626,6 @@
"Proxy": "Wakala",
"Only allow replies from followers": "Ruhusu tu majibu kutoka kwa wafuasi",
"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",
"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",
"Reason": "Sebep"
"Reason": "Sebep",
"Chat": "Sohbet"
}

View File

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

View File

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

View File

@ -626,5 +626,6 @@
"Proxy": "代理人",
"Only allow replies from followers": "只允许关注者回复",
"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_str = ''
chat_link_str = ''
media_style_added = False
post_id = None
if post_json_object['object'].get('id'):
post_id = post_json_object['object']['id']
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
transcripts = {}
for attach in post_json_object['object']['attachment']:
@ -1698,7 +1723,7 @@ def get_post_attachments_as_html(base_dir: str,
attachment_ctr += 1
if media_style_added:
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: