fix: try both 2.0.json and 2.0 for nodeinfo

This commit is contained in:
əlemi 2024-06-19 17:58:16 +02:00
parent cf26b77fdf
commit 3d504e5059
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -57,9 +57,13 @@ impl Entity {
}
pub async fn nodeinfo(domain: &str) -> reqwest::Result<NodeInfoOwned> {
reqwest::get(format!("https://{domain}/nodeinfo/2.0.json"))
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
.await,
}
}
}