Discard messages from blocked servers
This commit is contained in:
parent
8ca36fd958
commit
19909bdef0
@ -150,6 +150,13 @@ class Inbox(View):
|
|||||||
f"Inbox error: cannot fetch actor {document['actor']}"
|
f"Inbox error: cannot fetch actor {document['actor']}"
|
||||||
)
|
)
|
||||||
return HttpResponseBadRequest("Cannot retrieve 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 there's a "signature" payload, verify against that
|
||||||
if "signature" in document:
|
if "signature" in document:
|
||||||
try:
|
try:
|
||||||
|
@ -30,7 +30,7 @@ class FederationEdit(FormView):
|
|||||||
|
|
||||||
class form_class(forms.Form):
|
class form_class(forms.Form):
|
||||||
blocked = forms.BooleanField(
|
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")]),
|
widget=forms.Select(choices=[(True, "Blocked"), (False, "Not Blocked")]),
|
||||||
required=False,
|
required=False,
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user