1
Fork 0

nodeinfo: Update accordingly

This commit is contained in:
Steffo 2024-11-14 02:47:00 +01:00
parent 522d336e5a
commit 62a38f2ff0
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
2 changed files with 6 additions and 5 deletions

View file

@ -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"] }

View file

@ -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,