1
Fork 0

nodeinfo: Improve XRD compatibility

This commit is contained in:
Steffo 2024-11-09 16:20:36 +01:00
parent 6ca0b5368a
commit 2aeed9773f
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0

View file

@ -5,7 +5,7 @@
use reqwest::header::HeaderValue;
use serde::Deserialize;
/// A [host-meta document].
/// A [host-meta document] in JRD representation.
///
/// [host-meta document]: https://datatracker.ietf.org/doc/html/rfc6415
#[derive(Debug, Clone, Deserialize)]
@ -15,7 +15,7 @@ pub struct HostMetaDocument {
pub subject: Option<String>,
/// Links established between the [`Self::subject`] and other resources.
#[serde(alias = "Links")]
#[serde(alias = "Link")]
pub links: Vec<HostMetaLink>,
}
@ -25,10 +25,20 @@ pub struct HostMetaDocument {
#[derive(Debug, Clone, Deserialize)]
pub struct HostMetaLink {
/// The kind of relation established by the subject with the attached resource.
#[serde(alias = "@rel")]
pub rel: String,
/// The resource put in relation with the subject resource.
pub href: String,
#[serde(alias = "@href")]
pub href: Option<String>,
/// Template to fill to get the resource put in relation with the subject resource.
#[serde(alias = "@template")]
pub template: Option<String>,
/// The `Content-Type` of the resource put in relation.
#[serde(alias = "@type")]
pub r#type: Option<String>,
}
impl HostMetaDocument {