Fixed a type system oopsie in NodeInfo
ci/woodpecker/push/ociImagePush Pipeline is running
Details
ci/woodpecker/push/ociImagePush Pipeline is running
Details
This commit is contained in:
parent
e1fd078367
commit
4f4a871ae5
|
@ -57,8 +57,6 @@ pub struct NodeInfo10Usage {
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Debug, Deserialize, Serialize)]
|
#[derive(Clone, PartialEq, Debug, Deserialize, Serialize)]
|
||||||
pub struct NodeInfo10 {
|
pub struct NodeInfo10 {
|
||||||
#[doc = "The schema version, must be 1.0."]
|
|
||||||
pub version: String,
|
|
||||||
#[doc = "Free form key value pairs for software specific values. Clients should not rely on any "]
|
#[doc = "Free form key value pairs for software specific values. Clients should not rely on any "]
|
||||||
#[doc = "specific key present."]
|
#[doc = "specific key present."]
|
||||||
pub metadata: HashMap<String, serde_json::Value>,
|
pub metadata: HashMap<String, serde_json::Value>,
|
||||||
|
|
|
@ -3,11 +3,12 @@ use axum::Json;
|
||||||
use magnetar_common::config::MagnetarConfig;
|
use magnetar_common::config::MagnetarConfig;
|
||||||
use magnetar_core::web_model::rel::{RelNodeInfo20, RelNodeInfo21};
|
use magnetar_core::web_model::rel::{RelNodeInfo20, RelNodeInfo21};
|
||||||
use magnetar_core::web_model::Rel;
|
use magnetar_core::web_model::Rel;
|
||||||
use magnetar_nodeinfo::version_1_0::{
|
|
||||||
NodeInfo10Services, NodeInfo10Software, NodeInfo10Usage, NodeInfo10UsageUsers,
|
|
||||||
};
|
|
||||||
use magnetar_nodeinfo::version_2_0::NodeInfo20;
|
use magnetar_nodeinfo::version_2_0::NodeInfo20;
|
||||||
use magnetar_nodeinfo::version_2_1::{NodeInfo21, NodeInfo21Software};
|
use magnetar_nodeinfo::version_2_1::{NodeInfo21, NodeInfo21Software};
|
||||||
|
use magnetar_nodeinfo::{
|
||||||
|
version_1_0::{NodeInfo10Services, NodeInfo10Software, NodeInfo10Usage, NodeInfo10UsageUsers},
|
||||||
|
NodeInfo,
|
||||||
|
};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use serde_json::{json, Value};
|
use serde_json::{json, Value};
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
|
@ -43,8 +44,8 @@ pub async fn handle_nodeinfo(State(config): State<&'static MagnetarConfig>) -> J
|
||||||
Json(json!({ "links": links_serialized }))
|
Json(json!({ "links": links_serialized }))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn handle_nodeinfo_21(State(config): State<&'static MagnetarConfig>) -> Json<NodeInfo21> {
|
pub async fn handle_nodeinfo_21(State(config): State<&'static MagnetarConfig>) -> Json<NodeInfo> {
|
||||||
Json(NodeInfo21 {
|
Json(NodeInfo::V2_1(NodeInfo21 {
|
||||||
software: NodeInfo21Software {
|
software: NodeInfo21Software {
|
||||||
name: config.branding.name.clone(),
|
name: config.branding.name.clone(),
|
||||||
version: config.branding.version.clone(),
|
version: config.branding.version.clone(),
|
||||||
|
@ -67,11 +68,11 @@ pub async fn handle_nodeinfo_21(State(config): State<&'static MagnetarConfig>) -
|
||||||
local_comments: Some(0),
|
local_comments: Some(0),
|
||||||
},
|
},
|
||||||
metadata: HashMap::new(),
|
metadata: HashMap::new(),
|
||||||
})
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn handle_nodeinfo_20(State(config): State<&'static MagnetarConfig>) -> Json<NodeInfo20> {
|
pub async fn handle_nodeinfo_20(State(config): State<&'static MagnetarConfig>) -> Json<NodeInfo> {
|
||||||
Json(NodeInfo20 {
|
Json(NodeInfo::V2_0(NodeInfo20 {
|
||||||
software: NodeInfo10Software {
|
software: NodeInfo10Software {
|
||||||
name: config.branding.name.clone(),
|
name: config.branding.name.clone(),
|
||||||
version: config.branding.version.clone(),
|
version: config.branding.version.clone(),
|
||||||
|
@ -92,7 +93,7 @@ pub async fn handle_nodeinfo_20(State(config): State<&'static MagnetarConfig>) -
|
||||||
local_comments: None,
|
local_comments: None,
|
||||||
},
|
},
|
||||||
metadata: HashMap::new(),
|
metadata: HashMap::new(),
|
||||||
})
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
Loading…
Reference in New Issue