parent
d4a256b2f9
commit
36bbc5c0da
|
@ -1,4 +1,5 @@
|
|||
import json
|
||||
import logging
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
|
@ -18,6 +19,9 @@ from . import nodeinfo
|
|||
NODEINFO_2_CONTENT_TYPE = "application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.0#; charset=utf-8" # noqa
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class AdminSettings(preferences_viewsets.GlobalPreferencesViewSet):
|
||||
pagination_class = None
|
||||
permission_classes = [oauth_permissions.ScopePermission]
|
||||
|
@ -44,7 +48,11 @@ class NodeInfo(views.APIView):
|
|||
authentication_classes = []
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
data = nodeinfo.get()
|
||||
try:
|
||||
data = nodeinfo.get()
|
||||
except ValueError:
|
||||
logger.warn("nodeinfo returned invalid json")
|
||||
data = {}
|
||||
return Response(data, status=200, content_type=NODEINFO_2_CONTENT_TYPE)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue