[feature] Allow exposing allows, implement /api/v1/domain_blocks and /api/v1/domain_allows (#4169)

- adds config flags `instance-expose-allowlist` and `instance-expose-allowlist-web` to allow instance admins to expose their allowlist via the web + api.
- renames `instance-expose-suspended` and `instance-expose-suspended-web` to  `instance-expose-blocklist` and `instance-expose-blocklist-web`.
- deprecates the `suspended` filter on `/api/v1/instance/peers` endpoint and adds `blocked` and `allowed` filters
- adds the `flat` query param to `/api/v1/instance/peers` to allow forcing return of a flat list of domains
- implements `/api/v1/instance/domain_blocks` and `/api/v1/instance/domain_allows` endpoints with or without auth depending on config
- rejigs the instance about page to include a general section on domain permissions, with block and allow subsections (and appropriate links)

Closes https://codeberg.org/superseriousbusiness/gotosocial/issues/3847
Closes https://codeberg.org/superseriousbusiness/gotosocial/issues/4150

Prerequisite to https://codeberg.org/superseriousbusiness/gotosocial/issues/3711

Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4169
Co-authored-by: tobi <tobi.smethurst@protonmail.com>
Co-committed-by: tobi <tobi.smethurst@protonmail.com>
This commit is contained in:
tobi 2025-05-20 11:47:40 +02:00 committed by kim
commit ec4d4d0115
23 changed files with 986 additions and 271 deletions

View file

@ -20,18 +20,17 @@
{{- with . }}
<main>
<section>
<h1>Suspended Instances</h1>
<h1>Instance Blocklist</h1>
<p>
The following list of domains have been suspended
by the administrator(s) of this server.
The following list of domains has been blocked by the administrator(s) of this instance.
</p>
<p>
All current and future accounts on these instances are
blocked, and no more data is federated to the remote servers.
This extends to subdomains, so an entry for 'example.com'
includes 'social.example.com' as well.
All past, present, and future accounts at blocked domains are forbidden from interacting
with this instance or accounts on this instance. No data will be sent to the server at the
remote domain, and no data will be received from it. This extends to subdomains, so a
blocklist entry for domain 'example.com' includes domain 'social.example.com' etc as well.
</p>
<div class="list domain-blocklist">
<div class="list domain-perm-list">
<div class="header entry">
<div class="domain">Domain</div>
<div class="public_comment">Public comment</div>
@ -42,7 +41,7 @@
<a class="text-cutoff" href="#{{- .Domain -}}" title="{{- .Domain -}}">{{- .Domain -}}</a>
</div>
<div class="public_comment">
<p>{{- .PublicComment -}}</p>
<p>{{- .Comment -}}</p>
</div>
</div>
{{- end }}