diff --git a/upub/core/src/server/auth.rs b/upub/core/src/server/auth.rs index 1516bbc..226dd96 100644 --- a/upub/core/src/server/auth.rs +++ b/upub/core/src/server/auth.rs @@ -10,6 +10,7 @@ use super::{fetcher::Fetcher, httpsign::HttpSignature}; pub enum Identity { Anonymous, Remote { + user: String, domain: String, internal: i64, }, @@ -124,11 +125,11 @@ where .verify(&user.public_key) { Ok(true) => { - // TODO can we avoid this extra db rountrip made on each server fetch? + let user = user.id; let domain = Context::server(&user_id); // TODO this will fail because we never fetch and insert into instance oops let internal = model::instance::Entity::domain_to_internal(&domain, ctx.db()).await?; - identity = Identity::Remote { domain, internal }; + identity = Identity::Remote { user, domain, internal }; }, Ok(false) => tracing::warn!("invalid signature: {http_signature:?}"), Err(e) => tracing::error!("error verifying signature: {e}"), diff --git a/upub/routes/src/activitypub/inbox.rs b/upub/routes/src/activitypub/inbox.rs index f3365f3..2613579 100644 --- a/upub/routes/src/activitypub/inbox.rs +++ b/upub/routes/src/activitypub/inbox.rs @@ -38,6 +38,7 @@ macro_rules! pretty_json { } +#[tracing::instrument(level = "info", skip(ctx), fields(activity = %activity))] pub async fn post( State(ctx): State, AuthIdentity(auth): AuthIdentity, diff --git a/upub/routes/src/activitypub/user/outbox.rs b/upub/routes/src/activitypub/user/outbox.rs index 62b3d6e..9719eda 100644 --- a/upub/routes/src/activitypub/user/outbox.rs +++ b/upub/routes/src/activitypub/user/outbox.rs @@ -37,6 +37,7 @@ pub async fn page( .await } +#[tracing::instrument(level = "info", skip(ctx), fields(activity = %activity))] pub async fn post( State(ctx): State, Path(id): Path,