diff --git a/src/migrations/m20240524_000001_create_actor_activity_object_tables.rs b/src/migrations/m20240524_000001_create_actor_activity_object_tables.rs index ffb018cc..b5721bbd 100644 --- a/src/migrations/m20240524_000001_create_actor_activity_object_tables.rs +++ b/src/migrations/m20240524_000001_create_actor_activity_object_tables.rs @@ -108,8 +108,8 @@ impl MigrationTrait for Migration { .col(ColumnDef::new(Instances::Version).string().null()) .col(ColumnDef::new(Instances::Icon).string().null()) .col(ColumnDef::new(Instances::DownSince).date_time().null()) - .col(ColumnDef::new(Instances::Users).integer().null()) - .col(ColumnDef::new(Instances::Posts).integer().null()) + .col(ColumnDef::new(Instances::Users).big_integer().null()) + .col(ColumnDef::new(Instances::Posts).big_integer().null()) .col(ColumnDef::new(Instances::Published).date_time().not_null().default(Expr::current_timestamp())) .col(ColumnDef::new(Instances::Updated).date_time().not_null().default(Expr::current_timestamp())) .to_owned() diff --git a/src/model/instance.rs b/src/model/instance.rs index 83c8c6e9..58039e59 100644 --- a/src/model/instance.rs +++ b/src/model/instance.rs @@ -1,3 +1,4 @@ +use nodeinfo::NodeInfoOwned; use sea_orm::{entity::prelude::*, QuerySelect, SelectColumns}; use crate::errors::UpubError; @@ -14,8 +15,8 @@ pub struct Model { pub version: Option, pub icon: Option, pub down_since: Option, - pub users: Option, - pub posts: Option, + pub users: Option, + pub posts: Option, pub published: ChronoDateTimeUtc, pub updated: ChronoDateTimeUtc, } @@ -57,4 +58,13 @@ impl Entity { .await? .ok_or_else(UpubError::not_found) } + + pub async fn nodeinfo(domain: &str) -> crate::Result { + Ok( + reqwest::get(format!("https://{domain}/nodeinfo/2.0.json")) + .await? + .json() + .await? + ) + } }