From 0309071eb64a35a9c7bd600aaee325f9ad4d7108 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 22 May 2023 04:58:41 +0200 Subject: [PATCH] Continued: - first try auto-discovery, then static list --- fba.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fba.py b/fba.py index 4e74fd8..852795d 100644 --- a/fba.py +++ b/fba.py @@ -124,6 +124,13 @@ def post_json_api(domain: str, path: str, data: str) -> list: def fetch_nodeinfo(domain: str) -> list: # NOISY-DEBUG: print("DEBUG: Fetching nodeinfo from domain:", domain) + nodeinfo = fetch_wellknown_nodeinfo(domain) + # NOISY-DEBUG: print("DEBUG: nodeinfo:", len(nodeinfo)) + + if len(nodeinfo) > 0: + # NOISY-DEBUG: print("DEBUG: Returning auto-discovered nodeinfo:", len(nodeinfo)) + return nodeinfo + requests = [ f"https://{domain}/nodeinfo/2.1.json", f"https://{domain}/nodeinfo/2.1", @@ -156,7 +163,6 @@ def fetch_nodeinfo(domain: str) -> list: # NOISY-DEBUG: print("DEBUG: json[]:", type(json)) if json is None or len(json) == 0: print("WARNING: Failed fetching nodeinfo from domain:", domain) - json = fetch_wellknown_nodeinfo(domain) # NOISY-DEBUG: print("DEBUG: Returning json[]:", type(json)) return json -- 2.39.5