fix: oops must also set actor id

This commit is contained in:
əlemi 2024-12-29 03:47:55 +01:00
parent b510c592bb
commit a159d01e99
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -95,12 +95,12 @@ pub async fn ap_fetch(
) -> crate::ApiResult<axum::Json<serde_json::Value>> { ) -> crate::ApiResult<axum::Json<serde_json::Value>> {
let _user; // need this for lifetimes let _user; // need this for lifetimes
let pkey = match auth { let (from, key) = match auth {
crate::Identity::Anonymous => { crate::Identity::Anonymous => {
if !ctx.cfg().security.allow_public_debugger { if !ctx.cfg().security.allow_public_debugger {
return Err(crate::ApiError::unauthorized()); return Err(crate::ApiError::unauthorized());
} }
ctx.pkey() (ctx.base(), ctx.pkey())
}, },
crate::Identity::Remote { .. } => return Err(crate::ApiError::forbidden()), crate::Identity::Remote { .. } => return Err(crate::ApiError::forbidden()),
crate::Identity::Local { internal, .. } => { crate::Identity::Local { internal, .. } => {
@ -108,10 +108,10 @@ pub async fn ap_fetch(
.one(ctx.db()) .one(ctx.db())
.await?; .await?;
match _user { match _user {
None => ctx.pkey(), None => (ctx.base(), ctx.pkey()),
Some(ref u) => match u.private_key { Some(ref u) => match u.private_key {
None => ctx.pkey(), None => (ctx.base(), ctx.pkey()),
Some(ref k) => k.as_str(), Some(ref k) => (u.id.as_str(), k.as_str()),
} }
} }
}, },
@ -121,8 +121,8 @@ pub async fn ap_fetch(
Method::GET, Method::GET,
&query.uri, &query.uri,
None, None,
ctx.base(), from,
pkey, key,
&format!("{}+fetch", ctx.domain()), &format!("{}+fetch", ctx.domain()),
) )
.await? .await?