nodeinfo reveals metadata based on domain requested

pull/628/head
D 2023-08-06 20:17:43 +00:00
rodzic a69499c742
commit 682ce7df19
1 zmienionych plików z 10 dodań i 3 usunięć

Wyświetl plik

@ -72,8 +72,15 @@ class NodeInfo2(View):
def get(self, request):
# Fetch some user stats
local_identities = Identity.objects.filter(local=True).count()
local_posts = Post.objects.filter(local=True).count()
if request.domain:
domain_config = Config.load_domain(request.domain)
local_identities = Identity.objects.filter(domain=request.domain).count()
local_posts = Post.objects.filter(author__domain=request.domain).count()
metadata = {"nodeName": domain_config.site_name}
else:
local_identities = Identity.objects.filter(local=True).count()
local_posts = Post.objects.filter(local=True).count()
metadata = {}
return JsonResponse(
{
"version": "2.0",
@ -85,7 +92,7 @@ class NodeInfo2(View):
"localPosts": local_posts,
},
"openRegistrations": Config.system.signup_allowed,
"metadata": {},
"metadata": metadata,
}
)