Expose public libraries and channels in standard API

This commit is contained in:
Agate 2020-07-28 14:21:15 +02:00
parent 91dbfde3ea
commit eb66d4e3d2
8 changed files with 311 additions and 55 deletions

View file

@ -67,7 +67,7 @@ def get():
"instance__funkwhale_support_message_enabled"
),
"instanceSupportMessage": all_preferences.get("instance__support_message"),
"knownNodesListUrl": None,
"endpoints": {"knownNodes": None, "channels": None, "libraries": None},
},
}
@ -90,7 +90,14 @@ def get():
"downloads": {"total": statistics["downloads"]},
}
if not auth_required:
data["metadata"]["knownNodesListUrl"] = federation_utils.full_url(
data["metadata"]["endpoints"]["knownNodes"] = federation_utils.full_url(
reverse("api:v1:federation:domains-list")
)
if not auth_required and preferences.get("federation__public_index"):
data["metadata"]["endpoints"]["libraries"] = federation_utils.full_url(
reverse("federation:index:index-libraries")
)
data["metadata"]["endpoints"]["channels"] = federation_utils.full_url(
reverse("federation:index:index-channels")
)
return data