Settings for ntfy on edit profile screen

merge-requests/30/head
Bob Mottram 2022-08-19 11:13:53 +01:00
parent 0fc4528b69
commit cada004b22
27 changed files with 162 additions and 25 deletions

View File

@ -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'):

View File

@ -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"
}

View File

@ -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 বিষয়"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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 θέμα"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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": "एनटीएफई विषय"
}

View File

@ -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"
}

View File

@ -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 トピック"
}

View File

@ -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 주제"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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 тема"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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 טעמע"
}

View File

@ -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 主题"
}

View File

@ -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,9 @@ def html_edit_profile(server, translate: {},
briar_address,
cwtch_address, translate)
# notification settings
_html_edit_notifications(base_dir, nickname, domain, translate)
# Import and export
edit_profile_form += \
_html_edit_profile_import_export(nickname, domain, translate)