From 85825f6de1b1edba19a41122a4104dc99f7e43ce Mon Sep 17 00:00:00 2001 From: Izalia Mae Date: Fri, 23 Aug 2024 01:37:15 -0400 Subject: [PATCH] don't use cached nodeinfo data when instance follows --- relay/http_client.py | 8 +++----- relay/processors.py | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/relay/http_client.py b/relay/http_client.py index e5b58f6..26f2ba8 100644 --- a/relay/http_client.py +++ b/relay/http_client.py @@ -230,12 +230,10 @@ class HttpClient: return - async def fetch_nodeinfo(self, domain: str) -> Nodeinfo: + async def fetch_nodeinfo(self, domain: str, force: bool = False) -> Nodeinfo: nodeinfo_url = None wk_nodeinfo = await self.get( - f'https://{domain}/.well-known/nodeinfo', - False, - WellKnownNodeinfo + f'https://{domain}/.well-known/nodeinfo', False, WellKnownNodeinfo, force ) for version in ('20', '21'): @@ -248,7 +246,7 @@ class HttpClient: if nodeinfo_url is None: raise ValueError(f'Failed to fetch nodeinfo url for {domain}') - return await self.get(nodeinfo_url, False, Nodeinfo) + return await self.get(nodeinfo_url, False, Nodeinfo, force) async def get(*args: Any, **kwargs: Any) -> Any: diff --git a/relay/processors.py b/relay/processors.py index 4e4d96f..57e9222 100644 --- a/relay/processors.py +++ b/relay/processors.py @@ -58,7 +58,7 @@ async def handle_forward(view: ActorView, conn: Connection) -> None: async def handle_follow(view: ActorView, conn: Connection) -> None: - nodeinfo = await view.client.fetch_nodeinfo(view.actor.domain) + nodeinfo = await view.client.fetch_nodeinfo(view.actor.domain, force = True) software = nodeinfo.sw_name if nodeinfo else None config = conn.get_config_all()