mirror of https://gitlab.com/bashrc2/epicyon
Option to enable spam filtering of actors
parent
48db4f58a4
commit
410a77c98a
26
daemon.py
26
daemon.py
|
@ -6612,6 +6612,32 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
approve_followers
|
approve_followers
|
||||||
actor_changed = True
|
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
|
# keep DMs during post expiry
|
||||||
expire_keep_dms = False
|
expire_keep_dms = False
|
||||||
if fields.get('expiryKeepDMs'):
|
if fields.get('expiryKeepDMs'):
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "أوراق الاعتماد طويلة جدًا",
|
"Credentials are too long": "أوراق الاعتماد طويلة جدًا",
|
||||||
"Site DevOps": "DevOps الموقع",
|
"Site DevOps": "DevOps الموقع",
|
||||||
"A list of devops nicknames. One per line.": "قائمة بأسماء المطورين. واحد في كل سطر.",
|
"A list of devops nicknames. One per line.": "قائمة بأسماء المطورين. واحد في كل سطر.",
|
||||||
"devops": "devops"
|
"devops": "devops",
|
||||||
|
"Reject spam accounts", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "শংসাপত্রগুলি খুব দীর্ঘ৷",
|
"Credentials are too long": "শংসাপত্রগুলি খুব দীর্ঘ৷",
|
||||||
"Site DevOps": "সাইট DevOps",
|
"Site DevOps": "সাইট DevOps",
|
||||||
"A list of devops nicknames. One per line.": "ডেভপস ডাকনামের একটি তালিকা। প্রতি লাইনে একটি।",
|
"A list of devops nicknames. One per line.": "ডেভপস ডাকনামের একটি তালিকা। প্রতি লাইনে একটি।",
|
||||||
"devops": "devops"
|
"devops": "devops",
|
||||||
|
"Reject spam accounts", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "Les credencials són massa llargues",
|
"Credentials are too long": "Les credencials són massa llargues",
|
||||||
"Site DevOps": "Lloc DevOps",
|
"Site DevOps": "Lloc DevOps",
|
||||||
"A list of devops nicknames. One per line.": "Una llista de sobrenoms de devops. Un per línia.",
|
"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", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "Mae manylion yn rhy hir",
|
"Credentials are too long": "Mae manylion yn rhy hir",
|
||||||
"Site DevOps": "Gwefan DevOps",
|
"Site DevOps": "Gwefan DevOps",
|
||||||
"A list of devops nicknames. One per line.": "Mae rhestr o devops llysenwau. Un i bob llinell.",
|
"A list of devops nicknames. One per line.": "Mae rhestr o devops llysenwau. Un i bob llinell.",
|
||||||
"devops": "devops"
|
"devops": "devops",
|
||||||
|
"Reject spam accounts", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "Anmeldeinformationen sind zu lang",
|
"Credentials are too long": "Anmeldeinformationen sind zu lang",
|
||||||
"Site DevOps": "Site-DevOps",
|
"Site DevOps": "Site-DevOps",
|
||||||
"A list of devops nicknames. One per line.": "Eine Liste von Entwickler-Spitznamen. Eine pro Zeile.",
|
"A list of devops nicknames. One per line.": "Eine Liste von Entwickler-Spitznamen. Eine pro Zeile.",
|
||||||
"devops": "devops"
|
"devops": "devops",
|
||||||
|
"Reject spam accounts", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "Τα διαπιστευτήρια είναι πολύ μεγάλα",
|
"Credentials are too long": "Τα διαπιστευτήρια είναι πολύ μεγάλα",
|
||||||
"Site DevOps": "DevOps ιστότοπου",
|
"Site DevOps": "DevOps ιστότοπου",
|
||||||
"A list of devops nicknames. One per line.": "Μια λίστα με ψευδώνυμα devops. Ένα ανά γραμμή.",
|
"A list of devops nicknames. One per line.": "Μια λίστα με ψευδώνυμα devops. Ένα ανά γραμμή.",
|
||||||
"devops": "devops"
|
"devops": "devops",
|
||||||
|
"Reject spam accounts", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "Credentials are too long",
|
"Credentials are too long": "Credentials are too long",
|
||||||
"Site DevOps": "Site DevOps",
|
"Site DevOps": "Site DevOps",
|
||||||
"A list of devops nicknames. One per line.": "A list of devops nicknames. One per line.",
|
"A list of devops nicknames. One per line.": "A list of devops nicknames. One per line.",
|
||||||
"devops": "devops"
|
"devops": "devops",
|
||||||
|
"Reject spam accounts", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "Las credenciales son demasiado largas",
|
"Credentials are too long": "Las credenciales son demasiado largas",
|
||||||
"Site DevOps": "DevOps del sitio",
|
"Site DevOps": "DevOps del sitio",
|
||||||
"A list of devops nicknames. One per line.": "Una lista de apodos de devops. Uno por línea.",
|
"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", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "Les identifiants sont trop longs",
|
"Credentials are too long": "Les identifiants sont trop longs",
|
||||||
"Site DevOps": "DevOps du site",
|
"Site DevOps": "DevOps du site",
|
||||||
"A list of devops nicknames. One per line.": "Une liste de surnoms de devops. Un par ligne.",
|
"A list of devops nicknames. One per line.": "Une liste de surnoms de devops. Un par ligne.",
|
||||||
"devops": "devops"
|
"devops": "devops",
|
||||||
|
"Reject spam accounts", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "Tá dintiúir ró-fhada",
|
"Credentials are too long": "Tá dintiúir ró-fhada",
|
||||||
"Site DevOps": "Suíomh DevOps",
|
"Site DevOps": "Suíomh DevOps",
|
||||||
"A list of devops nicknames. One per line.": "Tá liosta devops leasainmneacha. Ceann in aghaidh an líne.",
|
"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", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -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", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "Le credenziali sono troppo lunghe",
|
"Credentials are too long": "Le credenziali sono troppo lunghe",
|
||||||
"Site DevOps": "Sito DevOps",
|
"Site DevOps": "Sito DevOps",
|
||||||
"A list of devops nicknames. One per line.": "Un elenco di soprannomi devops. Uno per riga.",
|
"A list of devops nicknames. One per line.": "Un elenco di soprannomi devops. Uno per riga.",
|
||||||
"devops": "devops"
|
"devops": "devops",
|
||||||
|
"Reject spam accounts", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "資格情報が長すぎます",
|
"Credentials are too long": "資格情報が長すぎます",
|
||||||
"Site DevOps": "サイト DevOps",
|
"Site DevOps": "サイト DevOps",
|
||||||
"A list of devops nicknames. One per line.": "DevOps ニックネームのリスト。 1 行に 1 つ。",
|
"A list of devops nicknames. One per line.": "DevOps ニックネームのリスト。 1 行に 1 つ。",
|
||||||
"devops": "devops"
|
"devops": "devops",
|
||||||
|
"Reject spam accounts", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "자격 증명이 너무 깁니다.",
|
"Credentials are too long": "자격 증명이 너무 깁니다.",
|
||||||
"Site DevOps": "사이트 DevOps",
|
"Site DevOps": "사이트 DevOps",
|
||||||
"A list of devops nicknames. One per line.": "데브옵스 닉네임 목록입니다. 한 줄에 하나씩.",
|
"A list of devops nicknames. One per line.": "데브옵스 닉네임 목록입니다. 한 줄에 하나씩.",
|
||||||
"devops": "devops"
|
"devops": "devops",
|
||||||
|
"Reject spam accounts", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "Bawernameyên pir dirêj in",
|
"Credentials are too long": "Bawernameyên pir dirêj in",
|
||||||
"Site DevOps": "Malpera DevOps",
|
"Site DevOps": "Malpera DevOps",
|
||||||
"A list of devops nicknames. One per line.": "Lîsteya navên devops. Her rêzek yek.",
|
"A list of devops nicknames. One per line.": "Lîsteya navên devops. Her rêzek yek.",
|
||||||
"devops": "devops"
|
"devops": "devops",
|
||||||
|
"Reject spam accounts", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "Inloggegevens zijn te lang",
|
"Credentials are too long": "Inloggegevens zijn te lang",
|
||||||
"Site DevOps": "Site DevOps",
|
"Site DevOps": "Site DevOps",
|
||||||
"A list of devops nicknames. One per line.": "Een lijst met devops-bijnamen. Een per regel.",
|
"A list of devops nicknames. One per line.": "Een lijst met devops-bijnamen. Een per regel.",
|
||||||
"devops": "devops"
|
"devops": "devops",
|
||||||
|
"Reject spam accounts", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -589,5 +589,6 @@
|
||||||
"Credentials are too long": "Credentials are too long",
|
"Credentials are too long": "Credentials are too long",
|
||||||
"Site DevOps": "Site DevOps",
|
"Site DevOps": "Site DevOps",
|
||||||
"A list of devops nicknames. One per line.": "A list of devops nicknames. One per line.",
|
"A list of devops nicknames. One per line.": "A list of devops nicknames. One per line.",
|
||||||
"devops": "devops"
|
"devops": "devops",
|
||||||
|
"Reject spam accounts", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "Poświadczenia są za długie",
|
"Credentials are too long": "Poświadczenia są za długie",
|
||||||
"Site DevOps": "Deweloperzy witryny",
|
"Site DevOps": "Deweloperzy witryny",
|
||||||
"A list of devops nicknames. One per line.": "Lista pseudonimów Devopa. Jeden na linię.",
|
"A list of devops nicknames. One per line.": "Lista pseudonimów Devopa. Jeden na linię.",
|
||||||
"devops": "devops"
|
"devops": "devops",
|
||||||
|
"Reject spam accounts", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "As credenciais são muito longas",
|
"Credentials are too long": "As credenciais são muito longas",
|
||||||
"Site DevOps": "Site DevOps",
|
"Site DevOps": "Site DevOps",
|
||||||
"A list of devops nicknames. One per line.": "Uma lista de apelidos de devops. Um por linha.",
|
"A list of devops nicknames. One per line.": "Uma lista de apelidos de devops. Um por linha.",
|
||||||
"devops": "devops"
|
"devops": "devops",
|
||||||
|
"Reject spam accounts", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "Учетные данные слишком длинные",
|
"Credentials are too long": "Учетные данные слишком длинные",
|
||||||
"Site DevOps": "DevOps сайта",
|
"Site DevOps": "DevOps сайта",
|
||||||
"A list of devops nicknames. One per line.": "Список псевдонимов devops. По одному на строку.",
|
"A list of devops nicknames. One per line.": "Список псевдонимов devops. По одному на строку.",
|
||||||
"devops": "devops"
|
"devops": "devops",
|
||||||
|
"Reject spam accounts", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "Kitambulisho ni kirefu sana",
|
"Credentials are too long": "Kitambulisho ni kirefu sana",
|
||||||
"Site DevOps": "Tovuti ya DevOps",
|
"Site DevOps": "Tovuti ya DevOps",
|
||||||
"A list of devops nicknames. One per line.": "Orodha ya majina ya utani ya devops. Moja kwa kila mstari.",
|
"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", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "Kimlik bilgileri çok uzun",
|
"Credentials are too long": "Kimlik bilgileri çok uzun",
|
||||||
"Site DevOps": "Site DevOps",
|
"Site DevOps": "Site DevOps",
|
||||||
"A list of devops nicknames. One per line.": "Devops takma adlarının listesi. Her satıra bir tane.",
|
"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", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "Облікові дані задовгі",
|
"Credentials are too long": "Облікові дані задовгі",
|
||||||
"Site DevOps": "Сайт DevOps",
|
"Site DevOps": "Сайт DevOps",
|
||||||
"A list of devops nicknames. One per line.": "Список ніків devops. По одному на рядок.",
|
"A list of devops nicknames. One per line.": "Список ніків devops. По одному на рядок.",
|
||||||
"devops": "devops"
|
"devops": "devops",
|
||||||
|
"Reject spam accounts", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "קראַדענטשאַלז זענען צו לאַנג",
|
"Credentials are too long": "קראַדענטשאַלז זענען צו לאַנג",
|
||||||
"Site DevOps": "וועבזייטל DevOps",
|
"Site DevOps": "וועבזייטל DevOps",
|
||||||
"A list of devops nicknames. One per line.": "א רשימה פון דיוואָפּס ניקניימז. איינער פּער שורה.",
|
"A list of devops nicknames. One per line.": "א רשימה פון דיוואָפּס ניקניימז. איינער פּער שורה.",
|
||||||
"devops": "devops"
|
"devops": "devops",
|
||||||
|
"Reject spam accounts", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,5 +593,6 @@
|
||||||
"Credentials are too long": "凭据太长",
|
"Credentials are too long": "凭据太长",
|
||||||
"Site DevOps": "站点 DevOps",
|
"Site DevOps": "站点 DevOps",
|
||||||
"A list of devops nicknames. One per line.": "devops 昵称列表。 每行一个。",
|
"A list of devops nicknames. One per line.": "devops 昵称列表。 每行一个。",
|
||||||
"devops": "devops"
|
"devops": "devops",
|
||||||
|
"Reject spam accounts", ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -2094,6 +2094,7 @@ def _html_edit_profile_encryption_keys(pgp_fingerprint: str,
|
||||||
|
|
||||||
def _html_edit_profile_options(is_admin: bool,
|
def _html_edit_profile_options(is_admin: bool,
|
||||||
manually_approves_followers: str,
|
manually_approves_followers: str,
|
||||||
|
reject_spam_actors: str,
|
||||||
is_bot: str, is_group: str,
|
is_bot: str, is_group: str,
|
||||||
follow_dms: str, remove_twitter: str,
|
follow_dms: str, remove_twitter: str,
|
||||||
notify_likes: str, notify_reactions: str,
|
notify_likes: str, notify_reactions: str,
|
||||||
|
@ -2106,6 +2107,9 @@ def _html_edit_profile_options(is_admin: bool,
|
||||||
edit_profile_form += \
|
edit_profile_form += \
|
||||||
edit_check_box(translate['Approve follower requests'],
|
edit_check_box(translate['Approve follower requests'],
|
||||||
'approveFollowers', manually_approves_followers)
|
'approveFollowers', manually_approves_followers)
|
||||||
|
edit_profile_form += \
|
||||||
|
edit_check_box(translate['Reject spam accounts'],
|
||||||
|
'rejectSpamActors', reject_spam_actors)
|
||||||
edit_profile_form += \
|
edit_profile_form += \
|
||||||
edit_check_box(translate['This is a bot account'],
|
edit_check_box(translate['This is a bot account'],
|
||||||
'isBot', is_bot)
|
'isBot', is_bot)
|
||||||
|
@ -2321,7 +2325,8 @@ def html_edit_profile(server, translate: {},
|
||||||
pgp_pub_key = enigma_pub_key = ''
|
pgp_pub_key = enigma_pub_key = ''
|
||||||
pgp_fingerprint = xmpp_address = matrix_address = ''
|
pgp_fingerprint = xmpp_address = matrix_address = ''
|
||||||
ssb_address = blog_address = tox_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)
|
actor_json = load_json(actor_filename)
|
||||||
if actor_json:
|
if actor_json:
|
||||||
|
@ -2354,6 +2359,11 @@ def html_edit_profile(server, translate: {},
|
||||||
manually_approves_followers = 'checked'
|
manually_approves_followers = 'checked'
|
||||||
else:
|
else:
|
||||||
manually_approves_followers = ''
|
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.get('type'):
|
||||||
if actor_json['type'] == 'Service':
|
if actor_json['type'] == 'Service':
|
||||||
is_bot = 'checked'
|
is_bot = 'checked'
|
||||||
|
@ -2469,6 +2479,7 @@ def html_edit_profile(server, translate: {},
|
||||||
# Option checkboxes
|
# Option checkboxes
|
||||||
edit_profile_form += \
|
edit_profile_form += \
|
||||||
_html_edit_profile_options(is_admin, manually_approves_followers,
|
_html_edit_profile_options(is_admin, manually_approves_followers,
|
||||||
|
reject_spam_actors,
|
||||||
is_bot, is_group, follow_dms,
|
is_bot, is_group, follow_dms,
|
||||||
remove_twitter,
|
remove_twitter,
|
||||||
notify_likes, notify_reactions,
|
notify_likes, notify_reactions,
|
||||||
|
|
Loading…
Reference in New Issue