kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
feat(settings): Allow to set the instances server location
Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2604>environments/review-docs-2085-h577jp/deployments/18808
rodzic
1a0596b102
commit
71140d5a9b
|
@ -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}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Allow to set the instances server location (#2085)
|
|
@ -217,6 +217,20 @@ const save = async () => {
|
|||
{{ v[1] }}
|
||||
</option>
|
||||
</select>
|
||||
<select
|
||||
v-else-if="setting.field.class === 'ChoiceField'"
|
||||
:id="setting.identifier"
|
||||
v-model="values[setting.identifier]"
|
||||
class="ui search selection dropdown"
|
||||
>
|
||||
<option
|
||||
v-for="v in setting.additional_data?.choices"
|
||||
:key="v[0]"
|
||||
:value="v[0]"
|
||||
>
|
||||
{{ v[1] }}
|
||||
</option>
|
||||
</select>
|
||||
<div v-else-if="setting.field.widget.class === 'ImageWidget'">
|
||||
<input
|
||||
:id="setting.identifier"
|
||||
|
|
|
@ -24,6 +24,7 @@ const groups = computed(() => [
|
|||
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' },
|
||||
|
|
Ładowanie…
Reference in New Issue