From ba061a49e495154b8f5386c55c766fd87f153ced Mon Sep 17 00:00:00 2001 From: "theo@manjaro" Date: Mon, 11 Jul 2022 15:48:30 +0200 Subject: [PATCH] Added a --full option to `domain list` --- share/actionsmap.yml | 13 ++++--------- src/domain.py | 16 ++++++---------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/share/actionsmap.yml b/share/actionsmap.yml index fa620b0b6..b4b8955f4 100644 --- a/share/actionsmap.yml +++ b/share/actionsmap.yml @@ -446,6 +446,10 @@ domain: --auto-push: help: Only display domains that are pushed automatically action: store_true + -f: + full: --full + action: store_true + help: Display more information ### domain_add() add: @@ -586,15 +590,6 @@ domain: path: help: The path to check (e.g. /coffee) - ### domain_isdyndns() - isdyndns: - action_help: Check if a domain is a dyndns one - api: GET /domain//isdyndns - arguments: - domain: - help: The domain to test (e.g. your.domain.tld) - extra: - pattern: *pattern_domain subcategories: dyndns: diff --git a/src/domain.py b/src/domain.py index 750224da0..0378cca51 100644 --- a/src/domain.py +++ b/src/domain.py @@ -52,7 +52,7 @@ DOMAIN_SETTINGS_DIR = "/etc/yunohost/domains" domain_list_cache: Dict[str, Any] = {} -def domain_list(exclude_subdomains=False,auto_push=False): +def domain_list(exclude_subdomains=False,auto_push=False,full=False): """ List domains @@ -97,6 +97,11 @@ def domain_list(exclude_subdomains=False,auto_push=False): if exclude_subdomains: return {"domains": result_list, "main": _get_maindomain()} + if full: + for i in range(len(result_list)): + domain = result_list[i] + result_list[i] = {'name':domain,'isdyndns': is_yunohost_dyndns_domain(domain)} + domain_list_cache = {"domains": result_list, "main": _get_maindomain()} return domain_list_cache @@ -458,15 +463,6 @@ def domain_url_available(domain, path): return len(_get_conflicting_apps(domain, path)) == 0 -def domain_isdyndns(domain): - """ - Returns if a domain is a DynDNS one ( used via the web API ) - - Arguments: - domain -- the domain to check - """ - return is_yunohost_dyndns_domain(domain) - def _get_maindomain(): with open("/etc/yunohost/current_host", "r") as f: maindomain = f.readline().rstrip()