diff --git a/CHANGELOG b/CHANGELOG index d010c076e..c5928ced8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -12,6 +12,11 @@ Changelog - Front: Fixed broken redirection on login - Front: Fixed broken error handling on settings and login form +About page: + +There is a brand new about page on instances (/about), and instance +owner can now provide a name, a short and a long description for their instance via the admin (/api/admin/dynamic_preferences/globalpreferencemodel/). + Transcoding: Basic transcoding is now available to/from the following formats : ogg and mp3. diff --git a/api/funkwhale_api/instance/dynamic_preferences_registry.py b/api/funkwhale_api/instance/dynamic_preferences_registry.py index 1d93c383e..1d11a2988 100644 --- a/api/funkwhale_api/instance/dynamic_preferences_registry.py +++ b/api/funkwhale_api/instance/dynamic_preferences_registry.py @@ -1,9 +1,42 @@ +from django.forms import widgets + from dynamic_preferences import types from dynamic_preferences.registries import global_preferences_registry raven = types.Section('raven') +instance = types.Section('instance') +@global_preferences_registry.register +class InstanceName(types.StringPreference): + show_in_api = True + section = instance + name = 'name' + default = '' + help_text = 'Instance public name' + verbose_name = 'The public name of your instance' + + +@global_preferences_registry.register +class InstanceShortDescription(types.StringPreference): + show_in_api = True + section = instance + name = 'short_description' + default = '' + verbose_name = 'Instance succinct description' + + +@global_preferences_registry.register +class InstanceLongDescription(types.StringPreference): + show_in_api = True + section = instance + name = 'long_description' + default = '' + help_text = 'Instance long description (markdown allowed)' + field_kwargs = { + 'widget': widgets.Textarea + } + @global_preferences_registry.register class RavenDSN(types.StringPreference): show_in_api = True diff --git a/api/tests/instance/test_preferences.py b/api/tests/instance/test_preferences.py index c89bfa349..beb8e6d33 100644 --- a/api/tests/instance/test_preferences.py +++ b/api/tests/instance/test_preferences.py @@ -1,3 +1,5 @@ +import pytest + from django.urls import reverse from dynamic_preferences.api import serializers @@ -20,3 +22,14 @@ def test_can_list_settings_via_api(preferences, api_client): for p in response.data: i = '__'.join([p['section'], p['name']]) assert i in expected_preferences + + +@pytest.mark.parametrize('pref,value', [ + ('instance__name', 'My instance'), + ('instance__short_description', 'For music lovers'), + ('instance__long_description', 'For real music lovers'), +]) +def test_instance_settings(pref, value, preferences): + preferences[pref] = value + + assert preferences[pref] == value diff --git a/front/src/App.vue b/front/src/App.vue index 98ad48d3f..8453aa339 100644 --- a/front/src/App.vue +++ b/front/src/App.vue @@ -9,6 +9,9 @@

Links