diff --git a/api/funkwhale_api/instance/dynamic_preferences_registry.py b/api/funkwhale_api/instance/dynamic_preferences_registry.py index d34fb814f..402fe7e16 100644 --- a/api/funkwhale_api/instance/dynamic_preferences_registry.py +++ b/api/funkwhale_api/instance/dynamic_preferences_registry.py @@ -1,3 +1,4 @@ +import pycountry from django.core.validators import FileExtensionValidator from django.forms import widgets from dynamic_preferences import types @@ -170,3 +171,18 @@ class Banner(ImagePreference): default = None help_text = "This banner will be displayed on your pod's landing and about page. At least 600x100px recommended." field_kwargs = {"required": False} + + +@global_preferences_registry.register +class Location(types.ChoicePreference): + show_in_api = True + section = instance + name = "location" + verbose_name = "Server Location" + default = "" + choices = [(country.alpha_2, country.name) for country in pycountry.countries] + help_text = ( + "The country or territory in which your server is located. This is displayed in the server's Nodeinfo " + "endpoint." + ) + field_kwargs = {"choices": choices, "required": False} diff --git a/changes/changelog.d/server-location.feature b/changes/changelog.d/server-location.feature new file mode 100644 index 000000000..f1c3a1922 --- /dev/null +++ b/changes/changelog.d/server-location.feature @@ -0,0 +1 @@ +Allow to set the instances server location (#2085) diff --git a/front/src/components/admin/SettingsGroup.vue b/front/src/components/admin/SettingsGroup.vue index ae05e1e48..a2bf872a6 100644 --- a/front/src/components/admin/SettingsGroup.vue +++ b/front/src/components/admin/SettingsGroup.vue @@ -217,6 +217,20 @@ const save = async () => { {{ v[1] }} +
[ id: 'instance', settings: [ { name: 'instance__name' }, + { name: 'instance__location' }, { name: 'instance__short_description' }, { name: 'instance__long_description', fieldType: 'markdown', fieldParams: { charLimit: null, permissive: true } }, { name: 'instance__contact_email' },