Changing NodeInfo metadata to HashMap from vector. Fixes #4762 (#4764)

This commit is contained in:
Dessalines 2024-05-31 16:38:46 -04:00 committed by GitHub
parent 96b7afc0b1
commit 6a6c915014
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,6 +9,7 @@ use lemmy_utils::{
VERSION, VERSION,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use url::Url; use url::Url;
pub fn config(cfg: &mut web::ServiceConfig) { pub fn config(cfg: &mut web::ServiceConfig) {
@ -71,7 +72,7 @@ async fn node_info(context: web::Data<LemmyContext>) -> Result<HttpResponse, Err
inbound: Some(vec![]), inbound: Some(vec![]),
outbound: Some(vec![]), outbound: Some(vec![]),
}), }),
metadata: Some(vec![]), metadata: Some(HashMap::new()),
}; };
Ok(HttpResponse::Ok().json(json)) Ok(HttpResponse::Ok().json(json))
@ -99,7 +100,7 @@ pub struct NodeInfo {
pub open_registrations: Option<bool>, pub open_registrations: Option<bool>,
/// These fields are required by the spec for no reason /// These fields are required by the spec for no reason
pub services: Option<NodeInfoServices>, pub services: Option<NodeInfoServices>,
pub metadata: Option<Vec<String>>, pub metadata: Option<HashMap<String, String>>,
} }
#[derive(Serialize, Deserialize, Debug, Default)] #[derive(Serialize, Deserialize, Debug, Default)]