From d53d229c49fcd979f39e9c9cfac9b5f137b8e884 Mon Sep 17 00:00:00 2001 From: Alexander Batischev Date: Sun, 21 Nov 2021 20:10:39 +0300 Subject: [PATCH] Change NodeInfo `links` to an array MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- crates/routes/src/nodeinfo.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/routes/src/nodeinfo.rs b/crates/routes/src/nodeinfo.rs index 9e327efae..b30b9f977 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)]