mirror of https://github.com/LemmyNet/lemmy.git
Use skip_serializing_none for nodeinfo (fixes #4702)
This commit is contained in:
parent
b152be7951
commit
191dc39acf
|
@ -2940,6 +2940,7 @@ dependencies = [
|
|||
"reqwest-middleware",
|
||||
"rss",
|
||||
"serde",
|
||||
"serde_with",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"url",
|
||||
|
|
|
@ -34,4 +34,5 @@ once_cell = { workspace = true }
|
|||
tracing = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
urlencoding = { workspace = true }
|
||||
serde_with.workspace = true
|
||||
rss = "2.0.7"
|
||||
|
|
|
@ -9,6 +9,7 @@ use lemmy_utils::{
|
|||
VERSION,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
use url::Url;
|
||||
|
||||
pub fn config(cfg: &mut web::ServiceConfig) {
|
||||
|
@ -44,7 +45,7 @@ async fn node_info(context: web::Data<LemmyContext>) -> Result<HttpResponse, Err
|
|||
.ok_or(ErrorBadRequest(LemmyError::from(anyhow!("not_found"))))?;
|
||||
|
||||
let protocols = if site_view.local_site.federation_enabled {
|
||||
Some(vec!["activitypub".to_string()])
|
||||
None
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
@ -84,6 +85,7 @@ struct NodeInfoWellKnownLinks {
|
|||
pub href: Url,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Serialize, Deserialize, Debug, Default)]
|
||||
#[serde(rename_all = "camelCase", default)]
|
||||
pub struct NodeInfo {
|
||||
|
@ -94,6 +96,7 @@ pub struct NodeInfo {
|
|||
pub open_registrations: Option<bool>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Serialize, Deserialize, Debug, Default)]
|
||||
#[serde(default)]
|
||||
pub struct NodeInfoSoftware {
|
||||
|
@ -101,6 +104,7 @@ pub struct NodeInfoSoftware {
|
|||
pub version: Option<String>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Serialize, Deserialize, Debug, Default)]
|
||||
#[serde(rename_all = "camelCase", default)]
|
||||
pub struct NodeInfoUsage {
|
||||
|
@ -109,6 +113,7 @@ pub struct NodeInfoUsage {
|
|||
pub local_comments: Option<i64>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Serialize, Deserialize, Debug, Default)]
|
||||
#[serde(rename_all = "camelCase", default)]
|
||||
pub struct NodeInfoUsers {
|
||||
|
|
Loading…
Reference in New Issue