From: Alexander Batischev Date: Sun, 21 Nov 2021 17:10:39 +0000 (+0300) Subject: Change NodeInfo `links` to an array X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/%7Bthis.state.thumbnail%7D?a=commitdiff_plain;h=d53d229c49fcd979f39e9c9cfac9b5f137b8e884;p=lemmy.git Change NodeInfo `links` to an array NodeInfo spec[1] says that _.well-known/nodeinfo_ is a JSON Resource Descriptor (JRD) document. That is specified in RFC 7033, where ยง4.4[2] mandates that `links` is an array. 1. https://nodeinfo.diaspora.software/protocol.html 2. https://datatracker.ietf.org/doc/html/rfc7033#section-4.4 --- diff --git a/crates/routes/src/nodeinfo.rs b/crates/routes/src/nodeinfo.rs index 9e327efa..b30b9f97 100644 --- a/crates/routes/src/nodeinfo.rs +++ b/crates/routes/src/nodeinfo.rs @@ -17,13 +17,13 @@ async fn node_info_well_known( context: web::Data, ) -> Result, LemmyError> { let node_info = NodeInfoWellKnown { - links: NodeInfoWellKnownLinks { + links: vec![NodeInfoWellKnownLinks { rel: Url::parse("http://nodeinfo.diaspora.software/ns/schema/2.0")?, href: Url::parse(&format!( "{}/nodeinfo/2.0.json", &context.settings().get_protocol_and_hostname(), ))?, - }, + }], }; Ok(HttpResponse::Ok().json(node_info)) } @@ -63,7 +63,7 @@ async fn node_info(context: web::Data) -> Result, } #[derive(Serialize, Deserialize, Debug)]