forked from mirrors/bookwyrm
Updates nodeinfo and api info
This commit is contained in:
parent
e21d59386c
commit
01f7d2ac44
1 changed files with 13 additions and 10 deletions
|
@ -71,6 +71,8 @@ def nodeinfo(request):
|
||||||
local=True,
|
local=True,
|
||||||
last_active_date__gt=six_months_ago
|
last_active_date__gt=six_months_ago
|
||||||
).count()
|
).count()
|
||||||
|
|
||||||
|
site = models.SiteSettings.get()
|
||||||
return JsonResponse({
|
return JsonResponse({
|
||||||
'version': '2.0',
|
'version': '2.0',
|
||||||
'software': {
|
'software': {
|
||||||
|
@ -88,33 +90,34 @@ def nodeinfo(request):
|
||||||
},
|
},
|
||||||
'localPosts': status_count,
|
'localPosts': status_count,
|
||||||
},
|
},
|
||||||
'openRegistrations': True,
|
'openRegistrations': site.allow_registration,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def instance_info(request):
|
def instance_info(request):
|
||||||
''' what this place is TODO: should be settable/editable '''
|
''' let's talk about your cool unique instance '''
|
||||||
if request.method != 'GET':
|
if request.method != 'GET':
|
||||||
return HttpResponseNotFound()
|
return HttpResponseNotFound()
|
||||||
|
|
||||||
user_count = models.User.objects.count()
|
user_count = models.User.objects.filter(local=True).count()
|
||||||
status_count = models.Status.objects.count()
|
status_count = models.Status.objects.filter(user__local=True).count()
|
||||||
|
|
||||||
|
site = models.SiteSettings.get()
|
||||||
return JsonResponse({
|
return JsonResponse({
|
||||||
'uri': DOMAIN,
|
'uri': DOMAIN,
|
||||||
'title': 'BookWyrm',
|
'title': site.name,
|
||||||
'short_description': 'Social reading, decentralized',
|
'short_description': '',
|
||||||
'description': '',
|
'description': site.instance_description,
|
||||||
'email': 'mousereeve@riseup.net',
|
|
||||||
'version': '0.0.1',
|
'version': '0.0.1',
|
||||||
'stats': {
|
'stats': {
|
||||||
'user_count': user_count,
|
'user_count': user_count,
|
||||||
'status_count': status_count,
|
'status_count': status_count,
|
||||||
},
|
},
|
||||||
'thumbnail': '', # TODO: logo thumbnail
|
'thumbnail': 'https://%s/static/images/logo.png' % DOMAIN,
|
||||||
'languages': [
|
'languages': [
|
||||||
'en'
|
'en'
|
||||||
],
|
],
|
||||||
'registrations': True,
|
'registrations': site.allow_registration,
|
||||||
'approval_required': False,
|
'approval_required': False,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue