Add instance name and icon
This commit is contained in:
parent
9cbed8f2a9
commit
c45771d9e7
2 changed files with 18 additions and 0 deletions
|
@ -2,6 +2,7 @@ use serde::Deserialize;
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
pub struct GetSiteResponse {
|
pub struct GetSiteResponse {
|
||||||
|
pub site_view: SiteView,
|
||||||
pub online: usize,
|
pub online: usize,
|
||||||
pub federated_instances: Option<FederatedInstances>,
|
pub federated_instances: Option<FederatedInstances>,
|
||||||
}
|
}
|
||||||
|
@ -12,3 +13,16 @@ pub struct FederatedInstances {
|
||||||
pub allowed: Option<Vec<String>>,
|
pub allowed: Option<Vec<String>>,
|
||||||
pub blocked: Option<Vec<String>>,
|
pub blocked: Option<Vec<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
|
pub struct SiteView {
|
||||||
|
pub site: Site,
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
|
pub struct Site {
|
||||||
|
pub name: String,
|
||||||
|
pub icon: String,
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -50,6 +50,8 @@ pub async fn main() -> Result<(), Error> {
|
||||||
#[derive(Serialize, Clone)]
|
#[derive(Serialize, Clone)]
|
||||||
struct InstanceDetails {
|
struct InstanceDetails {
|
||||||
domain: String,
|
domain: String,
|
||||||
|
name: String,
|
||||||
|
icon: String,
|
||||||
online_users: i32,
|
online_users: i32,
|
||||||
total_users: i64,
|
total_users: i64,
|
||||||
users_active_halfyear: i64,
|
users_active_halfyear: i64,
|
||||||
|
@ -70,6 +72,8 @@ async fn fetch_instance_details(domain: &str) -> Result<InstanceDetails, Error>
|
||||||
|
|
||||||
Ok(InstanceDetails {
|
Ok(InstanceDetails {
|
||||||
domain: domain.to_owned(),
|
domain: domain.to_owned(),
|
||||||
|
name: site_info.site_view.site.name,
|
||||||
|
icon: site_info.site_view.site.icon,
|
||||||
online_users: site_info.online as i32,
|
online_users: site_info.online as i32,
|
||||||
total_users: node_info.usage.users.total,
|
total_users: node_info.usage.users.total,
|
||||||
users_active_halfyear: node_info.usage.users.active_halfyear,
|
users_active_halfyear: node_info.usage.users.active_halfyear,
|
||||||
|
|
Loading…
Reference in a new issue