Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
relay
Commits
bc0914b5
Commit
bc0914b5
authored
Dec 04, 2020
by
Izalia Mae
Browse files
make software blocklist configurable
parent
f0e08f26
Changes
3
Hide whitespace changes
Inline
Side-by-side
relay.yaml.example
View file @
bc0914b5
...
...
@@ -21,4 +21,10 @@ ap:
whitelist:
- 'good-instance.example.com'
- 'another.good-instance.example.com'
block_relays: false
# uncomment the lines below to prevent certain activitypub software from posting
# to the relay (all known relays by default). this uses the software name in nodeinfo
#blocked_software:
#- 'activityrelay'
#- 'aoderelay'
#- 'social.seattle.wa.us-relay'
#- 'unciarelay'
relay/__init__.py
View file @
bc0914b5
...
...
@@ -23,7 +23,7 @@ def load_config():
'port'
:
int
(
yaml_file
.
get
(
'port'
,
8080
)),
'note'
:
yaml_file
.
get
(
'note'
,
'Make a note about your instance here.'
),
'ap'
:
{
'block
_relays'
:
yaml_file
[
'ap'
].
get
(
'block
_relays'
,
False
)
,
'block
ed_software'
:
[
v
.
lower
()
for
v
in
yaml_file
[
'ap'
].
get
(
'block
ed_software'
,
[])]
,
'blocked_instances'
:
yaml_file
[
'ap'
].
get
(
'blocked_instances'
,
[]),
'host'
:
yaml_file
[
'ap'
].
get
(
'host'
,
'localhost'
),
'whitelist'
:
yaml_file
[
'ap'
].
get
(
'whitelist'
,
[]),
...
...
@@ -35,7 +35,6 @@ def load_config():
CONFIG
=
load_config
()
from
.http_signatures
import
http_signatures_middleware
...
...
relay/actor.py
View file @
bc0914b5
...
...
@@ -318,10 +318,10 @@ async def inbox(request):
data
=
await
request
.
json
()
instance
=
urlsplit
(
data
[
'actor'
]).
hostname
if
AP_CONFIG
[
'block
_relays
'
]:
if
AP_CONFIG
[
'block
ed_software
'
]:
software
=
await
fetch_nodeinfo
(
instance
)
if
software
and
'relay'
in
software
.
lower
():
if
software
and
software
.
lower
()
in
AP_CONFIG
[
'blocked_software'
]
:
raise
aiohttp
.
web
.
HTTPUnauthorized
(
body
=
'relays have been blocked'
,
content_type
=
'text/plain'
)
if
'actor'
not
in
data
or
not
request
[
'validated'
]:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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