mirror of https://gitlab.com/bashrc2/epicyon
Notify about emoji reactions
parent
f36000246d
commit
6b86c83db0
33
daemon.py
33
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,
|
||||
|
|
|
@ -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 = '<div class="emojiReactionBar">\n'
|
||||
for emojiContent, count in reactions.items():
|
||||
htmlStr += ' <div class="emojiReactionButton">\n'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -492,5 +492,6 @@
|
|||
"Add content warnings for the following sites": "أضف تحذيرات المحتوى للمواقع التالية",
|
||||
"Known Web Crawlers": "برامج زحف الويب المعروفة",
|
||||
"Add to the calendar": "أضف إلى التقويم",
|
||||
"Content License": "ترخيص المحتوى"
|
||||
"Content License": "ترخيص المحتوى",
|
||||
"Reaction by": "رد فعل"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -492,5 +492,6 @@
|
|||
"Add content warnings for the following sites": "निम्नलिखित साइटों के लिए सामग्री चेतावनियाँ जोड़ें",
|
||||
"Known Web Crawlers": "ज्ञात वेब क्रॉलर",
|
||||
"Add to the calendar": "कैलेंडर में जोड़ें",
|
||||
"Content License": "सामग्री लाइसेंस"
|
||||
"Content License": "सामग्री लाइसेंस",
|
||||
"Reaction by": "द्वारा प्रतिक्रिया"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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": "による反応"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -492,5 +492,6 @@
|
|||
"Add content warnings for the following sites": "Добавить предупреждения о содержании для следующих сайтов",
|
||||
"Known Web Crawlers": "Известные веб-сканеры",
|
||||
"Add to the calendar": "Добавить в календарь",
|
||||
"Content License": "Лицензия на содержание"
|
||||
"Content License": "Лицензия на содержание",
|
||||
"Reaction by": "Реакция со стороны"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -492,5 +492,6 @@
|
|||
"Add content warnings for the following sites": "为以下网站添加内容警告",
|
||||
"Known Web Crawlers": "已知的网络爬虫",
|
||||
"Add to the calendar": "添加到日历",
|
||||
"Content License": "内容许可"
|
||||
"Content License": "内容许可",
|
||||
"Reaction by": "反应由"
|
||||
}
|
||||
|
|
|
@ -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 += \
|
||||
'<p>' + likedByStr + ' <a href="' + likedBy + '">@' + \
|
||||
likedByHandle + '</a>\n'
|
||||
'<p>' + byText + ' <a href="' + byStr + '">@' + \
|
||||
byStrHandle + '</a>' + byTextExtra + '\n'
|
||||
|
||||
domainFull = getFullDomain(domain, port)
|
||||
actor = '/users/' + nickname
|
||||
|
@ -1957,8 +1968,8 @@ def htmlIndividualPost(cssCache: {},
|
|||
' <input type="hidden" name="actor" value="' + actor + '">\n'
|
||||
followStr += \
|
||||
' <input type="hidden" name="searchtext" value="' + \
|
||||
likedByHandle + '">\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]
|
||||
|
|
Loading…
Reference in New Issue