See #192: replaced old stats endpoint with nodeinfo

This commit is contained in:
Eliot Berriot 2018-05-07 22:09:03 +02:00
parent e31bed050e
commit b4ad7a4a71
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
7 changed files with 239 additions and 15 deletions

View file

@ -4,6 +4,9 @@ from rest_framework.response import Response
from dynamic_preferences.api import serializers
from dynamic_preferences.registries import global_preferences_registry
from funkwhale_api.common import preferences
from . import nodeinfo
from . import stats
@ -27,10 +30,12 @@ class InstanceSettings(views.APIView):
return Response(data, status=200)
class InstanceStats(views.APIView):
class NodeInfo(views.APIView):
permission_classes = []
authentication_classes = []
def get(self, request, *args, **kwargs):
data = stats.get()
if not preferences.get('instance__nodeinfo_enabled'):
return Response(status=404)
data = nodeinfo.get()
return Response(data, status=200)