diff --git a/daemon.py b/daemon.py index 3c34d9720..684cdb2e5 100644 --- a/daemon.py +++ b/daemon.py @@ -6182,6 +6182,32 @@ class PubServer(BaseHTTPRequestHandler): set_cwtch_address(actor_json, '') actor_changed = True + # change ntfy url + if fields.get('ntfyUrl'): + ntfy_url_file = \ + base_dir + '/accounts/' + \ + nickname + '@' + domain + '/.ntfy_url' + try: + with open(ntfy_url_file, 'w+', + encoding='utf-8') as fp_ntfy: + fp_ntfy.write(fields['ntfyUrl']) + except OSError: + print('EX: unable to save ntfy url ' + + ntfy_url_file) + + # change ntfy topic + if fields.get('ntfyTopic'): + ntfy_topic_file = \ + base_dir + '/accounts/' + \ + nickname + '@' + domain + '/.ntfy_topic' + try: + with open(ntfy_topic_file, 'w+', + encoding='utf-8') as fp_ntfy: + fp_ntfy.write(fields['ntfyTopic']) + except OSError: + print('EX: unable to save ntfy topic ' + + ntfy_topic_file) + # change Enigma public key currentenigma_pub_key = get_enigma_pub_key(actor_json) if fields.get('enigmapubkey'): diff --git a/scripts/epicyon-notification b/scripts/epicyon-notification index d4d6cd373..9c5a8ba2b 100755 --- a/scripts/epicyon-notification +++ b/scripts/epicyon-notification @@ -118,8 +118,21 @@ function sendNotification { # see https://ntfy.sh # You will need to create these two files containing the ntfy # service url and topic - ntfy_url_file=/home/${ADMIN_USERNAME}/.ntfy_url - ntfy_topic_file=/home/${ADMIN_USERNAME}/.ntfy_topic + ntfy_url_file=/home/${USERNAME}/.ntfy_url + ntfy_topic_file=/home/${USERNAME}/.ntfy_topic + + # get ntfy settings from the account directory + epicyon_config_file=${epicyonInstallDir}/config.json + if [ -f "${epicyon_config_file}" ]; then + epicyon_domain=$(cat "$epicyon_config_file" | awk -F '"domain": "' '{print $2}' | awk -F '"' '{print $1}') + if [ "${epicyon_domain}" ]; then + epicyon_account_dir="${epicyonInstallDir}/accounts/${USERNAME}@${epicyon_domain}" + if [ -d "${epicyon_account_dir}" ]; then + ntfy_url_file=${epicyon_account_dir}/.ntfy_url + ntfy_topic_file=${epicyon_account_dir}/.ntfy_topic + fi + fi + fi if [ "$MESSAGE" ]; then if [ -f "$ntfy_topic_file" ]; then diff --git a/translations/ar.json b/translations/ar.json index 778018259..04b486cac 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -573,5 +573,8 @@ "Import and Export": "استيراد وتصدير", "Import Follows": "يتبع الاستيراد", "Post expiry period in days": "فترة ما بعد انتهاء الصلاحية بالأيام", - "Keep DMs during post expiry": "احتفظ بالرسائل الخاصّة أثناء انتهاء صلاحية النشر" + "Keep DMs during post expiry": "احتفظ بالرسائل الخاصّة أثناء انتهاء صلاحية النشر", + "Notifications": "إشعارات", + "ntfy URL": "ntfy URL", + "ntfy topic": "موضوع ntfy" } diff --git a/translations/bn.json b/translations/bn.json index 7337b1fb6..4ee419882 100644 --- a/translations/bn.json +++ b/translations/bn.json @@ -573,5 +573,8 @@ "Import and Export": "আমদানি এবং রপ্তানি", "Import Follows": "আমদানি অনুসরণ করে", "Post expiry period in days": "দিনের মধ্যে মেয়াদ শেষ হওয়ার পরে", - "Keep DMs during post expiry": "পোস্টের মেয়াদ শেষ হওয়ার সময় সরাসরি বার্তা রাখুন" + "Keep DMs during post expiry": "পোস্টের মেয়াদ শেষ হওয়ার সময় সরাসরি বার্তা রাখুন", + "Notifications": "বিজ্ঞপ্তি", + "ntfy URL": "ntfy ইউআরএল", + "ntfy topic": "ntfy বিষয়" } diff --git a/translations/ca.json b/translations/ca.json index 0397a0a9f..60eadf75c 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -573,5 +573,8 @@ "Import and Export": "Importació i Exportació", "Import Follows": "Segueix la importació", "Post expiry period in days": "Període posterior a la caducitat en dies", - "Keep DMs during post expiry": "Conserveu els missatges directes durant la caducitat posterior" + "Keep DMs during post expiry": "Conserveu els missatges directes durant la caducitat posterior", + "Notifications": "Notificacions", + "ntfy URL": "URL ntfy", + "ntfy topic": "tema ntfy" } diff --git a/translations/cy.json b/translations/cy.json index 88f200198..7f4825020 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -573,5 +573,8 @@ "Import and Export": "Mewnforio ac Allforio", "Import Follows": "Mewnforio Dilyn", "Post expiry period in days": "Cyfnod ar ôl dod i ben mewn dyddiau", - "Keep DMs during post expiry": "Cadwch Negeseuon Uniongyrchol pan ddaw'r post i ben" + "Keep DMs during post expiry": "Cadwch Negeseuon Uniongyrchol pan ddaw'r post i ben", + "Notifications": "Hysbysiadau", + "ntfy URL": "ntfy URL", + "ntfy topic": "pwnc ntfy" } diff --git a/translations/de.json b/translations/de.json index 2fa28efb9..fb6ded2b5 100644 --- a/translations/de.json +++ b/translations/de.json @@ -573,5 +573,8 @@ "Import and Export": "Import und Export", "Import Follows": "Import folgt", "Post expiry period in days": "Nachablaufzeitraum in Tagen", - "Keep DMs during post expiry": "Bewahren Sie Direktnachrichten während des Ablaufs auf" + "Keep DMs during post expiry": "Bewahren Sie Direktnachrichten während des Ablaufs auf", + "Notifications": "Benachrichtigungen", + "ntfy URL": "ntfy-URL", + "ntfy topic": "ntfy-Thema" } diff --git a/translations/el.json b/translations/el.json index 803dcc6eb..c33ff3668 100644 --- a/translations/el.json +++ b/translations/el.json @@ -573,5 +573,8 @@ "Import and Export": "Εισάγω και εξάγω", "Import Follows": "Ακολουθεί εισαγωγή", "Post expiry period in days": "Η περίοδος μετά τη λήξη σε ημέρες", - "Keep DMs during post expiry": "Διατηρήστε τα άμεσα μηνύματα κατά τη λήξη της ανάρτησης" + "Keep DMs during post expiry": "Διατηρήστε τα άμεσα μηνύματα κατά τη λήξη της ανάρτησης", + "Notifications": "Ειδοποιήσεις", + "ntfy URL": "ntfy URL", + "ntfy topic": "ntfy θέμα" } diff --git a/translations/en.json b/translations/en.json index 98baeccd4..6e87f60d6 100644 --- a/translations/en.json +++ b/translations/en.json @@ -573,5 +573,8 @@ "Import and Export": "Import and Export", "Import Follows": "Import Follows", "Post expiry period in days": "Post expiry period in days", - "Keep DMs during post expiry": "Keep DMs during post expiry" + "Keep DMs during post expiry": "Keep DMs during post expiry", + "Notifications": "Notifications", + "ntfy URL": "ntfy URL", + "ntfy topic": "ntfy topic" } diff --git a/translations/es.json b/translations/es.json index 2e00abaf2..5c98096fe 100644 --- a/translations/es.json +++ b/translations/es.json @@ -573,5 +573,8 @@ "Import and Export": "Importar y exportar", "Import Follows": "Importar seguimientos", "Post expiry period in days": "Período de vencimiento posterior en días", - "Keep DMs during post expiry": "Conservar los mensajes directos durante el vencimiento de la publicación" + "Keep DMs during post expiry": "Conservar los mensajes directos durante el vencimiento de la publicación", + "Notifications": "Notificaciones", + "ntfy URL": "URL ntfy", + "ntfy topic": "tema ntfy" } diff --git a/translations/fr.json b/translations/fr.json index 09281533b..38ebf3878 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -573,5 +573,8 @@ "Import and Export": "Importer et exporter", "Import Follows": "Importer suit", "Post expiry period in days": "Délai après expiration en jours", - "Keep DMs during post expiry": "Conserver les messages directs après l'expiration" + "Keep DMs during post expiry": "Conserver les messages directs après l'expiration", + "Notifications": "Avis", + "ntfy URL": "URL ntfy", + "ntfy topic": "sujet ntfy" } diff --git a/translations/ga.json b/translations/ga.json index 40ef0a67c..f0fc6c844 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -573,5 +573,8 @@ "Import and Export": "Iompórtáil agus Easpórtáil", "Import Follows": "Leanann Iompórtáil", "Post expiry period in days": "Tréimhse iar-éagtha i laethanta", - "Keep DMs during post expiry": "Coinnigh Teachtaireachtaí Díreacha nuair a rachaidh postáil in éag" + "Keep DMs during post expiry": "Coinnigh Teachtaireachtaí Díreacha nuair a rachaidh postáil in éag", + "Notifications": "Fógraí", + "ntfy URL": "ntfy URL", + "ntfy topic": "topaic ntfy" } diff --git a/translations/hi.json b/translations/hi.json index 2e5bd882e..0006e46f0 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -573,5 +573,8 @@ "Import and Export": "आयात और निर्यात", "Import Follows": "आयात का अनुसरण करता है", "Post expiry period in days": "दिनों में समाप्ति अवधि पोस्ट करें", - "Keep DMs during post expiry": "समाप्ति के बाद सीधे संदेश रखें" + "Keep DMs during post expiry": "समाप्ति के बाद सीधे संदेश रखें", + "Notifications": "सूचनाएं", + "ntfy URL": "एनटीएफई यूआरएल", + "ntfy topic": "एनटीएफई विषय" } diff --git a/translations/it.json b/translations/it.json index 3dc18be99..3b630d0fd 100644 --- a/translations/it.json +++ b/translations/it.json @@ -573,5 +573,8 @@ "Import and Export": "Importazione e esportazione", "Import Follows": "Importa segue", "Post expiry period in days": "Scadenza post in giorni", - "Keep DMs during post expiry": "Conserva i messaggi diretti durante la scadenza successiva" + "Keep DMs during post expiry": "Conserva i messaggi diretti durante la scadenza successiva", + "Notifications": "Notifiche", + "ntfy URL": "ntfy URL", + "ntfy topic": "argomento ntfy" } diff --git a/translations/ja.json b/translations/ja.json index 88efc9f52..1ccfb024b 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -573,5 +573,8 @@ "Import and Export": "インポートとエクスポート", "Import Follows": "インポートフォロー", "Post expiry period in days": "投稿の有効期限 (日数)", - "Keep DMs during post expiry": "投稿の有効期限が切れるまでダイレクト メッセージを保持する" + "Keep DMs during post expiry": "投稿の有効期限が切れるまでダイレクト メッセージを保持する", + "Notifications": "通知", + "ntfy URL": "ntfy URL", + "ntfy topic": "ntfy トピック" } diff --git a/translations/ko.json b/translations/ko.json index 80eebc3b6..ab71ff765 100644 --- a/translations/ko.json +++ b/translations/ko.json @@ -573,5 +573,8 @@ "Import and Export": "가져오기 및 내보내기", "Import Follows": "팔로잉 목록 가져오기", "Post expiry period in days": "포스트 만료 기간(일)", - "Keep DMs during post expiry": "만료 후 DM 보관" + "Keep DMs during post expiry": "만료 후 DM 보관", + "Notifications": "알림", + "ntfy URL": "ntfy URL", + "ntfy topic": "ntfy 주제" } diff --git a/translations/ku.json b/translations/ku.json index ac561e035..fece4704d 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -573,5 +573,8 @@ "Import and Export": "Import û Export", "Import Follows": "Import Follows", "Post expiry period in days": "Demjimêra qedandinê di çend rojan de", - "Keep DMs during post expiry": "Di dema qedandina postê de Peyamên Rasterast biparêzin" + "Keep DMs during post expiry": "Di dema qedandina postê de Peyamên Rasterast biparêzin", + "Notifications": "Notifications", + "ntfy URL": "ntfy URL", + "ntfy topic": "mijara ntfy" } diff --git a/translations/nl.json b/translations/nl.json index b1b25c01b..5fb55a280 100644 --- a/translations/nl.json +++ b/translations/nl.json @@ -573,5 +573,8 @@ "Import and Export": "Importeren en exporteren", "Import Follows": "Volgt importeren", "Post expiry period in days": "Na afloopperiode in dagen", - "Keep DMs during post expiry": "Directe berichten bewaren tijdens de vervaldatum" + "Keep DMs during post expiry": "Directe berichten bewaren tijdens de vervaldatum", + "Notifications": "Meldingen", + "ntfy URL": "ntfy-URL", + "ntfy topic": "ntfy onderwerp" } diff --git a/translations/oc.json b/translations/oc.json index 0415c4a2a..962c82a33 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -569,5 +569,8 @@ "Import and Export": "Import and Export", "Import Follows": "Import Follows", "Post expiry period in days": "Post expiry period in days", - "Keep DMs during post expiry": "Keep DMs during post expiry" + "Keep DMs during post expiry": "Keep DMs during post expiry", + "Notifications": "Notifications", + "ntfy URL": "ntfy URL", + "ntfy topic": "ntfy topic" } diff --git a/translations/pl.json b/translations/pl.json index ac2f0ce92..b529867fd 100644 --- a/translations/pl.json +++ b/translations/pl.json @@ -573,5 +573,8 @@ "Import and Export": "Importuj i eksportuj", "Import Follows": "Importuj obserwuje", "Post expiry period in days": "Okres po wygaśnięciu w dniach", - "Keep DMs during post expiry": "Zachowaj bezpośrednie wiadomości po wygaśnięciu" + "Keep DMs during post expiry": "Zachowaj bezpośrednie wiadomości po wygaśnięciu", + "Notifications": "Powiadomienia", + "ntfy URL": "URL ntfy", + "ntfy topic": "temat ntfy" } diff --git a/translations/pt.json b/translations/pt.json index 684863d8a..26ecf3e89 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -573,5 +573,8 @@ "Import and Export": "Importar e exportar", "Import Follows": "Importar seguidores", "Post expiry period in days": "Prazo de expiração em dias", - "Keep DMs during post expiry": "Manter mensagens diretas durante a expiração da postagem" + "Keep DMs during post expiry": "Manter mensagens diretas durante a expiração da postagem", + "Notifications": "Notificações", + "ntfy URL": "URL ntfy", + "ntfy topic": "tópico ntfy" } diff --git a/translations/ru.json b/translations/ru.json index d9f2ecba4..79a4108dc 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -573,5 +573,8 @@ "Import and Export": "Импорт и экспорт", "Import Follows": "Импорт подписок", "Post expiry period in days": "Срок действия в днях", - "Keep DMs during post expiry": "Сохраняйте личные сообщения в течение срока действия после истечения срока действия" + "Keep DMs during post expiry": "Сохраняйте личные сообщения в течение срока действия после истечения срока действия", + "Notifications": "Уведомления", + "ntfy URL": "URL-адрес ntfy", + "ntfy topic": "ntfy тема" } diff --git a/translations/sw.json b/translations/sw.json index aa4871bfd..9a1444c8c 100644 --- a/translations/sw.json +++ b/translations/sw.json @@ -573,5 +573,8 @@ "Import and Export": "Ingiza na Hamisha", "Import Follows": "Ingiza Inafuata", "Post expiry period in days": "Kipindi cha baada ya kumalizika kwa siku", - "Keep DMs during post expiry": "Weka Ujumbe wa Moja kwa Moja wakati wa kuisha kwa chapisho" + "Keep DMs during post expiry": "Weka Ujumbe wa Moja kwa Moja wakati wa kuisha kwa chapisho", + "Notifications": "Arifa", + "ntfy URL": "ntfy URL", + "ntfy topic": "mada ya ntfy" } diff --git a/translations/tr.json b/translations/tr.json index e534302d2..6a07d77ee 100644 --- a/translations/tr.json +++ b/translations/tr.json @@ -573,5 +573,8 @@ "Import and Export": "İthalat ve ihracat", "Import Follows": "Takipleri İçe Aktar", "Post expiry period in days": "Gün olarak sona erme süresi", - "Keep DMs during post expiry": "Direkt Mesajları sona erme süresi boyunca saklayın" + "Keep DMs during post expiry": "Direkt Mesajları sona erme süresi boyunca saklayın", + "Notifications": "Bildirimler", + "ntfy URL": "ntfy URL'si", + "ntfy topic": "ntfy konusu" } diff --git a/translations/uk.json b/translations/uk.json index b872e4018..80218d5b5 100644 --- a/translations/uk.json +++ b/translations/uk.json @@ -573,5 +573,8 @@ "Import and Export": "Імпорт та експорт", "Import Follows": "Імпорт слідує", "Post expiry period in days": "Термін після закінчення терміну дії в днях", - "Keep DMs during post expiry": "Зберігайте прямі повідомлення протягом терміну дії" + "Keep DMs during post expiry": "Зберігайте прямі повідомлення протягом терміну дії", + "Notifications": "Сповіщення", + "ntfy URL": "ntfy URL", + "ntfy topic": "Тема ntfy" } diff --git a/translations/yi.json b/translations/yi.json index 7f235498d..702f840a9 100644 --- a/translations/yi.json +++ b/translations/yi.json @@ -573,5 +573,8 @@ "Import and Export": "אַרייַנפיר און עקספּאָרט", "Import Follows": "אַרייַנפיר גייט", "Post expiry period in days": "פּאָסטן עקספּיירי צייַט אין טעג", - "Keep DMs during post expiry": "האַלטן דירעקט אַרטיקלען בעשאַס פּאָסטן עקספּיירי" + "Keep DMs during post expiry": "האַלטן דירעקט אַרטיקלען בעשאַס פּאָסטן עקספּיירי", + "Notifications": "נאָוטאַפאַקיישאַנז", + "ntfy URL": "ntfy URL", + "ntfy topic": "ntfy טעמע" } diff --git a/translations/zh.json b/translations/zh.json index eb560023f..1234c4684 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -573,5 +573,8 @@ "Import and Export": "进出口", "Import Follows": "导入关注", "Post expiry period in days": "到期后天数", - "Keep DMs during post expiry": "在帖子到期期间保留直接消息" + "Keep DMs during post expiry": "在帖子到期期间保留直接消息", + "Notifications": "通知", + "ntfy URL": "ntfy 网址", + "ntfy topic": "ntfy 主题" } diff --git a/webapp_profile.py b/webapp_profile.py index 65063361b..f8b084284 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -2001,6 +2001,39 @@ def _html_edit_profile_contact_info(nickname: str, return edit_profile_form +def _html_edit_notifications(base_dir: str, nickname: str, domain: str, + translate: {}) -> str: + """Notifications settings + """ + ntfy_url = "ntfy.sh" + ntfy_topic = '' + + ntfy_url_file = \ + base_dir + '/accounts/' + nickname + '@' + domain + '/.ntfy_url' + ntfy_topic_file = \ + base_dir + '/accounts/' + nickname + '@' + domain + '/.ntfy_topic' + if os.path.isfile(ntfy_url_file): + try: + with open(ntfy_url_file, 'r', encoding='utf-8') as fp_ntfy: + ntfy_url = fp_ntfy.read() + except OSError: + print('EX: unable to read ' + ntfy_url_file) + if os.path.isfile(ntfy_topic_file): + try: + with open(ntfy_topic_file, 'r', encoding='utf-8') as fp_ntfy: + ntfy_topic = fp_ntfy.read() + except OSError: + print('EX: unable to read ' + ntfy_topic_file) + + edit_profile_form = begin_edit_section(translate['Notifications']) + edit_profile_form += edit_text_field(translate['ntfy URL'], + 'ntfyUrl', ntfy_url) + edit_profile_form += edit_text_field(translate['ntfy topic'], + 'ntfyTopic', ntfy_topic) + edit_profile_form += end_edit_section() + return edit_profile_form + + def _html_edit_profile_import_export(nickname: str, domain: str, translate: {}) -> str: """Contact Information section of edit profile screen @@ -2441,6 +2474,10 @@ def html_edit_profile(server, translate: {}, briar_address, cwtch_address, translate) + # notification settings + edit_profile_form += \ + _html_edit_notifications(base_dir, nickname, domain, translate) + # Import and export edit_profile_form += \ _html_edit_profile_import_export(nickname, domain, translate)