From 0b5c96e2495c6155f3a12ec56a7c949435f64742 Mon Sep 17 00:00:00 2001 From: "theo@manjaro" Date: Mon, 11 Jul 2022 15:16:33 +0200 Subject: [PATCH] Added an API endpoint to check if a domain is a DynDNS one --- share/actionsmap.yml | 10 ++++++++++ src/domain.py | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/share/actionsmap.yml b/share/actionsmap.yml index 17b4c1f96..fa620b0b6 100644 --- a/share/actionsmap.yml +++ b/share/actionsmap.yml @@ -585,6 +585,16 @@ domain: pattern: *pattern_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 68726f4f2..750224da0 100644 --- a/src/domain.py +++ b/src/domain.py @@ -458,6 +458,14 @@ 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: