Use servers.joinmatrix.org/servers.json

Switching because joinmatrix.org/servers.json is deprecated
This commit is contained in:
Maze 2023-11-30 12:45:35 +01:00
parent bc20e47fb1
commit 565508b217

View File

@ -533,7 +533,7 @@ class Backend:
connector = session.connector,
)
api_list = "https://joinmatrix.org/servers.json"
api_list = "https://servers.joinmatrix.org/servers.json"
try:
response = await session.get(api_list)
except:
@ -543,17 +543,19 @@ class Backend:
coros = []
for server in (await response.json()):
homeserver_url = "https://" + server["domain"]
for server in (await response.json())["public_servers"]:
homeserver_url = "https://" + server["client_domain"]
if not server["open"]: # ignore closed servers
continue
http_s_re = re.compile("^https?://")
# remove https from homepage because it will be re-added later
site_url = (http_s_re.sub("", server["homepage"])
if "homepage" in server else server["client_domain"])
self.models["homeservers"][homeserver_url] = Homeserver(
id = homeserver_url,
name = server["name"],
site_url = server["domain"],
country = server["jurisdiction"],
site_url = site_url,
country = server["staff_jur"],
stability = 0,
downtimes_ms = 0,
# austin's list doesn't have stability/downtime