mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-26 01:01:00 +00:00
Discard messages from blocked servers
This commit is contained in:
parent
8ca36fd958
commit
19909bdef0
2 changed files with 8 additions and 1 deletions
|
@ -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:
|
||||
|
|
|
@ -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,
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue