mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-23 01:35:28 +00:00
Implement large thread filter
This commit is contained in:
parent
61a88a6757
commit
92362e1e22
|
@ -163,6 +163,8 @@ config :pleroma, :mrf_rejectnonpublic,
|
|||
allow_followersonly: false,
|
||||
allow_direct: false
|
||||
|
||||
config :pleroma, :mrf_hellthreadmitigation, threshold: 10
|
||||
|
||||
config :pleroma, :mrf_simple,
|
||||
media_removal: [],
|
||||
media_nsfw: [],
|
||||
|
|
15
lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex
Normal file
15
lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex
Normal file
|
@ -0,0 +1,15 @@
|
|||
defmodule Pleroma.Web.ActivityPub.MRF.HellthreadPolicy do
|
||||
@behaviour Pleroma.Web.ActivityPub.MRF
|
||||
|
||||
@impl true
|
||||
def filter(object) do
|
||||
|
||||
policy = Pleroma.Config.get(:mrf_hellthreadmitigation)
|
||||
|
||||
if (length(object["to"]) + length(object["cc"])) > Keyword.get(policy, :threshold) do
|
||||
{:reject, nil}
|
||||
else
|
||||
{:ok, object}
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue