From 3d504e5059a3e6f098f748ef261e2cf3a7ceefa8 Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 19 Jun 2024 17:58:16 +0200 Subject: [PATCH] fix: try both 2.0.json and 2.0 for nodeinfo --- upub/core/src/model/instance.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/upub/core/src/model/instance.rs b/upub/core/src/model/instance.rs index b11fa95a..0ca6ef64 100644 --- a/upub/core/src/model/instance.rs +++ b/upub/core/src/model/instance.rs @@ -57,9 +57,13 @@ impl Entity { } pub async fn nodeinfo(domain: &str) -> reqwest::Result { - reqwest::get(format!("https://{domain}/nodeinfo/2.0.json")) - .await? - .json() - .await + match reqwest::get(format!("https://{domain}/nodeinfo/2.0.json")).await { + Ok(res) => res.json().await, + // ughhh pleroma wants with json, key without + Err(_) => reqwest::get(format!("https://{domain}/nodeinfo/2.0.json")) + .await? + .json() + .await, + } } }