From 960f7be291e8669ab5466109d202a034f36c17b8 Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 15 Jul 2024 14:03:22 +0200 Subject: [PATCH] fix: added new fields to constructors --- Cargo.lock | 5 ++++- upub/cli/src/faker.rs | 3 +++ upub/core/src/init.rs | 3 +++ upub/core/src/model/actor.rs | 2 +- upub/core/src/traits/admin.rs | 3 +++ 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1c04abe..f53a988 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -140,7 +140,7 @@ checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c" [[package]] name = "apb" -version = "0.2.1" +version = "0.2.2" dependencies = [ "async-trait", "chrono", @@ -4793,6 +4793,7 @@ dependencies = [ "async-trait", "base64 0.22.1", "chrono", + "hmac", "httpsign", "jrd", "nodeinfo", @@ -4804,6 +4805,7 @@ dependencies = [ "serde-inline-default", "serde_default", "serde_json", + "sha2", "sha256", "thiserror", "tokio", @@ -4841,6 +4843,7 @@ dependencies = [ "chrono", "clap", "futures", + "mdhtml", "openssl", "sea-orm", "serde_json", diff --git a/upub/cli/src/faker.rs b/upub/cli/src/faker.rs index ce996b4..1ba9f91 100644 --- a/upub/cli/src/faker.rs +++ b/upub/cli/src/faker.rs @@ -21,6 +21,9 @@ pub async fn faker(ctx: upub::Context, count: i64) -> Result<(), sea_orm::DbErr> followers: None, followers_count: 0, statuses_count: count as i32, + fields: vec![], + also_known_as: vec![], + moved_to: None, icon: Some("https://cdn.alemi.dev/social/circle-square.png".to_string()), image: Some("https://cdn.alemi.dev/social/someriver-xs.jpg".to_string()), inbox: None, diff --git a/upub/core/src/init.rs b/upub/core/src/init.rs index 8522c62..69b01ef 100644 --- a/upub/core/src/init.rs +++ b/upub/core/src/init.rs @@ -34,6 +34,9 @@ pub async fn application( domain: Set(domain.clone()), preferred_username: Set(domain.clone()), actor_type: Set(apb::ActorType::Application), + also_known_as: Set(vec![]), + moved_to: Set(None), + fields: Set(vec![]), // TODO we could put some useful things here actually private_key: Set(Some(privk)), public_key: Set(pubk), following: Set(None), diff --git a/upub/core/src/model/actor.rs b/upub/core/src/model/actor.rs index c9707ed..fea8675 100644 --- a/upub/core/src/model/actor.rs +++ b/upub/core/src/model/actor.rs @@ -210,7 +210,7 @@ impl Model { .set_attachment(apb::Node::array( self.fields .into_iter() - .filter_map(|x| serde_json::to_value(&x).ok()) + .filter_map(|x| serde_json::to_value(x).ok()) .collect() )) .set_published(Some(self.published)) diff --git a/upub/core/src/traits/admin.rs b/upub/core/src/traits/admin.rs index ef3596c..bedaaea 100644 --- a/upub/core/src/traits/admin.rs +++ b/upub/core/src/traits/admin.rs @@ -35,11 +35,14 @@ impl Administrable for crate::Context { domain: Set(domain), summary: Set(summary), preferred_username: Set(username.clone()), + fields: Set(vec![]), following: Set(None), following_count: Set(0), followers: Set(None), followers_count: Set(0), statuses_count: Set(0), + also_known_as: Set(vec![]), + moved_to: Set(None), icon: Set(avatar_url), image: Set(banner_url), inbox: Set(None),