- quarantined_instances =
- Config.get([:instance, :quarantined_instances], [])
- |> Pleroma.Web.ActivityPub.MRF.subdomains_regex()
+ defp allowed_instances do
+ Config.get([:mrf_simple, :accept])
+ end
+
+ def should_federate?(url) do
+ %{host: host} = URI.parse(url)
+
+ with allowed <- allowed_instances(),
+ false <- Enum.empty?(allowed) do
+ allowed
+ |> Pleroma.Web.ActivityPub.MRF.instance_list_from_tuples()
+ |> Pleroma.Web.ActivityPub.MRF.subdomains_regex()
+ |> Pleroma.Web.ActivityPub.MRF.subdomain_match?(host)
+ else
+ _ ->
+ quarantined_instances =
+ blocked_instances()
+ |> Pleroma.Web.ActivityPub.MRF.instance_list_from_tuples()
+ |> Pleroma.Web.ActivityPub.MRF.subdomains_regex()