From 6cf632ccff03612602ee479782cb486e48c82108 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 18 Jun 2023 03:35:46 +0200 Subject: [PATCH] Continue: - continue checking on software type after it was discovered by generator/site_name - maybe it needs aliasing? - also add 'slipfox calckey' as an alias for 'misskey' - don't tidy-up None values --- fba/federation.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/fba/federation.py b/fba/federation.py index 55a0b21..9ccbc60 100644 --- a/fba/federation.py +++ b/fba/federation.py @@ -437,20 +437,25 @@ def determine_software(domain: str, path: str = None) -> str: elif "software" not in data or "name" not in data["software"]: # DEBUG: print(f"DEBUG: JSON response from domain='{domain}' does not include [software][name], fetching / ...") software = fetch_generator_from_path(domain) + # DEBUG: print(f"DEBUG: Generator for domain='{domain}' is: '{software}'") + elif "software" in data and "name" in data["software"]: + # DEBUG: print("DEBUG: Found data[software][name] in JSON response") + software = data["software"]["name"] - # DEBUG: print(f"DEBUG: Generator for domain='{domain}' is: {software}, EXIT!") - return software - - software = tidyup.domain(data["software"]["name"]) + if software is None: + # DEBUG: print("DEBUG: Returning None - EXIT!") + return None + sofware = tidyup.domain(software) # DEBUG: print("DEBUG: sofware after tidyup.domain():", software) + if software in ["akkoma", "rebased"]: # DEBUG: print("DEBUG: Setting pleroma:", domain, software) software = "pleroma" elif software in ["hometown", "ecko"]: # DEBUG: print("DEBUG: Setting mastodon:", domain, software) software = "mastodon" - elif software in ["calckey", "groundpolis", "foundkey", "cherrypick", "meisskey"]: + elif software in ["slipfox calckey", "calckey", "groundpolis", "foundkey", "cherrypick", "meisskey"]: # DEBUG: print("DEBUG: Setting misskey:", domain, software) software = "misskey" elif software == "runtube.re": -- 2.39.5