fix(api): openSubsonic not returning as boolean NOCHANGELOG

This commit is contained in:
Marie 2025-06-02 14:35:28 +02:00 committed by petitminion
parent 0bf217dbcd
commit 611631213a
2 changed files with 6 additions and 5 deletions

View File

@ -42,7 +42,7 @@ def structure_payload(data):
"status": "ok", "status": "ok",
"type": "funkwhale", "type": "funkwhale",
"version": "1.16.0", "version": "1.16.0",
"openSubsonic": "true", "openSubsonic": True,
} }
payload.update(data) payload.update(data)
if "detail" in payload: if "detail" in payload:
@ -70,6 +70,7 @@ class SubsonicXMLRenderer(renderers.JSONRenderer):
return super().render(data, accepted_media_type, renderer_context) return super().render(data, accepted_media_type, renderer_context)
final = structure_payload(data) final = structure_payload(data)
final["xmlns"] = "http://subsonic.org/restapi" final["xmlns"] = "http://subsonic.org/restapi"
final["openSubsonic"] = "true"
tree = dict_to_xml_tree("subsonic-response", final) tree = dict_to_xml_tree("subsonic-response", final)
return b'<?xml version="1.0" encoding="UTF-8"?>\n' + ET.tostring( return b'<?xml version="1.0" encoding="UTF-8"?>\n' + ET.tostring(
tree, encoding="utf-8" tree, encoding="utf-8"

View File

@ -18,7 +18,7 @@ from funkwhale_api.subsonic import renderers
"type": "funkwhale", "type": "funkwhale",
"funkwhaleVersion": funkwhale_api.__version__, "funkwhaleVersion": funkwhale_api.__version__,
"serverVersion": funkwhale_api.__version__, "serverVersion": funkwhale_api.__version__,
"openSubsonic": "true", "openSubsonic": True,
"hello": "world", "hello": "world",
}, },
), ),
@ -33,7 +33,7 @@ from funkwhale_api.subsonic import renderers
"type": "funkwhale", "type": "funkwhale",
"funkwhaleVersion": funkwhale_api.__version__, "funkwhaleVersion": funkwhale_api.__version__,
"serverVersion": funkwhale_api.__version__, "serverVersion": funkwhale_api.__version__,
"openSubsonic": "true", "openSubsonic": True,
"hello": "world", "hello": "world",
"error": {"code": 10, "message": "something went wrong"}, "error": {"code": 10, "message": "something went wrong"},
}, },
@ -46,7 +46,7 @@ from funkwhale_api.subsonic import renderers
"type": "funkwhale", "type": "funkwhale",
"funkwhaleVersion": funkwhale_api.__version__, "funkwhaleVersion": funkwhale_api.__version__,
"serverVersion": funkwhale_api.__version__, "serverVersion": funkwhale_api.__version__,
"openSubsonic": "true", "openSubsonic": True,
"hello": "world", "hello": "world",
"error": {"code": 0, "message": "something went wrong"}, "error": {"code": 0, "message": "something went wrong"},
}, },
@ -66,7 +66,7 @@ def test_json_renderer():
"type": "funkwhale", "type": "funkwhale",
"funkwhaleVersion": funkwhale_api.__version__, "funkwhaleVersion": funkwhale_api.__version__,
"serverVersion": funkwhale_api.__version__, "serverVersion": funkwhale_api.__version__,
"openSubsonic": "true", "openSubsonic": True,
"hello": "world", "hello": "world",
} }
} }