about summary refs log tree commit diff
path: root/kittybox-rs/src
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2023-07-08 21:04:39 +0300
committerVika <vika@fireburn.ru>2023-07-08 21:04:39 +0300
commit85d4a67ddf8010da947f594aa043c17d70feb3a7 (patch)
tree9609ef5bab5ae6706aa6ce9f37e7687ab52e31ce /kittybox-rs/src
parent372fd2d22fc62b812e4bf496578f65e69315ea9f (diff)
downloadkittybox-85d4a67ddf8010da947f594aa043c17d70feb3a7.tar.zst
onboarding: fix improper usage of the put_post API
Diffstat (limited to 'kittybox-rs/src')
-rw-r--r--kittybox-rs/src/frontend/onboarding.rs6
1 files changed, 5 insertions, 1 deletions
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<D: Storage + 'static>(
 ) -> 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<D: Storage + 'static>(
         ));
     }
 
+    tracing::debug!("Setting settings...");
     let user_domain = format!(
         "{}{}",
         user.me.host_str().unwrap(),
@@ -88,7 +91,7 @@ async fn onboard<D: Storage + 'static>(
         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<D: Storage + 'static>(
             .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 {