From 62a38f2ff06e34e646af787464d2ca29f657afba Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 14 Nov 2024 02:47:00 +0100 Subject: [PATCH] `nodeinfo`: Update accordingly --- acrate-nodeinfo/Cargo.toml | 2 +- acrate-nodeinfo/src/lib.rs | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/acrate-nodeinfo/Cargo.toml b/acrate-nodeinfo/Cargo.toml index 05fa2a3..b641faa 100644 --- a/acrate-nodeinfo/Cargo.toml +++ b/acrate-nodeinfo/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -acrate-hostmeta = { version = "0.1.0", path = "../acrate-hostmeta" } +acrate-hostmeta = { path = "../acrate-hostmeta" } log = "0.4.22" reqwest = { version = "0.12.9", features = ["json", "stream"] } serde = { version = "1.0.214", features = ["derive"] } diff --git a/acrate-nodeinfo/src/lib.rs b/acrate-nodeinfo/src/lib.rs index 027fdca..8500f91 100644 --- a/acrate-nodeinfo/src/lib.rs +++ b/acrate-nodeinfo/src/lib.rs @@ -206,12 +206,13 @@ impl NodeInfo { base.set_path(Self::WELLKNOWN_NODEINFO_PATH); log::trace!("Discovering NodeInfo document locations..."); - let discovery = acrate_hostmeta::ResourceDescriptor::discover(client, base) + let discovery = acrate_hostmeta::any::ResourceDescriptor::get(client, base) .await - .map_err(Discovery)?; + .map_err(Get)? + .jrd(); log::trace!("Getting a list of NodeInfo document links..."); - let mut links = discovery.links.unwrap_or_default(); + let mut links = discovery.links; links.sort_unstable_by_key(|o| o.rel.clone()); // TODO: Performance can be improved. links.reverse(); @@ -314,7 +315,7 @@ impl NodeInfo { pub enum NodeInfoGetWellknownError { /// The discovery of possible locations for NodeInfo documents failed. #[error("the discovery of possible locations for NodeInfo documents failed")] - Discovery(acrate_hostmeta::ResourceDescriptorDiscoveryError), + Get(acrate_hostmeta::any::GetError), /// No compatible NodeInfo documents were detected at the given URL. #[error("no compatible NodeInfo documents were detected at the given URL")] Unsupported,