projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[#534] Federation publish requests status control (enforced 2xx response code check).
[akkoma]
/
lib
/
pleroma
/
web
/
activity_pub
/
mrf
/
hellthread_policy.ex
diff --git
a/lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex
b/lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex
index 0e09181263d2039564877301320cf6a7e89c3cb0..a3f516ae7fde83b0680c7ec6f9f98ad8c9a72a3c 100644
(file)
--- a/
lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex
+++ b/
lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex
@@
-1,15
+1,22
@@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.ActivityPub.MRF.HellthreadPolicy do
@behaviour Pleroma.Web.ActivityPub.MRF
@impl true
defmodule Pleroma.Web.ActivityPub.MRF.HellthreadPolicy do
@behaviour Pleroma.Web.ActivityPub.MRF
@impl true
- def filter(object) do
-
-
policy = Pleroma.Config.get(:mrf_hellthreadmitigation
)
+ def filter(
%{"type" => "Create"} =
object) do
+ threshold = Pleroma.Config.get([:mrf_hellthread, :threshold])
+
recipients = (object["to"] || []) ++ (object["cc"] || []
)
- if
(length(object["to"]) + length(object["cc"])) > Keyword.get(policy, :threshold)
do
+ if
length(recipients) > threshold
do
{:reject, nil}
else
{:ok, object}
end
end
{:reject, nil}
else
{:ok, object}
end
end
-end
\ No newline at end of file
+
+ @impl true
+ def filter(object), do: {:ok, object}
+end