diff --git a/daemon.py b/daemon.py index 784d041d0..12919075e 100644 --- a/daemon.py +++ b/daemon.py @@ -6612,6 +6612,32 @@ class PubServer(BaseHTTPRequestHandler): approve_followers actor_changed = True + # reject spam actors + reject_spam_actors = False + if fields.get('rejectSpamActors'): + if fields['rejectSpamActors'] == 'on': + reject_spam_actors = True + curr_reject_spam_actors = False + actor_spam_filter_filename = \ + acct_dir(base_dir, nickname, domain) + \ + '/.reject_spam_actors' + if os.path.isfile(actor_spam_filter_filename): + curr_reject_spam_actors = True + if reject_spam_actors != curr_reject_spam_actors: + if reject_spam_actors: + try: + with open(actor_spam_filter_filename, 'w+', + encoding='utf-8') as fp_spam: + fp_spam.write('\n') + except OSError: + print('EX: unable to write reject spam actors') + else: + try: + os.remove(actor_spam_filter_filename) + except OSError: + print('EX: ' + + 'unable to remove reject spam actors') + # keep DMs during post expiry expire_keep_dms = False if fields.get('expiryKeepDMs'): diff --git a/translations/ar.json b/translations/ar.json index 39f77aa6c..5b94f68fd 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -593,5 +593,6 @@ "Credentials are too long": "أوراق الاعتماد طويلة جدًا", "Site DevOps": "DevOps الموقع", "A list of devops nicknames. One per line.": "قائمة بأسماء المطورين. واحد في كل سطر.", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "رفض حسابات البريد العشوائي" } diff --git a/translations/bn.json b/translations/bn.json index 82d5a110f..bdd4de2eb 100644 --- a/translations/bn.json +++ b/translations/bn.json @@ -593,5 +593,6 @@ "Credentials are too long": "শংসাপত্রগুলি খুব দীর্ঘ৷", "Site DevOps": "সাইট DevOps", "A list of devops nicknames. One per line.": "ডেভপস ডাকনামের একটি তালিকা। প্রতি লাইনে একটি।", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "স্প্যাম অ্যাকাউন্ট প্রত্যাখ্যান করুন" } diff --git a/translations/ca.json b/translations/ca.json index a2a59a06e..1384007cc 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -593,5 +593,6 @@ "Credentials are too long": "Les credencials són massa llargues", "Site DevOps": "Lloc DevOps", "A list of devops nicknames. One per line.": "Una llista de sobrenoms de devops. Un per línia.", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "Rebutja els comptes de correu brossa" } diff --git a/translations/cy.json b/translations/cy.json index 39e1cbf74..1f7245ab7 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -593,5 +593,6 @@ "Credentials are too long": "Mae manylion yn rhy hir", "Site DevOps": "Gwefan DevOps", "A list of devops nicknames. One per line.": "Mae rhestr o devops llysenwau. Un i bob llinell.", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "Gwrthod cyfrifon sbam" } diff --git a/translations/de.json b/translations/de.json index ed54dc3ae..3e9b6f24b 100644 --- a/translations/de.json +++ b/translations/de.json @@ -593,5 +593,6 @@ "Credentials are too long": "Anmeldeinformationen sind zu lang", "Site DevOps": "Site-DevOps", "A list of devops nicknames. One per line.": "Eine Liste von Entwickler-Spitznamen. Eine pro Zeile.", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "Gwrthod cyfrifon sbam" } diff --git a/translations/el.json b/translations/el.json index ad9240814..809695903 100644 --- a/translations/el.json +++ b/translations/el.json @@ -593,5 +593,6 @@ "Credentials are too long": "Τα διαπιστευτήρια είναι πολύ μεγάλα", "Site DevOps": "DevOps ιστότοπου", "A list of devops nicknames. One per line.": "Μια λίστα με ψευδώνυμα devops. Ένα ανά γραμμή.", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "Gwrthod cyfrifon sbam" } diff --git a/translations/en.json b/translations/en.json index d6967f0b6..95bf94265 100644 --- a/translations/en.json +++ b/translations/en.json @@ -593,5 +593,6 @@ "Credentials are too long": "Credentials are too long", "Site DevOps": "Site DevOps", "A list of devops nicknames. One per line.": "A list of devops nicknames. One per line.", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "Reject spam accounts" } diff --git a/translations/es.json b/translations/es.json index 06df4acf8..bb1a16ffe 100644 --- a/translations/es.json +++ b/translations/es.json @@ -593,5 +593,6 @@ "Credentials are too long": "Las credenciales son demasiado largas", "Site DevOps": "DevOps del sitio", "A list of devops nicknames. One per line.": "Una lista de apodos de devops. Uno por línea.", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "Rechazar cuentas de spam" } diff --git a/translations/fr.json b/translations/fr.json index 429424bea..80924412a 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -593,5 +593,6 @@ "Credentials are too long": "Les identifiants sont trop longs", "Site DevOps": "DevOps du site", "A list of devops nicknames. One per line.": "Une liste de surnoms de devops. Un par ligne.", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "Rejeter les comptes de spam" } diff --git a/translations/ga.json b/translations/ga.json index bb98400ce..6109f82a2 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -593,5 +593,6 @@ "Credentials are too long": "Tá dintiúir ró-fhada", "Site DevOps": "Suíomh DevOps", "A list of devops nicknames. One per line.": "Tá liosta devops leasainmneacha. Ceann in aghaidh an líne.", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "Diúltaigh cuntais turscair" } diff --git a/translations/hi.json b/translations/hi.json index 175af9375..6c6bf7d86 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -593,5 +593,6 @@ "Credentials are too long": "क्रेडेंशियल बहुत लंबे हैं", "Site DevOps": "साइट देवऑप्स", "A list of devops nicknames. One per line.": "देवोप्स उपनामों की एक सूची। प्रति पंक्ति एक।", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "स्पैम खातों को अस्वीकार करें" } diff --git a/translations/it.json b/translations/it.json index 797328064..aa501515f 100644 --- a/translations/it.json +++ b/translations/it.json @@ -593,5 +593,6 @@ "Credentials are too long": "Le credenziali sono troppo lunghe", "Site DevOps": "Sito DevOps", "A list of devops nicknames. One per line.": "Un elenco di soprannomi devops. Uno per riga.", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "Rifiuta gli account spam" } diff --git a/translations/ja.json b/translations/ja.json index a54397066..7ad0ff780 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -593,5 +593,6 @@ "Credentials are too long": "資格情報が長すぎます", "Site DevOps": "サイト DevOps", "A list of devops nicknames. One per line.": "DevOps ニックネームのリスト。 1 行に 1 つ。", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "スパムアカウントを拒否" } diff --git a/translations/ko.json b/translations/ko.json index b6d213910..a287d2f72 100644 --- a/translations/ko.json +++ b/translations/ko.json @@ -593,5 +593,6 @@ "Credentials are too long": "자격 증명이 너무 깁니다.", "Site DevOps": "사이트 DevOps", "A list of devops nicknames. One per line.": "데브옵스 닉네임 목록입니다. 한 줄에 하나씩.", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "스팸 계정 거부" } diff --git a/translations/ku.json b/translations/ku.json index 9eb1d5a5b..4e915e40e 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -593,5 +593,6 @@ "Credentials are too long": "Bawernameyên pir dirêj in", "Site DevOps": "Malpera DevOps", "A list of devops nicknames. One per line.": "Lîsteya navên devops. Her rêzek yek.", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "Hesabên spam red bikin" } diff --git a/translations/nl.json b/translations/nl.json index 5f3fdbf05..dc6b7eb64 100644 --- a/translations/nl.json +++ b/translations/nl.json @@ -593,5 +593,6 @@ "Credentials are too long": "Inloggegevens zijn te lang", "Site DevOps": "Site DevOps", "A list of devops nicknames. One per line.": "Een lijst met devops-bijnamen. Een per regel.", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "Spamaccounts afwijzen" } diff --git a/translations/oc.json b/translations/oc.json index 2922914c8..25bfd8613 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -589,5 +589,6 @@ "Credentials are too long": "Credentials are too long", "Site DevOps": "Site DevOps", "A list of devops nicknames. One per line.": "A list of devops nicknames. One per line.", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "Reject spam accounts" } diff --git a/translations/pl.json b/translations/pl.json index 71449c430..077724aad 100644 --- a/translations/pl.json +++ b/translations/pl.json @@ -593,5 +593,6 @@ "Credentials are too long": "Poświadczenia są za długie", "Site DevOps": "Deweloperzy witryny", "A list of devops nicknames. One per line.": "Lista pseudonimów Devopa. Jeden na linię.", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "Odrzuć konta spamowe" } diff --git a/translations/pt.json b/translations/pt.json index 7fecd5e19..ae1b929c0 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -593,5 +593,6 @@ "Credentials are too long": "As credenciais são muito longas", "Site DevOps": "Site DevOps", "A list of devops nicknames. One per line.": "Uma lista de apelidos de devops. Um por linha.", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "Rejeitar contas de spam" } diff --git a/translations/ru.json b/translations/ru.json index 1b2d22ae7..5553be1a6 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -593,5 +593,6 @@ "Credentials are too long": "Учетные данные слишком длинные", "Site DevOps": "DevOps сайта", "A list of devops nicknames. One per line.": "Список псевдонимов devops. По одному на строку.", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "Отклонить спам-аккаунты" } diff --git a/translations/sw.json b/translations/sw.json index caedc04fa..19797f9c9 100644 --- a/translations/sw.json +++ b/translations/sw.json @@ -593,5 +593,6 @@ "Credentials are too long": "Kitambulisho ni kirefu sana", "Site DevOps": "Tovuti ya DevOps", "A list of devops nicknames. One per line.": "Orodha ya majina ya utani ya devops. Moja kwa kila mstari.", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "Kataa akaunti za barua taka" } diff --git a/translations/tr.json b/translations/tr.json index e8ab86a9b..10a912f0e 100644 --- a/translations/tr.json +++ b/translations/tr.json @@ -593,5 +593,6 @@ "Credentials are too long": "Kimlik bilgileri çok uzun", "Site DevOps": "Site DevOps", "A list of devops nicknames. One per line.": "Devops takma adlarının listesi. Her satıra bir tane.", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "Spam hesapları reddet" } diff --git a/translations/uk.json b/translations/uk.json index 9bfaeb396..f878b705d 100644 --- a/translations/uk.json +++ b/translations/uk.json @@ -593,5 +593,6 @@ "Credentials are too long": "Облікові дані задовгі", "Site DevOps": "Сайт DevOps", "A list of devops nicknames. One per line.": "Список ніків devops. По одному на рядок.", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "Відхилити спам-акаунти" } diff --git a/translations/yi.json b/translations/yi.json index 43588504b..90008d839 100644 --- a/translations/yi.json +++ b/translations/yi.json @@ -593,5 +593,6 @@ "Credentials are too long": "קראַדענטשאַלז זענען צו לאַנג", "Site DevOps": "וועבזייטל DevOps", "A list of devops nicknames. One per line.": "א רשימה פון דיוואָפּס ניקניימז. איינער פּער שורה.", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "אָפּוואַרפן ספּאַם אַקאַונץ" } diff --git a/translations/zh.json b/translations/zh.json index cd19651a4..1d435f276 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -593,5 +593,6 @@ "Credentials are too long": "凭据太长", "Site DevOps": "站点 DevOps", "A list of devops nicknames. One per line.": "devops 昵称列表。 每行一个。", - "devops": "devops" + "devops": "devops", + "Reject spam accounts": "拒绝垃圾邮件帐户" } diff --git a/webapp_profile.py b/webapp_profile.py index e6aeebe20..c352a61d8 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -2094,6 +2094,7 @@ def _html_edit_profile_encryption_keys(pgp_fingerprint: str, def _html_edit_profile_options(is_admin: bool, manually_approves_followers: str, + reject_spam_actors: str, is_bot: str, is_group: str, follow_dms: str, remove_twitter: str, notify_likes: str, notify_reactions: str, @@ -2106,6 +2107,9 @@ def _html_edit_profile_options(is_admin: bool, edit_profile_form += \ edit_check_box(translate['Approve follower requests'], 'approveFollowers', manually_approves_followers) + edit_profile_form += \ + edit_check_box(translate['Reject spam accounts'], + 'rejectSpamActors', reject_spam_actors) edit_profile_form += \ edit_check_box(translate['This is a bot account'], 'isBot', is_bot) @@ -2321,7 +2325,8 @@ def html_edit_profile(server, translate: {}, pgp_pub_key = enigma_pub_key = '' pgp_fingerprint = xmpp_address = matrix_address = '' ssb_address = blog_address = tox_address = '' - cwtch_address = briar_address = manually_approves_followers = '' + cwtch_address = briar_address = '' + manually_approves_followers = reject_spam_actors = '' actor_json = load_json(actor_filename) if actor_json: @@ -2354,6 +2359,11 @@ def html_edit_profile(server, translate: {}, manually_approves_followers = 'checked' else: manually_approves_followers = '' + reject_spam_actors = '' + actor_spam_filter_filename = \ + acct_dir(base_dir, nickname, domain) + '/.reject_spam_actors' + if os.path.isfile(actor_spam_filter_filename): + reject_spam_actors = 'checked' if actor_json.get('type'): if actor_json['type'] == 'Service': is_bot = 'checked' @@ -2469,6 +2479,7 @@ def html_edit_profile(server, translate: {}, # Option checkboxes edit_profile_form += \ _html_edit_profile_options(is_admin, manually_approves_followers, + reject_spam_actors, is_bot, is_group, follow_dms, remove_twitter, notify_likes, notify_reactions,