]> Untitled Git - lemmy.git/blobdiff - src/routes/nodeinfo.rs
Report only local counts in site_view.
[lemmy.git] / src / routes / nodeinfo.rs
index e6c5e6c423a3aacf9714dd87605ab0d49256adf4..df0064ecc6f50dc6cb0881b283b334c1f38c38ae 100644 (file)
@@ -46,12 +46,13 @@ async fn node_info(context: web::Data<LemmyContext>) -> Result<HttpResponse, Err
     },
     protocols,
     usage: NodeInfoUsage {
-      // TODO get these again
-      users: NodeInfoUsers { total: 0 },
-      local_posts: 0,
-      local_comments: 0,
-      open_registrations: site_view.site.open_registration,
+      users: NodeInfoUsers {
+        total: site_view.counts.users,
+      },
+      local_posts: site_view.counts.posts,
+      local_comments: site_view.counts.comments,
     },
+    open_registrations: site_view.site.open_registration,
   };
 
   Ok(HttpResponse::Ok().json(json))
@@ -69,11 +70,13 @@ struct NodeInfoWellKnownLinks {
 }
 
 #[derive(Serialize, Deserialize, Debug)]
+#[serde(rename_all = "camelCase")]
 struct NodeInfo {
   pub version: String,
   pub software: NodeInfoSoftware,
   pub protocols: Vec<String>,
   pub usage: NodeInfoUsage,
+  pub open_registrations: bool,
 }
 
 #[derive(Serialize, Deserialize, Debug)]
@@ -88,7 +91,6 @@ struct NodeInfoUsage {
   pub users: NodeInfoUsers,
   pub local_posts: i64,
   pub local_comments: i64,
-  pub open_registrations: bool,
 }
 
 #[derive(Serialize, Deserialize, Debug)]