From 7c0ba6fa9ac609b8341127be4fa29691bdd2b232 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 8 Jul 2023 23:06:22 +0200 Subject: [PATCH] Continued: - also update `last_nodeinfo` when nodeinfo has been auto-discovered or found by probing their also well-known locations --- fba/http/federation.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fba/http/federation.py b/fba/http/federation.py index 8a0a225..74edbd7 100644 --- a/fba/http/federation.py +++ b/fba/http/federation.py @@ -214,6 +214,9 @@ def fetch_nodeinfo(domain: str, path: str = None) -> dict: logger.debug("nodeinfo[%s](%d='%s'", type(nodeinfo), len(nodeinfo), nodeinfo) if "error_message" not in nodeinfo and "json" in nodeinfo and len(nodeinfo["json"]) > 0: + logger.debug("Invoking instances.set_last_nodeinfo(%s) ...", domain) + instances.set_last_nodeinfo(domain) + logger.debug("Found nodeinfo[json]()=%d - EXIT!", len(nodeinfo['json'])) return nodeinfo @@ -253,12 +256,13 @@ def fetch_nodeinfo(domain: str, path: str = None) -> dict: logger.debug("path[%s]='%s',request='%s',http_url='%s',https_url='%s'", type(path), path, request, http_url, https_url) if path is None or path in [request, http_url, https_url]: - logger.debug("Fetching request='%s' from domain='%s' ...", request, domain) + logger.debug("path='%s',http_url='%s',https_url='%s'", path, http_url, https_url) if path in [http_url, https_url]: logger.debug("domain='%s',path='%s' has protocol in path, splitting ...", domain, path) components = urlparse(path) path = components.path + logger.debug("Fetching request='%s' from domain='%s' ...", request, domain) data = network.get_json_api( domain, request, @@ -269,6 +273,7 @@ def fetch_nodeinfo(domain: str, path: str = None) -> dict: logger.debug("data[]='%s'", type(data)) if "error_message" not in data and "json" in data: logger.debug("Success: request='%s' - Setting detection_mode=STATIC_CHECK ...", request) + instances.set_last_nodeinfo(domain) instances.set_detection_mode(domain, "STATIC_CHECK") instances.set_nodeinfo_url(domain, request) break -- 2.39.5