mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-17 12:36:11 +00:00
Merge mrf_simple-reject with quarantine (#137)
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/137
This commit is contained in:
parent
e26388a01c
commit
ca000f8301
|
@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
### Changed
|
||||
- quarantining is now considered absolutely; public activities are no longer
|
||||
an exception.
|
||||
- also merged quarantine and mrf reject - quarantine is now deprecated
|
||||
- flavours:
|
||||
- amd64 is built for debian stable. Compatible with ubuntu 20.
|
||||
- ubuntu-jammy is built for... well, ubuntu 22 (LTS)
|
||||
|
|
|
@ -215,7 +215,6 @@ config :pleroma, :instance,
|
|||
],
|
||||
allow_relay: true,
|
||||
public: true,
|
||||
quarantined_instances: [],
|
||||
static_dir: "instance/static/",
|
||||
allowed_post_formats: [
|
||||
"text/plain",
|
||||
|
|
|
@ -691,7 +691,7 @@ config :pleroma, :config_description, [
|
|||
key_placeholder: "instance",
|
||||
value_placeholder: "reason",
|
||||
description:
|
||||
"List of ActivityPub instances where activities will not be sent, and the reason for doing so",
|
||||
"(Deprecated, will be removed in next release) List of ActivityPub instances where activities will not be sent, and the reason for doing so",
|
||||
suggestions: [
|
||||
{"quarantined.com", "Reason"},
|
||||
{"*.quarantined.com", "Reason"}
|
||||
|
|
|
@ -34,7 +34,7 @@ To add configuration to your config file, you can copy it from the base config.
|
|||
* `federation_reachability_timeout_days`: Timeout (in days) of each external federation target being unreachable prior to pausing federating to it.
|
||||
* `allow_relay`: Permits remote instances to subscribe to all public posts of your instance. This may increase the visibility of your instance.
|
||||
* `public`: Makes the client API in authenticated mode-only except for user-profiles. Useful for disabling the Local Timeline and The Whole Known Network. Note that there is a dependent setting restricting or allowing unauthenticated access to specific resources, see `restrict_unauthenticated` for more details.
|
||||
* `quarantined_instances`: ActivityPub instances where activities will not be sent. They can still reach there via other means, we just won't send them.
|
||||
* `quarantined_instances`: *DEPRECATED* ActivityPub instances where activities will not be sent. They can still reach there via other means, we just won't send them.
|
||||
* `allowed_post_formats`: MIME-type list of formats allowed to be posted (transformed into HTML).
|
||||
* `extended_nickname_format`: Set to `true` to use extended local nicknames format (allows underscores/dashes). This will break federation with
|
||||
older software for theses nicknames.
|
||||
|
@ -131,7 +131,7 @@ To add configuration to your config file, you can copy it from the base config.
|
|||
* `media_removal`: List of instances to strip media attachments from and the reason for doing so.
|
||||
* `media_nsfw`: List of instances to tag all media as NSFW (sensitive) from and the reason for doing so.
|
||||
* `federated_timeline_removal`: List of instances to remove from the Federated Timeline (aka The Whole Known Network) and the reason for doing so.
|
||||
* `reject`: List of instances to reject activities (except deletes) from and the reason for doing so.
|
||||
* `reject`: List of instances to reject activities (except deletes) from and the reason for doing so. Additionally prevents activities from being sent to that instance.
|
||||
* `accept`: List of instances to only accept activities (except deletes) from and the reason for doing so.
|
||||
* `followers_only`: Force posts from the given instances to be visible by followers only and the reason for doing so.
|
||||
* `report_removal`: List of instances to reject reports from and the reason for doing so.
|
||||
|
|
|
@ -17,7 +17,9 @@ defmodule Pleroma.Config.DeprecationWarnings do
|
|||
{[:instance, :mrf_transparency], [:mrf, :transparency],
|
||||
"\n* `config :pleroma, :instance, mrf_transparency` is now `config :pleroma, :mrf, transparency`"},
|
||||
{[:instance, :mrf_transparency_exclusions], [:mrf, :transparency_exclusions],
|
||||
"\n* `config :pleroma, :instance, mrf_transparency_exclusions` is now `config :pleroma, :mrf, transparency_exclusions`"}
|
||||
"\n* `config :pleroma, :instance, mrf_transparency_exclusions` is now `config :pleroma, :mrf, transparency_exclusions`"},
|
||||
{[:instance, :quarantined_instances], [:mrf_simple, :reject],
|
||||
"\n* `config :pleroma, :instance, :quarantined_instances` is now covered by `:pleroma, :mrf_simple, :reject`"}
|
||||
]
|
||||
|
||||
def check_simple_policy_tuples do
|
||||
|
@ -81,7 +83,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
|
|||
end
|
||||
|
||||
def check_quarantined_instances_tuples do
|
||||
has_strings = Config.get([:instance, :quarantined_instances]) |> Enum.any?(&is_binary/1)
|
||||
has_strings = Config.get([:instance, :quarantined_instances], []) |> Enum.any?(&is_binary/1)
|
||||
|
||||
if has_strings do
|
||||
Logger.warn("""
|
||||
|
|
|
@ -103,11 +103,16 @@ defmodule Pleroma.Web.ActivityPub.Publisher do
|
|||
end
|
||||
end
|
||||
|
||||
defp blocked_instances do
|
||||
Config.get([:instance, :quarantined_instances], []) ++
|
||||
Config.get([:mrf_simple, :reject], [])
|
||||
end
|
||||
|
||||
defp should_federate?(inbox) do
|
||||
%{host: host} = URI.parse(inbox)
|
||||
|
||||
quarantined_instances =
|
||||
Config.get([:instance, :quarantined_instances], [])
|
||||
blocked_instances()
|
||||
|> Pleroma.Web.ActivityPub.MRF.instance_list_from_tuples()
|
||||
|> Pleroma.Web.ActivityPub.MRF.subdomains_regex()
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
|
|||
setup_all do
|
||||
clear_config([:instance, :federating], true)
|
||||
clear_config([:instance, :quarantined_instances], [])
|
||||
clear_config([:mrf_simple, :reject], [])
|
||||
end
|
||||
|
||||
describe "gather_webfinger_links/1" do
|
||||
|
@ -270,12 +271,14 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
|
|||
end
|
||||
|
||||
describe "publish/2" do
|
||||
test_with_mock "doesn't publish any activity to quarantined instances.",
|
||||
test_with_mock "doesn't publish any activity to quarantined or rejected instances.",
|
||||
Pleroma.Web.Federator.Publisher,
|
||||
[:passthrough],
|
||||
[] do
|
||||
Config.put([:instance, :quarantined_instances], [{"domain.com", "some reason"}])
|
||||
|
||||
Config.put([:mrf_simple, :reject], [{"rejected.com", "some reason"}])
|
||||
|
||||
follower =
|
||||
insert(:user, %{
|
||||
local: false,
|
||||
|
@ -283,9 +286,18 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
|
|||
ap_enabled: true
|
||||
})
|
||||
|
||||
another_follower =
|
||||
insert(:user, %{
|
||||
local: false,
|
||||
inbox: "https://rejected.com/users/nick2/inbox",
|
||||
ap_enabled: true
|
||||
})
|
||||
|
||||
actor = insert(:user, follower_address: follower.ap_id)
|
||||
|
||||
{:ok, follower, actor} = Pleroma.User.follow(follower, actor)
|
||||
{:ok, _another_follower, actor} = Pleroma.User.follow(another_follower, actor)
|
||||
|
||||
actor = refresh_record(actor)
|
||||
|
||||
note_activity =
|
||||
|
@ -321,6 +333,22 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
|
|||
id: public_note_activity.data["id"]
|
||||
})
|
||||
)
|
||||
|
||||
assert not called(
|
||||
Pleroma.Web.Federator.Publisher.enqueue_one(Publisher, %{
|
||||
inbox: "https://rejected.com/users/nick2/inbox",
|
||||
actor_id: actor.id,
|
||||
id: note_activity.data["id"]
|
||||
})
|
||||
)
|
||||
|
||||
assert not called(
|
||||
Pleroma.Web.Federator.Publisher.enqueue_one(Publisher, %{
|
||||
inbox: "https://rejected.com/users/nick1/inbox",
|
||||
actor_id: actor.id,
|
||||
id: public_note_activity.data["id"]
|
||||
})
|
||||
)
|
||||
end
|
||||
|
||||
test_with_mock "Publishes a non-public activity to non-quarantined instances.",
|
||||
|
|
Loading…
Reference in a new issue