From 0084ce757c6937449c7f8e2e177a995710089b80 Mon Sep 17 00:00:00 2001 From: "theo@manjaro" Date: Wed, 13 Jul 2022 11:34:04 +0200 Subject: [PATCH] Don't ask for the (un)subscribe options if this is a sub-subdomain --- src/domain.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/domain.py b/src/domain.py index a107c7635..d6a3aa095 100644 --- a/src/domain.py +++ b/src/domain.py @@ -93,9 +93,6 @@ def domain_list(exclude_subdomains=False,auto_push=False,full=False): result_list = sorted(result_list, key=cmp_domain) - if exclude_subdomains: - return {"domains": result_list, "main": _get_maindomain()} - if full: for i in range(len(result_list)): domain = result_list[i] @@ -178,8 +175,8 @@ def domain_add(operation_logger, domain, subscribe=None, no_subscribe=False): # Non-latin characters (e.g. café.com => xn--caf-dma.com) domain = domain.encode("idna").decode("utf-8") - # DynDNS domain - dyndns = is_yunohost_dyndns_domain(domain) + # Detect if this is a DynDNS domain ( and not a subdomain of a DynDNS domain ) + dyndns = is_yunohost_dyndns_domain(domain) and len(domain.split("."))==3 if dyndns: if ((subscribe==None) == (no_subscribe==False)): raise YunohostValidationError("domain_dyndns_instruction_unclear") @@ -325,8 +322,8 @@ def domain_remove(operation_logger, domain, remove_apps=False, force=False, unsu apps="\n".join([x[1] for x in apps_on_that_domain]), ) - # DynDNS domain - dyndns = is_yunohost_dyndns_domain(domain) + # Detect if this is a DynDNS domain ( and not a subdomain of a DynDNS domain ) + dyndns = is_yunohost_dyndns_domain(domain) and len(domain.split("."))==3 if dyndns: if ((unsubscribe==None) == (no_unsubscribe==False)): raise YunohostValidationError("domain_dyndns_instruction_unclear_unsubscribe")