if path is None or path == request or path == f"http://{domain}{path}" or path == f"https://{domain}{path}":
# DEBUG: print(f"DEBUG: Fetching request='{request}' from domain='{domain}' ...")
if path == f"http://{domain}{path}" or path == f"https://{domain}{path}":
- print(f"DEBUG: domain='{domain}',path='{path}' has protocol in path, splitting ...")
+ # DEBUG: print(f"DEBUG: domain='{domain}',path='{path}' has protocol in path, splitting ...")
components = urlparse(path)
path = components.path
if not isinstance(link, dict) or not "rel" in link:
print(f"WARNING: link[]='{type(link)}' is not 'dict' or no element 'rel' found")
elif link["rel"] in nodeinfo_identifier:
- # DEBUG: print("DEBUG: Fetching nodeinfo from:", link["href"])
+ # Default is that 'href' has a complete URL, but some hosts don't send that
+ url = link["href"]
+ components = urlparse(link["href"])
+
+ # DEBUG: print(f"DEBUG: components[{type(components)}]='{components}'")
+ if components.scheme == "" and components.netloc == "":
+ # DEBUG: print(f"DEBUG: link[href]='{link['href']}' has no scheme and host name in it, prepending from domain='{domain}'")
+ url = f"https://{domain}{url}"
+
+ # DEBUG: print("DEBUG: Fetching nodeinfo from:", url)
data = network.fetch_api_url(
- link["href"],
+ url,
(config.get("connection_timeout"), config.get("read_timeout"))
)
# DEBUG: print(f"DEBUG: generator='{generator}',site_name='{site_name}'")
if isinstance(generator, bs4.element.Tag) and isinstance(generator.get("content"), str):
- print("DEBUG: Found generator meta tag:", domain)
+ # DEBUG: print("DEBUG: Found generator meta tag:", domain)
software = tidyup.domain(generator.get("content"))
# DEBUG: print(f"DEBUG: software[{type(software)}]='{software}'")
if software is not None and software != "":
print("WARNING: block_level is empty, domain:", domain)
continue
elif block_level == "accept":
- print(f"DEBUG: domain='{domain}' skipping block_level='accept'")
+ # DEBUG: print(f"DEBUG: domain='{domain}' skipping block_level='accept'")
continue
# DEBUG: print(f"DEBUG: Checking {len(blocklist)} entries from domain='{domain}',software='mastodon',block_level='{block_level}' ...")
print("WARNING: block_level is now empty!")
continue
elif block_level == "accept":
- print(f"DEBUG: domain='{domain}' skipping block_level='accept'")
+ # DEBUG: print(f"DEBUG: domain='{domain}' skipping block_level='accept'")
continue
# DEBUG: print(f"DEBUG: Checking {len(blocklist)} entries from domain='{domain}',block_level='{block_level}' ...")
print("WARNING: block_level is now empty!")
continue
elif block_level == "accept":
- print(f"DEBUG: domain='{domain}' skipping block_level='accept'")
+ # DEBUG: print(f"DEBUG: domain='{domain}' skipping block_level='accept'")
continue
# DEBUG: print(f"DEBUG: Checking {len(info.items())} entries from domain='{domain}',software='pleroma',block_level='{block_level}' ...")