forked from mirrors/relay
Fix nodeinfo Services, Usage
This commit is contained in:
parent
43280f30fe
commit
6a8f7db165
1 changed files with 26 additions and 2 deletions
|
@ -28,9 +28,17 @@ pub async fn route(config: web::Data<Config>, state: web::Data<State>) -> web::J
|
||||||
version: config.software_version(),
|
version: config.software_version(),
|
||||||
},
|
},
|
||||||
protocols: vec![Protocol::ActivityPub],
|
protocols: vec![Protocol::ActivityPub],
|
||||||
services: vec![],
|
services: Services {
|
||||||
|
inbound: vec![],
|
||||||
|
outbound: vec![],
|
||||||
|
},
|
||||||
open_registrations: false,
|
open_registrations: false,
|
||||||
usage: Usage {
|
usage: Usage {
|
||||||
|
users: Users {
|
||||||
|
total: 1,
|
||||||
|
active_halfyear: 1,
|
||||||
|
active_month: 1,
|
||||||
|
},
|
||||||
local_posts: 0,
|
local_posts: 0,
|
||||||
local_comments: 0,
|
local_comments: 0,
|
||||||
},
|
},
|
||||||
|
@ -52,7 +60,7 @@ pub struct NodeInfo {
|
||||||
version: NodeInfoVersion,
|
version: NodeInfoVersion,
|
||||||
software: Software,
|
software: Software,
|
||||||
protocols: Vec<Protocol>,
|
protocols: Vec<Protocol>,
|
||||||
services: Vec<Service>,
|
services: Services,
|
||||||
open_registrations: bool,
|
open_registrations: bool,
|
||||||
usage: Usage,
|
usage: Usage,
|
||||||
metadata: Metadata,
|
metadata: Metadata,
|
||||||
|
@ -74,11 +82,19 @@ pub enum Protocol {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, serde::Serialize)]
|
#[derive(Clone, Debug, serde::Serialize)]
|
||||||
|
pub struct Services {
|
||||||
|
inbound: Vec<Service>,
|
||||||
|
outbound: Vec<Service>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, serde::Serialize)]
|
||||||
|
#[serde(rename_all = "lowercase")]
|
||||||
pub enum Service {}
|
pub enum Service {}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, serde::Serialize)]
|
#[derive(Clone, Debug, Default, serde::Serialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Usage {
|
pub struct Usage {
|
||||||
|
users: Users,
|
||||||
local_posts: u64,
|
local_posts: u64,
|
||||||
local_comments: u64,
|
local_comments: u64,
|
||||||
}
|
}
|
||||||
|
@ -88,6 +104,14 @@ pub struct Metadata {
|
||||||
peers: Vec<String>,
|
peers: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Default, serde::Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct Users {
|
||||||
|
total: u64,
|
||||||
|
active_halfyear: u64,
|
||||||
|
active_month: u64,
|
||||||
|
}
|
||||||
|
|
||||||
impl serde::ser::Serialize for NodeInfoVersion {
|
impl serde::ser::Serialize for NodeInfoVersion {
|
||||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
where
|
where
|
||||||
|
|
Loading…
Reference in a new issue