From cdc83881188daafe9bd004a171b338f2102a4ea1 Mon Sep 17 00:00:00 2001
From: Eliot Berriot <contact@eliotberriot.com>
Date: Tue, 8 May 2018 09:01:02 +0200
Subject: [PATCH] See #192: renamed name to nodeName, and include
 anonymousCanListen value as well

---
 api/funkwhale_api/instance/nodeinfo.py | 3 ++-
 api/tests/instance/test_nodeinfo.py    | 6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/api/funkwhale_api/instance/nodeinfo.py b/api/funkwhale_api/instance/nodeinfo.py
index c687b4ba..e267f197 100644
--- a/api/funkwhale_api/instance/nodeinfo.py
+++ b/api/funkwhale_api/instance/nodeinfo.py
@@ -32,10 +32,11 @@ def get():
         'metadata': {
             'shortDescription': preferences.get('instance__short_description'),
             'longDescription': preferences.get('instance__long_description'),
-            'name': preferences.get('instance__name'),
+            'nodeName': preferences.get('instance__name'),
             'library': {
                 'federationEnabled': preferences.get('federation__enabled'),
                 'federationNeedsApproval': preferences.get('federation__music_needs_approval'),
+                'anonymousCanListen': preferences.get('common__api_authentication_required'),
             },
         }
     }
diff --git a/api/tests/instance/test_nodeinfo.py b/api/tests/instance/test_nodeinfo.py
index b9c8c764..4ca1c43a 100644
--- a/api/tests/instance/test_nodeinfo.py
+++ b/api/tests/instance/test_nodeinfo.py
@@ -38,10 +38,11 @@ def test_nodeinfo_dump(preferences, mocker):
         'metadata': {
             'shortDescription': preferences['instance__short_description'],
             'longDescription': preferences['instance__long_description'],
-            'name': preferences['instance__name'],
+            'nodeName': preferences['instance__name'],
             'library': {
                 'federationEnabled': preferences['federation__enabled'],
                 'federationNeedsApproval': preferences['federation__music_needs_approval'],
+                'anonymousCanListen': preferences['common__api_authentication_required'],
                 'tracks': {
                     'total': stats['tracks'],
                 },
@@ -93,10 +94,11 @@ def test_nodeinfo_dump_stats_disabled(preferences, mocker):
         'metadata': {
             'shortDescription': preferences['instance__short_description'],
             'longDescription': preferences['instance__long_description'],
-            'name': preferences['instance__name'],
+            'nodeName': preferences['instance__name'],
             'library': {
                 'federationEnabled': preferences['federation__enabled'],
                 'federationNeedsApproval': preferences['federation__music_needs_approval'],
+                'anonymousCanListen': preferences['common__api_authentication_required'],
             },
         }
     }
-- 
GitLab