mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 00:09:17 +02:00
See #853: advertise allow-list configuration in nodeinfo
This commit is contained in:
parent
38a8e998fd
commit
581e890ad9
2 changed files with 34 additions and 1 deletions
|
@ -2,7 +2,7 @@ import memoize.djangocache
|
|||
|
||||
import funkwhale_api
|
||||
from funkwhale_api.common import preferences
|
||||
from funkwhale_api.federation import actors
|
||||
from funkwhale_api.federation import actors, models as federation_models
|
||||
from funkwhale_api.music import utils as music_utils
|
||||
|
||||
from . import stats
|
||||
|
@ -13,6 +13,16 @@ memo = memoize.Memoizer(store, namespace="instance:stats")
|
|||
|
||||
def get():
|
||||
share_stats = preferences.get("instance__nodeinfo_stats_enabled")
|
||||
allow_list_enabled = preferences.get("moderation__allow_list_enabled")
|
||||
allow_list_public = preferences.get("moderation__allow_list_public")
|
||||
if allow_list_enabled and allow_list_public:
|
||||
allowed_domains = list(
|
||||
federation_models.Domain.objects.filter(allowed=True)
|
||||
.order_by("name")
|
||||
.values_list("name", flat=True)
|
||||
)
|
||||
else:
|
||||
allowed_domains = None
|
||||
data = {
|
||||
"version": "2.0",
|
||||
"software": {"name": "funkwhale", "version": funkwhale_api.__version__},
|
||||
|
@ -36,6 +46,7 @@ def get():
|
|||
),
|
||||
},
|
||||
"supportedUploadExtensions": music_utils.SUPPORTED_EXTENSIONS,
|
||||
"allowList": {"enabled": allow_list_enabled, "domains": allowed_domains},
|
||||
},
|
||||
}
|
||||
if share_stats:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue