diff --git a/daemon.py b/daemon.py index 3b6d6e2a8..03e142f31 100644 --- a/daemon.py +++ b/daemon.py @@ -8960,6 +8960,18 @@ class PubServer(BaseHTTPRequestHandler): likedBy = likedBy.split('?')[0] path = path.split('?likedBy=')[0] + reactBy = None + reactEmoji = None + if '?reactBy=' in path: + reactBy = path.split('?reactBy=')[1].strip() + if ';' in reactBy: + reactBy = reactBy.split(';')[0] + if ';emoj=' in path: + reactEmoji = path.split(';emoj=')[1].strip() + if ';' in reactEmoji: + reactEmoji = reactEmoji.split(';')[0] + path = path.split('?reactBy=')[0] + namedStatus = path.split('/@')[1] if '/' not in namedStatus: # show actor @@ -8984,6 +8996,7 @@ class PubServer(BaseHTTPRequestHandler): includeCreateWrapper = True result = self._showPostFromFile(postFilename, likedBy, + reactBy, reactEmoji, authorized, callingDomain, path, baseDir, httpPrefix, nickname, domain, domainFull, port, @@ -8997,6 +9010,7 @@ class PubServer(BaseHTTPRequestHandler): return result def _showPostFromFile(self, postFilename: str, likedBy: str, + reactBy: str, reactEmoji: str, authorized: bool, callingDomain: str, path: str, baseDir: str, httpPrefix: str, nickname: str, @@ -9043,7 +9057,7 @@ class PubServer(BaseHTTPRequestHandler): postJsonObject, httpPrefix, self.server.projectVersion, - likedBy, + likedBy, reactBy, reactEmoji, self.server.YTReplacementDomain, self.server.twitterReplacementDomain, self.server.showPublishedDateOnly, @@ -9106,6 +9120,19 @@ class PubServer(BaseHTTPRequestHandler): if '?' in likedBy: likedBy = likedBy.split('?')[0] path = path.split('?likedBy=')[0] + + reactBy = None + reactEmoji = None + if '?reactBy=' in path: + reactBy = path.split('?reactBy=')[1].strip() + if ';' in reactBy: + reactBy = reactBy.split(';')[0] + if ';emoj=' in path: + reactEmoji = path.split(';emoj=')[1].strip() + if ';' in reactEmoji: + reactEmoji = reactEmoji.split(';')[0] + path = path.split('?reactBy=')[0] + namedStatus = path.split('/users/')[1] if '/' not in namedStatus: return False @@ -9127,6 +9154,7 @@ class PubServer(BaseHTTPRequestHandler): includeCreateWrapper = True result = self._showPostFromFile(postFilename, likedBy, + reactBy, reactEmoji, authorized, callingDomain, path, baseDir, httpPrefix, nickname, domain, domainFull, port, @@ -9151,6 +9179,8 @@ class PubServer(BaseHTTPRequestHandler): and where you have the notify checkbox set on person options """ likedBy = None + reactBy = None + reactEmoji = None postId = path.split('?notifypost=')[1].strip() postId = postId.replace('-', '/') path = path.split('?notifypost=')[0] @@ -9168,6 +9198,7 @@ class PubServer(BaseHTTPRequestHandler): includeCreateWrapper = True result = self._showPostFromFile(postFilename, likedBy, + reactBy, reactEmoji, authorized, callingDomain, path, baseDir, httpPrefix, nickname, domain, domainFull, port, diff --git a/reaction.py b/reaction.py index 2536a3a98..a6ebc2978 100644 --- a/reaction.py +++ b/reaction.py @@ -529,7 +529,8 @@ def htmlEmojiReactions(postJsonObject: {}, interactive: bool, reactions[emojiContent] += 1 if len(reactions.items()) == 0: return '' - baseUrl = actor + '?reactUrl=' + postJsonObject['object']['id'] + ';emoj=' + reactBy = removeIdEnding(postJsonObject['object']['id']) + baseUrl = actor + '?reactBy=' + reactBy + ';emoj=' htmlStr = '
\n' for emojiContent, count in reactions.items(): htmlStr += '
\n' diff --git a/scripts/epicyon-notification b/scripts/epicyon-notification index a92db2b01..d764e4771 100755 --- a/scripts/epicyon-notification +++ b/scripts/epicyon-notification @@ -215,6 +215,21 @@ function notifications { fi fi + # send notifications for emoji reactions to XMPP/email users + epicyonLikeFile="$epicyonDir/.newReaction" + if [ -f "$epicyonReactionFile" ]; then + if ! grep -q "##sent##" "$epicyonReactionFile"; then + epicyonReactionMessage=$(notification_translate_text 'Reaction by') + epicyonReactionFileContent=$(cat "$epicyonReactionFile" | awk -F ' ' '{print $1}')" "$(echo "$epicyonReactionMessage")" "$(cat "$epicyonReactionFile" | awk -F ' ' '{print $2}') + if [[ "$epicyonReactionFileContent" == *':'* ]]; then + epicyonReactionMessage="Epicyon: $epicyonReactionFileContent" + fi + sendNotification "$USERNAME" "Epicyon" "$epicyonReactionMessage" + echo "##sent##" > "$epicyonReactionFile" + chown ${PROJECT_NAME}:${PROJECT_NAME} "$epicyonReactionFile" + fi + fi + # send notifications for posts arriving from a particular person epicyonNotifyFile="$epicyonDir/.newNotifiedPost" if [ -f "$epicyonNotifyFile" ]; then diff --git a/translations/ar.json b/translations/ar.json index 53e3d7da9..33121d5c1 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -492,5 +492,6 @@ "Add content warnings for the following sites": "أضف تحذيرات المحتوى للمواقع التالية", "Known Web Crawlers": "برامج زحف الويب المعروفة", "Add to the calendar": "أضف إلى التقويم", - "Content License": "ترخيص المحتوى" + "Content License": "ترخيص المحتوى", + "Reaction by": "رد فعل" } diff --git a/translations/ca.json b/translations/ca.json index fb0b7340d..a9771ffd7 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -492,5 +492,6 @@ "Add content warnings for the following sites": "Afegiu advertiments de contingut per als llocs següents", "Known Web Crawlers": "Exploradors web coneguts", "Add to the calendar": "Afegeix al calendari", - "Content License": "Llicència de contingut" + "Content License": "Llicència de contingut", + "Reaction by": "Reacció de" } diff --git a/translations/cy.json b/translations/cy.json index d1eaf3d76..0415d6e30 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -492,5 +492,6 @@ "Add content warnings for the following sites": "Ychwanegwch rybuddion cynnwys ar gyfer y gwefannau canlynol", "Known Web Crawlers": "Crawlers Gwe Hysbys", "Add to the calendar": "Ychwanegwch at y calendr", - "Content License": "Trwydded Cynnwys" + "Content License": "Trwydded Cynnwys", + "Reaction by": "Ymateb gan" } diff --git a/translations/de.json b/translations/de.json index a94268597..1663e535d 100644 --- a/translations/de.json +++ b/translations/de.json @@ -492,5 +492,6 @@ "Add content warnings for the following sites": "Inhaltswarnungen für die folgenden Websites hinzufügen", "Known Web Crawlers": "Bekannte Web-Crawler", "Add to the calendar": "Zum Kalender hinzufügen", - "Content License": "Inhaltslizenz" + "Content License": "Inhaltslizenz", + "Reaction by": "Reaktion von" } diff --git a/translations/en.json b/translations/en.json index d96083f0b..627ea5a17 100644 --- a/translations/en.json +++ b/translations/en.json @@ -492,5 +492,6 @@ "Add content warnings for the following sites": "Add content warnings for the following sites", "Known Web Crawlers": "Known Web Crawlers", "Add to the calendar": "Add to the calendar", - "Content License": "Content License" + "Content License": "Content License", + "Reaction by": "Reaction by" } diff --git a/translations/es.json b/translations/es.json index 00a945f28..5dc843317 100644 --- a/translations/es.json +++ b/translations/es.json @@ -492,5 +492,6 @@ "Add content warnings for the following sites": "Agregue advertencias de contenido para los siguientes sitios", "Known Web Crawlers": "Rastreadores web conocidos", "Add to the calendar": "Agregar al calendario", - "Content License": "Licencia de contenido" + "Content License": "Licencia de contenido", + "Reaction by": "Reacción de" } diff --git a/translations/fr.json b/translations/fr.json index 0d082c4a9..b8ec4730a 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -492,5 +492,6 @@ "Add content warnings for the following sites": "Ajouter des avertissements de contenu pour les sites suivants", "Known Web Crawlers": "Crawlers Web connus", "Add to the calendar": "Ajouter au calendrier", - "Content License": "Licence de contenu" + "Content License": "Licence de contenu", + "Reaction by": "Réaction par" } diff --git a/translations/ga.json b/translations/ga.json index 1d91c0471..f79bf3a30 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -492,5 +492,6 @@ "Add content warnings for the following sites": "Cuir rabhaidh ábhair leis na suíomhanna seo a leanas", "Known Web Crawlers": "Crawlers Gréasáin Aitheanta", "Add to the calendar": "Cuir leis an bhféilire", - "Content License": "Ceadúnas Ábhar" + "Content License": "Ceadúnas Ábhar", + "Reaction by": "Imoibriú le" } diff --git a/translations/hi.json b/translations/hi.json index 93a81c7e6..965c8281c 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -492,5 +492,6 @@ "Add content warnings for the following sites": "निम्नलिखित साइटों के लिए सामग्री चेतावनियाँ जोड़ें", "Known Web Crawlers": "ज्ञात वेब क्रॉलर", "Add to the calendar": "कैलेंडर में जोड़ें", - "Content License": "सामग्री लाइसेंस" + "Content License": "सामग्री लाइसेंस", + "Reaction by": "द्वारा प्रतिक्रिया" } diff --git a/translations/it.json b/translations/it.json index 64319f34a..427a9c055 100644 --- a/translations/it.json +++ b/translations/it.json @@ -492,5 +492,6 @@ "Add content warnings for the following sites": "Aggiungi avvisi sui contenuti per i seguenti siti", "Known Web Crawlers": "Crawler Web conosciuti", "Add to the calendar": "Aggiungi al calendario", - "Content License": "Licenza sui contenuti" + "Content License": "Licenza sui contenuti", + "Reaction by": "Reazione di" } diff --git a/translations/ja.json b/translations/ja.json index 89b880f99..f204374f7 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -492,5 +492,6 @@ "Add content warnings for the following sites": "次のサイトのコンテンツ警告を追加します", "Known Web Crawlers": "既知のWebクローラー", "Add to the calendar": "カレンダーに追加", - "Content License": "コンテンツライセンス" + "Content License": "コンテンツライセンス", + "Reaction by": "による反応" } diff --git a/translations/ku.json b/translations/ku.json index 54edfdbb8..880e0bc96 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -492,5 +492,6 @@ "Add content warnings for the following sites": "Ji bo malperên jêrîn hişyariyên naverokê zêde bikin", "Known Web Crawlers": "Crawlerên Webê yên naskirî", "Add to the calendar": "Di salnameyê de zêde bike", - "Content License": "Naverok License de" + "Content License": "Naverok License de", + "Reaction by": "Reaction by" } diff --git a/translations/oc.json b/translations/oc.json index 8240c4a8e..9e2c9cce8 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -488,5 +488,6 @@ "Add content warnings for the following sites": "Add content warnings for the following sites", "Known Web Crawlers": "Known Web Crawlers", "Add to the calendar": "Add to the calendar", - "Content License": "Content License" + "Content License": "Content License", + "Reaction by": "Reaction by" } diff --git a/translations/pt.json b/translations/pt.json index 958a40f6f..054183025 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -492,5 +492,6 @@ "Add content warnings for the following sites": "Adicione avisos de conteúdo para os seguintes sites", "Known Web Crawlers": "Rastreadores da Web conhecidos", "Add to the calendar": "Adicionar ao calendário", - "Content License": "Licença de Conteúdo" + "Content License": "Licença de Conteúdo", + "Reaction by": "Reazione di" } diff --git a/translations/ru.json b/translations/ru.json index d59bf4869..ca46b77e9 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -492,5 +492,6 @@ "Add content warnings for the following sites": "Добавить предупреждения о содержании для следующих сайтов", "Known Web Crawlers": "Известные веб-сканеры", "Add to the calendar": "Добавить в календарь", - "Content License": "Лицензия на содержание" + "Content License": "Лицензия на содержание", + "Reaction by": "Реакция со стороны" } diff --git a/translations/sw.json b/translations/sw.json index d4a5ca713..dfaf4d7a3 100644 --- a/translations/sw.json +++ b/translations/sw.json @@ -492,5 +492,6 @@ "Add content warnings for the following sites": "Ongeza maonyo ya yaliyomo kwa wavuti zifuatazo", "Known Web Crawlers": "Watambaji Wavuti Wanaojulikana", "Add to the calendar": "Ongeza kwenye kalenda", - "Content License": "Leseni ya Maudhui" + "Content License": "Leseni ya Maudhui", + "Reaction by": "Majibu kwa" } diff --git a/translations/zh.json b/translations/zh.json index a698fb5ce..fe5b970a1 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -492,5 +492,6 @@ "Add content warnings for the following sites": "为以下网站添加内容警告", "Known Web Crawlers": "已知的网络爬虫", "Add to the calendar": "添加到日历", - "Content License": "内容许可" + "Content License": "内容许可", + "Reaction by": "反应由" } diff --git a/webapp_post.py b/webapp_post.py index ad71f54ff..9987e07f0 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -1925,6 +1925,7 @@ def htmlIndividualPost(cssCache: {}, nickname: str, domain: str, port: int, authorized: bool, postJsonObject: {}, httpPrefix: str, projectVersion: str, likedBy: str, + reactBy: str, reactEmoji: str, YTReplacementDomain: str, twitterReplacementDomain: str, showPublishedDateOnly: bool, @@ -1937,17 +1938,27 @@ def htmlIndividualPost(cssCache: {}, """ originalPostJson = postJsonObject postStr = '' + byStr = '' + byText = '' + byTextExtra = '' if likedBy: - likedByNickname = getNicknameFromActor(likedBy) - likedByDomain, likedByPort = getDomainFromActor(likedBy) - likedByDomain = getFullDomain(likedByDomain, likedByPort) - likedByHandle = likedByNickname + '@' + likedByDomain - likedByStr = 'Liked by' - if translate.get(likedByStr): - likedByStr = translate[likedByStr] + byStr = likedBy + byText = 'Liked by' + elif reactBy and reactEmoji: + byStr = reactBy + byText = 'Reaction by' + byTextExtra = ' ' + reactEmoji + + if byStr: + byStrNickname = getNicknameFromActor(byStr) + byStrDomain, byStrPort = getDomainFromActor(byStr) + byStrDomain = getFullDomain(byStrDomain, byStrPort) + byStrHandle = byStrNickname + '@' + byStrDomain + if translate.get(byText): + byText = translate[byText] postStr += \ - '

' + likedByStr + ' @' + \ - likedByHandle + '\n' + '

' + byText + ' @' + \ + byStrHandle + '' + byTextExtra + '\n' domainFull = getFullDomain(domain, port) actor = '/users/' + nickname @@ -1957,8 +1968,8 @@ def htmlIndividualPost(cssCache: {}, ' \n' followStr += \ ' \n' - if not isFollowingActor(baseDir, nickname, domainFull, likedBy): + byStrHandle + '">\n' + if not isFollowingActor(baseDir, nickname, domainFull, byStr): translateFollowStr = 'Follow' if translate.get(translateFollowStr): translateFollowStr = translate[translateFollowStr]