Merge pull request #1930 from Minoru/bugfix/nodeinfo-links

Change NodeInfo `links` to an array
This commit is contained in:
Nutomic 2021-11-22 12:45:13 +00:00 committed by GitHub
commit ae153dc243
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,13 +17,13 @@ async fn node_info_well_known(
context: web::Data<LemmyContext>, context: web::Data<LemmyContext>,
) -> Result<HttpResponse<Body>, LemmyError> { ) -> Result<HttpResponse<Body>, LemmyError> {
let node_info = NodeInfoWellKnown { let node_info = NodeInfoWellKnown {
links: NodeInfoWellKnownLinks { links: vec![NodeInfoWellKnownLinks {
rel: Url::parse("http://nodeinfo.diaspora.software/ns/schema/2.0")?, rel: Url::parse("http://nodeinfo.diaspora.software/ns/schema/2.0")?,
href: Url::parse(&format!( href: Url::parse(&format!(
"{}/nodeinfo/2.0.json", "{}/nodeinfo/2.0.json",
&context.settings().get_protocol_and_hostname(), &context.settings().get_protocol_and_hostname(),
))?, ))?,
}, }],
}; };
Ok(HttpResponse::Ok().json(node_info)) Ok(HttpResponse::Ok().json(node_info))
} }
@ -63,7 +63,7 @@ async fn node_info(context: web::Data<LemmyContext>) -> Result<HttpResponse, Err
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
struct NodeInfoWellKnown { struct NodeInfoWellKnown {
pub links: NodeInfoWellKnownLinks, pub links: Vec<NodeInfoWellKnownLinks>,
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]