Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
pleroma
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
398
Issues
398
List
Boards
Labels
Service Desk
Milestones
Merge Requests
59
Merge Requests
59
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pleroma
pleroma
Commits
93638935
Verified
Commit
93638935
authored
Jul 29, 2020
by
Alex Gleason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SimpleMRF: :silence --> :followers_only
parent
2a99e7df
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
11 deletions
+11
-11
config/description.exs
config/description.exs
+1
-1
docs/configuration/cheatsheet.md
docs/configuration/cheatsheet.md
+1
-1
lib/pleroma/web/activity_pub/mrf/simple_policy.ex
lib/pleroma/web/activity_pub/mrf/simple_policy.ex
+5
-5
test/web/activity_pub/mrf/simple_policy_test.exs
test/web/activity_pub/mrf/simple_policy_test.exs
+4
-4
No files found.
config/description.exs
View file @
93638935
...
...
@@ -1525,7 +1525,7 @@
suggestions:
[
"example.com"
,
"*.example.com"
]
},
%{
key:
:
silence
,
key:
:
followers_only
,
type:
{
:list
,
:string
},
description:
"Force posts from the given instances to be visible by followers only"
,
suggestions:
[
"example.com"
,
"*.example.com"
]
...
...
docs/configuration/cheatsheet.md
View file @
93638935
...
...
@@ -122,7 +122,7 @@ To add configuration to your config file, you can copy it from the base config.
*
`federated_timeline_removal`
: List of instances to remove from Federated (aka The Whole Known Network) Timeline.
*
`reject`
: List of instances to reject any activities from.
*
`accept`
: List of instances to accept any activities from.
*
`
silence
`
: List of instances to force posts as followers-only.
*
`
followers_only
`
: List of instances to force posts as followers-only.
*
`report_removal`
: List of instances to reject reports from.
*
`avatar_removal`
: List of instances to strip avatars from.
*
`banner_removal`
: List of instances to strip banners from.
...
...
lib/pleroma/web/activity_pub/mrf/simple_policy.ex
View file @
93638935
...
...
@@ -109,13 +109,13 @@ defp check_ftl_removal(%{host: actor_host} = _actor_info, object) do
{
:ok
,
object
}
end
defp
check_
silence
(%{
host:
actor_host
}
=
_actor_info
,
object
)
do
silence
=
Config
.
get
([
:mrf_simple
,
:
silence
])
defp
check_
followers_only
(%{
host:
actor_host
}
=
_actor_info
,
object
)
do
followers_only
=
Config
.
get
([
:mrf_simple
,
:
followers_only
])
|>
MRF
.
subdomains_regex
()
object
=
with
true
<-
MRF
.
subdomain_match?
(
silence
,
actor_host
),
with
true
<-
MRF
.
subdomain_match?
(
followers_only
,
actor_host
),
user
<-
User
.
get_cached_by_ap_id
(
object
[
"actor"
])
do
# Don't use Map.get/3 intentionally, these must not be nil
fixed_to
=
object
[
"to"
]
||
[]
...
...
@@ -200,7 +200,7 @@ def filter(%{"actor" => actor} = object) do
{
:ok
,
object
}
<-
check_media_removal
(
actor_info
,
object
),
{
:ok
,
object
}
<-
check_media_nsfw
(
actor_info
,
object
),
{
:ok
,
object
}
<-
check_ftl_removal
(
actor_info
,
object
),
{
:ok
,
object
}
<-
check_
silence
(
actor_info
,
object
),
{
:ok
,
object
}
<-
check_
followers_only
(
actor_info
,
object
),
{
:ok
,
object
}
<-
check_report_removal
(
actor_info
,
object
)
do
{
:ok
,
object
}
else
...
...
test/web/activity_pub/mrf/simple_policy_test.exs
View file @
93638935
...
...
@@ -16,7 +16,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicyTest do
federated_timeline_removal:
[],
report_removal:
[],
reject:
[],
silence
:
[],
followers_only
:
[],
accept:
[],
avatar_removal:
[],
banner_removal:
[],
...
...
@@ -263,9 +263,9 @@ test "actor has a matching host" do
end
end
describe
"when :
silence
"
do
describe
"when :
followers_only
"
do
test
"is empty"
do
Config
.
put
([
:mrf_simple
,
:
silence
],
[])
Config
.
put
([
:mrf_simple
,
:
followers_only
],
[])
{
_
,
ftl_message
}
=
build_ftl_actor_and_message
()
local_message
=
build_local_message
()
...
...
@@ -296,7 +296,7 @@ test "has a matching host" do
|>
URI
.
parse
()
|>
Map
.
fetch!
(
:host
)
Config
.
put
([
:mrf_simple
,
:
silence
],
[
actor_domain
])
Config
.
put
([
:mrf_simple
,
:
followers_only
],
[
actor_domain
])
assert
{
:ok
,
new_activity
}
=
SimplePolicy
.
filter
(
activity
)
assert
actor
.
follower_address
in
new_activity
[
"to"
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment