From 6d7e714f9223f74b9f8dfecb3b3e0793a86050e2 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 29 Aug 2023 18:14:06 +0100 Subject: [PATCH] Warning about following --- daemon.py | 8 ++++++-- translations/ar.json | 3 ++- translations/bn.json | 3 ++- translations/ca.json | 3 ++- translations/cy.json | 3 ++- translations/de.json | 3 ++- translations/el.json | 3 ++- translations/en.json | 3 ++- translations/es.json | 3 ++- translations/fa.json | 3 ++- translations/fr.json | 3 ++- translations/ga.json | 3 ++- translations/he.json | 3 ++- translations/hi.json | 3 ++- translations/it.json | 3 ++- translations/ja.json | 3 ++- translations/ko.json | 3 ++- translations/ku.json | 3 ++- translations/nl.json | 3 ++- translations/oc.json | 3 ++- translations/pl.json | 3 ++- translations/pt.json | 3 ++- translations/ru.json | 3 ++- translations/sw.json | 3 ++- translations/tr.json | 3 ++- translations/uk.json | 3 ++- translations/yi.json | 3 ++- translations/zh.json | 3 ++- webapp_confirm.py | 12 +++++++++++- 29 files changed, 71 insertions(+), 30 deletions(-) diff --git a/daemon.py b/daemon.py index 0bb365580..a22c6522a 100644 --- a/daemon.py +++ b/daemon.py @@ -3671,7 +3671,9 @@ class PubServer(BaseHTTPRequestHandler): base_dir, users_path, options_actor, - options_avatar_url).encode('utf-8') + options_avatar_url, + chooser_nickname, + domain).encode('utf-8') msglen = len(msg) self._set_headers('text/html', msglen, cookie, calling_domain, False) @@ -3689,7 +3691,9 @@ class PubServer(BaseHTTPRequestHandler): base_dir, users_path, options_actor_moved, - options_avatar_url).encode('utf-8') + options_avatar_url, + chooser_nickname, + domain).encode('utf-8') if msg: msglen = len(msg) self._set_headers('text/html', msglen, diff --git a/translations/ar.json b/translations/ar.json index 655275693..d4509d99f 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -632,5 +632,6 @@ "Chat link": "رابط الدردشة", "Clear Cache": "مسح ذاكرة التخزين المؤقت", "Block military instances": "منع الحالات العسكرية", - "Display on your public profile": "عرض على ملفك الشخصي العام" + "Display on your public profile": "عرض على ملفك الشخصي العام", + "FollowWarning": "تحذير: قد يكون هذا المثيل يمنعك" } diff --git a/translations/bn.json b/translations/bn.json index 1fbfb9d3d..f9ab5704a 100644 --- a/translations/bn.json +++ b/translations/bn.json @@ -632,5 +632,6 @@ "Chat link": "চ্যাট লিঙ্ক", "Clear Cache": "ক্যাশে সাফ করুন", "Block military instances": "সামরিক দৃষ্টান্ত ব্লক করুন", - "Display on your public profile": "আপনার পাবলিক প্রোফাইলে প্রদর্শন করুন" + "Display on your public profile": "আপনার পাবলিক প্রোফাইলে প্রদর্শন করুন", + "FollowWarning": "সতর্কতা: এই উদাহরণটি আপনাকে অবরুদ্ধ করতে পারে" } diff --git a/translations/ca.json b/translations/ca.json index 819a236fa..2aaa985e5 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -632,5 +632,6 @@ "Chat link": "Enllaç de xat", "Clear Cache": "Netejar memòria cau", "Block military instances": "Bloquejar instàncies militars", - "Display on your public profile": "Mostra al teu perfil públic" + "Display on your public profile": "Mostra al teu perfil públic", + "FollowWarning": "ADVERTIMENT: aquesta instància pot estar bloquejant-vos" } diff --git a/translations/cy.json b/translations/cy.json index 836e5a930..060bbe4e0 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -632,5 +632,6 @@ "Chat link": "Dolen sgwrs", "Clear Cache": "Clirio Cache", "Block military instances": "Rhwystro achosion milwrol", - "Display on your public profile": "Arddangos ar eich proffil cyhoeddus" + "Display on your public profile": "Arddangos ar eich proffil cyhoeddus", + "FollowWarning": "RHYBUDD: efallai bod yr achos hwn yn eich rhwystro" } diff --git a/translations/de.json b/translations/de.json index c6660210b..8457be413 100644 --- a/translations/de.json +++ b/translations/de.json @@ -632,5 +632,6 @@ "Chat link": "Chat-Link", "Clear Cache": "Cache leeren", "Block military instances": "Militärische Instanzen blockieren", - "Display on your public profile": "Anzeige in Ihrem öffentlichen Profil" + "Display on your public profile": "Anzeige in Ihrem öffentlichen Profil", + "FollowWarning": "ACHTUNG: Diese Instanz blockiert Sie möglicherweise" } diff --git a/translations/el.json b/translations/el.json index bb667a268..8526dbd31 100644 --- a/translations/el.json +++ b/translations/el.json @@ -632,5 +632,6 @@ "Chat link": "Σύνδεσμος συνομιλίας", "Clear Cache": "Εκκαθάριση προσωρινής μνήμης", "Block military instances": "Αποκλεισμός στρατιωτικών περιπτώσεων", - "Display on your public profile": "Εμφάνιση στο δημόσιο προφίλ σας" + "Display on your public profile": "Εμφάνιση στο δημόσιο προφίλ σας", + "FollowWarning": "ΠΡΟΕΙΔΟΠΟΙΗΣΗ: αυτή η περίπτωση μπορεί να σας μπλοκάρει" } diff --git a/translations/en.json b/translations/en.json index 904b51694..7e92c4ee4 100644 --- a/translations/en.json +++ b/translations/en.json @@ -632,5 +632,6 @@ "Chat link": "Chat link", "Clear Cache": "Clear Cache", "Block military instances": "Block military instances", - "Display on your public profile": "Display on your public profile" + "Display on your public profile": "Display on your public profile", + "FollowWarning": "WARNING: this instance may be blocking you" } diff --git a/translations/es.json b/translations/es.json index 6a183092e..1893de5d6 100644 --- a/translations/es.json +++ b/translations/es.json @@ -632,5 +632,6 @@ "Chat link": "Enlace de chat", "Clear Cache": "Limpiar cache", "Block military instances": "Bloquear instancias militares", - "Display on your public profile": "Mostrar en su perfil público" + "Display on your public profile": "Mostrar en su perfil público", + "FollowWarning": "ADVERTENCIA: esta instancia puede estar bloqueándote" } diff --git a/translations/fa.json b/translations/fa.json index 75c41a93c..47d9896d6 100644 --- a/translations/fa.json +++ b/translations/fa.json @@ -632,5 +632,6 @@ "Chat link": "لینک چت", "Clear Cache": "پاک کردن حافظه پنهان", "Block military instances": "موارد نظامی را مسدود کنید", - "Display on your public profile": "نمایش در نمایه عمومی شما" + "Display on your public profile": "نمایش در نمایه عمومی شما", + "FollowWarning": "هشدار: این مورد ممکن است شما را مسدود کند" } diff --git a/translations/fr.json b/translations/fr.json index 48c00fa97..fe9a77dc0 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -632,5 +632,6 @@ "Chat link": "Lien de discussion", "Clear Cache": "Vider le cache", "Block military instances": "Bloquer les instances militaires", - "Display on your public profile": "Afficher sur votre profil public" + "Display on your public profile": "Afficher sur votre profil public", + "FollowWarning": "ATTENTION : cette instance peut vous bloquer" } diff --git a/translations/ga.json b/translations/ga.json index cc205b09c..187e18d0d 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -632,5 +632,6 @@ "Chat link": "Nasc comhrá", "Clear Cache": "Glan Taisce", "Block military instances": "Bloc cásanna míleata", - "Display on your public profile": "Taispeáin ar do phróifíl phoiblí" + "Display on your public profile": "Taispeáin ar do phróifíl phoiblí", + "FollowWarning": "RABHADH: seans go bhfuil an cás seo ag cur bac ort" } diff --git a/translations/he.json b/translations/he.json index 457856a48..828cf6f5e 100644 --- a/translations/he.json +++ b/translations/he.json @@ -632,5 +632,6 @@ "Chat link": "קישור לצ'אט", "Clear Cache": "נקה מטמון", "Block military instances": "חסום מקרים צבאיים", - "Display on your public profile": "הצג בפרופיל הציבורי שלך" + "Display on your public profile": "הצג בפרופיל הציבורי שלך", + "FollowWarning": "אזהרה: ייתכן שהמקרה הזה חוסם אותך" } diff --git a/translations/hi.json b/translations/hi.json index 22bf5c9da..318d3ceec 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -632,5 +632,6 @@ "Chat link": "चैट लिंक", "Clear Cache": "कैश को साफ़ करें", "Block military instances": "सैन्य उदाहरणों को ब्लॉक करें", - "Display on your public profile": "अपनी सार्वजनिक प्रोफ़ाइल पर प्रदर्शित करें" + "Display on your public profile": "अपनी सार्वजनिक प्रोफ़ाइल पर प्रदर्शित करें", + "FollowWarning": "चेतावनी: यह उदाहरण आपको अवरुद्ध कर सकता है" } diff --git a/translations/it.json b/translations/it.json index 08cc09a9e..e9d172f9d 100644 --- a/translations/it.json +++ b/translations/it.json @@ -632,5 +632,6 @@ "Chat link": "Collegamento alla chat", "Clear Cache": "Cancella cache", "Block military instances": "Blocca istanze militari", - "Display on your public profile": "Visualizza sul tuo profilo pubblico" + "Display on your public profile": "Visualizza sul tuo profilo pubblico", + "FollowWarning": "ATTENZIONE: questa istanza potrebbe bloccarti" } diff --git a/translations/ja.json b/translations/ja.json index 3cae37478..fa310bf9c 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -632,5 +632,6 @@ "Chat link": "チャットリンク", "Clear Cache": "キャッシュの消去", "Block military instances": "軍事インスタンスをブロックする", - "Display on your public profile": "公開プロフィールに表示する" + "Display on your public profile": "公開プロフィールに表示する", + "FollowWarning": "警告: このインスタンスはあなたをブロックしている可能性があります" } diff --git a/translations/ko.json b/translations/ko.json index 7cac95f05..4b13ea1d4 100644 --- a/translations/ko.json +++ b/translations/ko.json @@ -632,5 +632,6 @@ "Chat link": "채팅 링크", "Clear Cache": "캐시 지우기", "Block military instances": "군사 인스턴스 차단", - "Display on your public profile": "공개 프로필에 표시" + "Display on your public profile": "공개 프로필에 표시", + "FollowWarning": "경고: 이 인스턴스가 귀하를 차단하고 있을 수 있습니다." } diff --git a/translations/ku.json b/translations/ku.json index 6b8676b30..7de163aba 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -632,5 +632,6 @@ "Chat link": "Lînka chatê", "Clear Cache": "Cache paqij bike", "Block military instances": "Mînakên leşkerî asteng bikin", - "Display on your public profile": "Li ser profîla xweya giştî nîşan bidin" + "Display on your public profile": "Li ser profîla xweya giştî nîşan bidin", + "FollowWarning": "HIŞYARÎ: dibe ku ev mînak we asteng bike" } diff --git a/translations/nl.json b/translations/nl.json index 9257d78cd..bf7e9628b 100644 --- a/translations/nl.json +++ b/translations/nl.json @@ -632,5 +632,6 @@ "Chat link": "Chat-link", "Clear Cache": "Cache wissen", "Block military instances": "Blokkeer militaire instanties", - "Display on your public profile": "Weergave op uw openbare profiel" + "Display on your public profile": "Weergave op uw openbare profiel", + "FollowWarning": "WAARSCHUWING: deze instantie blokkeert u mogelijk" } diff --git a/translations/oc.json b/translations/oc.json index 7fa9008ac..ecb018377 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -628,5 +628,6 @@ "Chat link": "Chat link", "Clear Cache": "Clear Cache", "Block military instances": "Block military instances", - "Display on your public profile": "Display on your public profile" + "Display on your public profile": "Display on your public profile", + "FollowWarning": "WARNING: this instance may be blocking you" } diff --git a/translations/pl.json b/translations/pl.json index 20786aef4..47c8f588f 100644 --- a/translations/pl.json +++ b/translations/pl.json @@ -632,5 +632,6 @@ "Chat link": "Link do czatu", "Clear Cache": "Wyczyść pamięć podręczną", "Block military instances": "Blokuj instancje wojskowe", - "Display on your public profile": "Wyświetlaj na swoim profilu publicznym" + "Display on your public profile": "Wyświetlaj na swoim profilu publicznym", + "FollowWarning": "OSTRZEŻENIE: ta instancja może Cię blokować" } diff --git a/translations/pt.json b/translations/pt.json index 90fe8b3af..b246e1415 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -632,5 +632,6 @@ "Chat link": "Link de bate-papo", "Clear Cache": "Limpar cache", "Block military instances": "Bloquear instâncias militares", - "Display on your public profile": "Exibir em seu perfil público" + "Display on your public profile": "Exibir em seu perfil público", + "FollowWarning": "AVISO: esta instância pode estar bloqueando você" } diff --git a/translations/ru.json b/translations/ru.json index 86380ce4f..f670e4b09 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -632,5 +632,6 @@ "Chat link": "Ссылка на чат", "Clear Cache": "Очистить кэш", "Block military instances": "Блокировать военные инстансы", - "Display on your public profile": "Отобразить в своем общедоступном профиле" + "Display on your public profile": "Отобразить в своем общедоступном профиле", + "FollowWarning": "ВНИМАНИЕ: этот экземпляр может блокировать вас." } diff --git a/translations/sw.json b/translations/sw.json index 46c8fc1d1..bafe8e045 100644 --- a/translations/sw.json +++ b/translations/sw.json @@ -632,5 +632,6 @@ "Chat link": "Kiungo cha gumzo", "Clear Cache": "Futa Cache", "Block military instances": "Zuia matukio ya kijeshi", - "Display on your public profile": "Onyesha kwenye wasifu wako wa umma" + "Display on your public profile": "Onyesha kwenye wasifu wako wa umma", + "FollowWarning": "ONYO: mfano huu unaweza kuwa unakuzuia" } diff --git a/translations/tr.json b/translations/tr.json index 25b12a2d3..580ac535c 100644 --- a/translations/tr.json +++ b/translations/tr.json @@ -632,5 +632,6 @@ "Chat link": "Sohbet bağlantısı", "Clear Cache": "Önbelleği Temizle", "Block military instances": "Askeri örnekleri engelle", - "Display on your public profile": "Herkese açık profilinizde görüntüleyin" + "Display on your public profile": "Herkese açık profilinizde görüntüleyin", + "FollowWarning": "UYARI: bu örnek sizi engelliyor olabilir" } diff --git a/translations/uk.json b/translations/uk.json index 8df45cf6f..c75afe736 100644 --- a/translations/uk.json +++ b/translations/uk.json @@ -632,5 +632,6 @@ "Chat link": "Посилання на чат", "Clear Cache": "Очистити кеш", "Block military instances": "Блокувати військові інстанції", - "Display on your public profile": "Відображати у своєму публічному профілі" + "Display on your public profile": "Відображати у своєму публічному профілі", + "FollowWarning": "УВАГА: цей екземпляр може блокувати вас" } diff --git a/translations/yi.json b/translations/yi.json index 09edf12ed..a5557cff2 100644 --- a/translations/yi.json +++ b/translations/yi.json @@ -632,5 +632,6 @@ "Chat link": "שמועס לינק", "Clear Cache": "קלאָר קאַש", "Block military instances": "פאַרשפּאַרן מיליטעריש ינסטאַנסיז", - "Display on your public profile": "ווייַז אויף דיין עפנטלעך פּראָפיל" + "Display on your public profile": "ווייַז אויף דיין עפנטלעך פּראָפיל", + "FollowWarning": "ווארענונג: דעם בייַשפּיל קען פאַרשפּאַרן איר" } diff --git a/translations/zh.json b/translations/zh.json index 516d0aa74..e68c3fcdd 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -632,5 +632,6 @@ "Chat link": "聊天链接", "Clear Cache": "קלאָר קאַש", "Block military instances": "阻止军事实例", - "Display on your public profile": "显示在您的公开个人资料上" + "Display on your public profile": "显示在您的公开个人资料上", + "FollowWarning": "警告:此实例可能会阻止您" } diff --git a/webapp_confirm.py b/webapp_confirm.py index 35976b217..85c7b919f 100644 --- a/webapp_confirm.py +++ b/webapp_confirm.py @@ -18,6 +18,7 @@ from utils import get_config_param from utils import get_alt_path from utils import acct_dir from utils import get_account_timezone +from utils import text_in_file from webapp_utils import set_custom_background from webapp_utils import html_header_with_external_style from webapp_utils import html_footer @@ -203,7 +204,8 @@ def html_confirm_remove_shared_item(translate: {}, def html_confirm_follow(translate: {}, base_dir: str, origin_path_str: str, follow_actor: str, - follow_profile_url: str) -> str: + follow_profile_url: str, + nickname: str, domain: str) -> str: """Asks to confirm a follow """ follow_domain, _ = get_domain_from_actor(follow_actor) @@ -229,6 +231,14 @@ def html_confirm_follow(translate: {}, base_dir: str, 'src="' + follow_profile_url + '"/>\n' follow_actor_nick = get_nickname_from_actor(follow_actor) if follow_actor_nick and follow_domain: + send_block_filename = \ + acct_dir(base_dir, nickname, domain) + '/send_blocks.txt' + if os.path.isfile(send_block_filename): + if text_in_file('://' + follow_domain, + send_block_filename, False): + follow_str += \ + '

' + \ + translate['FollowWarning'] + '

\n' follow_str += \ '

' + translate['Follow'] + ' ' + \ follow_actor_nick + '@' + follow_domain + ' ?

\n'