mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
domain:config: make 'registrar' info a frozen input since an alert has no value
This commit is contained in:
parent
3a31984e3c
commit
9134515604
1 changed files with 38 additions and 50 deletions
88
src/dns.py
88
src/dns.py
|
@ -502,11 +502,26 @@ def _get_relative_name_for_dns_zone(domain, base_dns_zone):
|
|||
def _get_registrar_config_section(domain):
|
||||
from lexicon.providers.auto import _relevant_provider_for_domain
|
||||
|
||||
registrar_infos = {
|
||||
"name": m18n.n(
|
||||
"registrar_infos"
|
||||
), # This is meant to name the config panel section, for proper display in the webadmin
|
||||
}
|
||||
registrar_infos = OrderedDict(
|
||||
{
|
||||
"name": m18n.n(
|
||||
"registrar_infos"
|
||||
), # This is meant to name the config panel section, for proper display in the webadmin
|
||||
"registrar": OrderedDict(
|
||||
{
|
||||
"readonly": True,
|
||||
"visible": False,
|
||||
"default": None,
|
||||
}
|
||||
),
|
||||
"infos": OrderedDict(
|
||||
{
|
||||
"type": "alert",
|
||||
"style": "info",
|
||||
}
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
dns_zone = _get_dns_zone_for_domain(domain)
|
||||
|
||||
|
@ -519,61 +534,34 @@ def _get_registrar_config_section(domain):
|
|||
else:
|
||||
parent_domain_link = parent_domain
|
||||
|
||||
registrar_infos["registrar"] = OrderedDict(
|
||||
{
|
||||
"type": "alert",
|
||||
"style": "info",
|
||||
"ask": m18n.n(
|
||||
"domain_dns_registrar_managed_in_parent_domain",
|
||||
parent_domain=parent_domain,
|
||||
parent_domain_link=parent_domain_link,
|
||||
),
|
||||
"default": "parent_domain",
|
||||
}
|
||||
registrar_infos["registrar"]["default"] = "parent_domain"
|
||||
registrar_infos["infos"]["ask"] = m18n.n(
|
||||
"domain_dns_registrar_managed_in_parent_domain",
|
||||
parent_domain=parent_domain,
|
||||
parent_domain_link=parent_domain_link,
|
||||
)
|
||||
return OrderedDict(registrar_infos)
|
||||
return registrar_infos
|
||||
|
||||
# TODO big project, integrate yunohost's dynette as a registrar-like provider
|
||||
# TODO big project, integrate other dyndns providers such as netlib.re, or cf the list of dyndns providers supported by cloudron...
|
||||
if is_yunohost_dyndns_domain(dns_zone):
|
||||
registrar_infos["registrar"] = OrderedDict(
|
||||
{
|
||||
"type": "alert",
|
||||
"style": "success",
|
||||
"ask": m18n.n("domain_dns_registrar_yunohost"),
|
||||
"default": "yunohost",
|
||||
}
|
||||
)
|
||||
return OrderedDict(registrar_infos)
|
||||
registrar_infos["registrar"]["default"] = "yunohost"
|
||||
registrar_infos["infos"]["style"] = "success"
|
||||
registrar_infos["infos"]["ask"] = m18n.n("domain_dns_registrar_yunohost")
|
||||
|
||||
return registrar_infos
|
||||
elif is_special_use_tld(dns_zone):
|
||||
registrar_infos["registrar"] = OrderedDict(
|
||||
{
|
||||
"type": "alert",
|
||||
"style": "info",
|
||||
"ask": m18n.n("domain_dns_conf_special_use_tld"),
|
||||
"default": None,
|
||||
}
|
||||
)
|
||||
registrar_infos["infos"]["ask"] = m18n.n("domain_dns_conf_special_use_tld")
|
||||
|
||||
try:
|
||||
registrar = _relevant_provider_for_domain(dns_zone)[0]
|
||||
except ValueError:
|
||||
registrar_infos["registrar"] = OrderedDict(
|
||||
{
|
||||
"type": "alert",
|
||||
"style": "warning",
|
||||
"ask": m18n.n("domain_dns_registrar_not_supported"),
|
||||
"default": None,
|
||||
}
|
||||
)
|
||||
registrar_infos["registrar"]["default"] = None
|
||||
registrar_infos["infos"]["ask"] = m18n.n("domain_dns_registrar_not_supported")
|
||||
else:
|
||||
registrar_infos["registrar"] = OrderedDict(
|
||||
{
|
||||
"type": "alert",
|
||||
"style": "info",
|
||||
"ask": m18n.n("domain_dns_registrar_supported", registrar=registrar),
|
||||
"default": registrar,
|
||||
}
|
||||
registrar_infos["registrar"]["default"] = registrar
|
||||
registrar_infos["infos"]["ask"] = m18n.n(
|
||||
"domain_dns_registrar_supported", registrar=registrar
|
||||
)
|
||||
|
||||
TESTED_REGISTRARS = ["ovh", "gandi"]
|
||||
|
@ -601,7 +589,7 @@ def _get_registrar_config_section(domain):
|
|||
infos["optional"] = infos.get("optional", "False")
|
||||
registrar_infos.update(registrar_credentials)
|
||||
|
||||
return OrderedDict(registrar_infos)
|
||||
return registrar_infos
|
||||
|
||||
|
||||
def _get_registar_settings(domain):
|
||||
|
|
Loading…
Add table
Reference in a new issue