projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
in dev, allow dev FE
[akkoma]
/
lib
/
pleroma
/
web
/
activity_pub
/
mrf.ex
diff --git
a/lib/pleroma/web/activity_pub/mrf.ex
b/lib/pleroma/web/activity_pub/mrf.ex
index 7b7f446468e7f377107d9391a99b116dfb16b878..6ecd62c99e17f2ccbd4a0c0fb33bdb2050a34fbd 100644
(file)
--- a/
lib/pleroma/web/activity_pub/mrf.ex
+++ b/
lib/pleroma/web/activity_pub/mrf.ex
@@
-63,6
+63,12
@@
defmodule Pleroma.Web.ActivityPub.MRF do
@required_description_keys [:key, :related_policy]
@required_description_keys [:key, :related_policy]
+ def filter_one(policy, %{"type" => type} = message)
+ when type in ["Undo", "Block", "Delete"] and
+ policy != Pleroma.Web.ActivityPub.MRF.SimplePolicy do
+ {:ok, message}
+ end
+
def filter_one(policy, message) do
should_plug_history? =
if function_exported?(policy, :history_awareness, 0) do
def filter_one(policy, message) do
should_plug_history? =
if function_exported?(policy, :history_awareness, 0) do
@@
-140,7
+146,8
@@
defmodule Pleroma.Web.ActivityPub.MRF do
|> get_policies()
|> Enum.concat([
Pleroma.Web.ActivityPub.MRF.HashtagPolicy,
|> get_policies()
|> Enum.concat([
Pleroma.Web.ActivityPub.MRF.HashtagPolicy,
- Pleroma.Web.ActivityPub.MRF.InlineQuotePolicy
+ Pleroma.Web.ActivityPub.MRF.InlineQuotePolicy,
+ Pleroma.Web.ActivityPub.MRF.NormalizeMarkup
])
|> Enum.uniq()
end
])
|> Enum.uniq()
end
@@
-154,8
+161,17
@@
defmodule Pleroma.Web.ActivityPub.MRF do
# - https://extra.baddomain.net/
# Does NOT match the following:
# - https://maybebaddomain.net/
# - https://extra.baddomain.net/
# Does NOT match the following:
# - https://maybebaddomain.net/
+
+ # *.baddomain.net
+ def subdomain_regex("*." <> domain), do: subdomain_regex(domain)
+
+ # baddomain.net
def subdomain_regex(domain) do
def subdomain_regex(domain) do
- ~r/^(.+\.)?#{Regex.escape(domain)}$/i
+ if String.ends_with?(domain, ".*") do
+ ~r/^(.+\.)?#{Regex.escape(String.replace_suffix(domain, ".*", ""))}\.(.+)$/i
+ else
+ ~r/^(.+\.)?#{Regex.escape(domain)}$/i
+ end
end
@spec subdomains_regex([String.t()]) :: [Regex.t()]
end
@spec subdomains_regex([String.t()]) :: [Regex.t()]