From 85d4a67ddf8010da947f594aa043c17d70feb3a7 Mon Sep 17 00:00:00 2001 From: Vika Date: Sat, 8 Jul 2023 21:04:39 +0300 Subject: onboarding: fix improper usage of the put_post API --- kittybox-rs/src/frontend/onboarding.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'kittybox-rs/src') diff --git a/kittybox-rs/src/frontend/onboarding.rs b/kittybox-rs/src/frontend/onboarding.rs index 3f73e62..4b62d87 100644 --- a/kittybox-rs/src/frontend/onboarding.rs +++ b/kittybox-rs/src/frontend/onboarding.rs @@ -54,12 +54,14 @@ async fn onboard( ) -> Result<(), FrontendError> { // Create a user to pass to the backend // At this point the site belongs to nobody, so it is safe to do + tracing::debug!("Creating user..."); let user = kittybox_indieauth::TokenData { me: user_uid.clone(), client_id: "https://kittybox.fireburn.ru/".parse().unwrap(), scope: kittybox_indieauth::Scopes::new(vec![kittybox_indieauth::Scope::Create]), iat: None, exp: None }; + tracing::debug!("User data: {:?}", user); if data.user["type"][0] != "h-card" || data.first_post["type"][0] != "h-entry" { return Err(FrontendError::with_code( @@ -68,6 +70,7 @@ async fn onboard( )); } + tracing::debug!("Setting settings..."); let user_domain = format!( "{}{}", user.me.host_str().unwrap(), @@ -88,7 +91,7 @@ async fn onboard( hcard["properties"]["uid"] = serde_json::json!([&user_uid]); crate::micropub::normalize_mf2(hcard, &user) }; - db.put_post(&hcard, user_uid.as_str()) + db.put_post(&hcard, user_domain.as_str()) .await .map_err(FrontendError::from)?; @@ -111,6 +114,7 @@ async fn onboard( .map_err(FrontendError::from)?; } let (uid, post) = crate::micropub::normalize_mf2(data.first_post, &user); + tracing::debug!("Posting first post {}...", uid); crate::micropub::_post(&user, uid, post, db, http) .await .map_err(|e| FrontendError { -- cgit 1.4.1