mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-22 14:38:00 +00:00
don't use cached nodeinfo data when instance follows
This commit is contained in:
parent
c9598ff273
commit
85825f6de1
|
@ -230,12 +230,10 @@ class HttpClient:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
async def fetch_nodeinfo(self, domain: str) -> Nodeinfo:
|
async def fetch_nodeinfo(self, domain: str, force: bool = False) -> Nodeinfo:
|
||||||
nodeinfo_url = None
|
nodeinfo_url = None
|
||||||
wk_nodeinfo = await self.get(
|
wk_nodeinfo = await self.get(
|
||||||
f'https://{domain}/.well-known/nodeinfo',
|
f'https://{domain}/.well-known/nodeinfo', False, WellKnownNodeinfo, force
|
||||||
False,
|
|
||||||
WellKnownNodeinfo
|
|
||||||
)
|
)
|
||||||
|
|
||||||
for version in ('20', '21'):
|
for version in ('20', '21'):
|
||||||
|
@ -248,7 +246,7 @@ class HttpClient:
|
||||||
if nodeinfo_url is None:
|
if nodeinfo_url is None:
|
||||||
raise ValueError(f'Failed to fetch nodeinfo url for {domain}')
|
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:
|
async def get(*args: Any, **kwargs: Any) -> Any:
|
||||||
|
|
|
@ -58,7 +58,7 @@ async def handle_forward(view: ActorView, conn: Connection) -> None:
|
||||||
|
|
||||||
|
|
||||||
async def handle_follow(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
|
software = nodeinfo.sw_name if nodeinfo else None
|
||||||
config = conn.get_config_all()
|
config = conn.get_config_all()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue