Discard messages from blocked servers

pull/52/head
Andrew Godwin 2022-11-25 18:11:31 -07:00
rodzic 8ca36fd958
commit 19909bdef0
2 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -150,6 +150,13 @@ class Inbox(View):
f"Inbox error: cannot fetch actor {document['actor']}"
)
return HttpResponseBadRequest("Cannot retrieve actor")
# See if it's from a blocked domain
if identity.domain.blocked:
# I love to lie! Throw it away!
exceptions.capture_message(
f"Inbox: Discarded message from {identity.domain}"
)
return HttpResponse(status=202)
# If there's a "signature" payload, verify against that
if "signature" in document:
try:

Wyświetl plik

@ -30,7 +30,7 @@ class FederationEdit(FormView):
class form_class(forms.Form):
blocked = forms.BooleanField(
help_text="If this domain is blocked from interacting with this server",
help_text="If this domain is blocked from interacting with this server.\nAll incoming posts from this domain will be irrecoverably dropped.",
widget=forms.Select(choices=[(True, "Blocked"), (False, "Not Blocked")]),
required=False,
)