Add aonther nodeinfo endpoint used by Friendica

This commit is contained in:
Mint 2022-08-23 22:56:09 +03:00
parent 6e72f19967
commit 1b75c3b4bc
2 changed files with 4 additions and 0 deletions

View file

@ -87,6 +87,8 @@ def get_hash(domain: str) -> str:
def get_type(domain: str) -> str:
try:
res = get(f"https://{domain}/nodeinfo/2.1.json", headers=headers, timeout=5)
if res.status_code == 404:
res = get(f"https://{domain}/nodeinfo/2.0", headers=headers, timeout=5)
if res.status_code == 404:
res = get(f"https://{domain}/nodeinfo/2.0.json", headers=headers, timeout=5)
if res.ok and "text/html" in res.headers["content-type"]:

View file

@ -27,6 +27,8 @@ peerlist = get_peers(domain)
def get_type(instdomain: str) -> str:
try:
res = get(f"https://{instdomain}/nodeinfo/2.1.json", headers=headers, timeout=5)
if res.status_code == 404:
res = get(f"https://{instdomain}/nodeinfo/2.0", headers=headers, timeout=5)
if res.status_code == 404:
res = get(f"https://{instdomain}/nodeinfo/2.0.json", headers=headers, timeout=5)
if res.ok and "text/html" in res.headers["content-type"]: