forked from alemi/upub
fix: dispatcher fetch app key for app deliveries
This commit is contained in:
parent
1d8b69dda7
commit
b62b461305
1 changed files with 17 additions and 5 deletions
|
@ -84,12 +84,24 @@ async fn worker(db: DatabaseConnection, domain: String, poll_interval: u64, mut
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let key = if delivery.actor.ends_with(&domain) {
|
||||||
|
let Some(model::application::Model { private_key: key, .. }) = model::application::Entity::find()
|
||||||
|
.one(&db).await?
|
||||||
|
else {
|
||||||
|
tracing::error!("no private key configured for application");
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
key
|
||||||
|
} else {
|
||||||
let Some(model::user::Model{ private_key: Some(key), .. }) = model::user::Entity::find_by_id(&delivery.actor)
|
let Some(model::user::Model{ private_key: Some(key), .. }) = model::user::Entity::find_by_id(&delivery.actor)
|
||||||
.one(&db).await?
|
.one(&db).await?
|
||||||
else {
|
else {
|
||||||
tracing::error!("can not dispatch activity for user without private key: {}", delivery.actor);
|
tracing::error!("can not dispatch activity for user without private key: {}", delivery.actor);
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
key
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
if let Err(e) = Context::request(
|
if let Err(e) = Context::request(
|
||||||
Method::POST, &delivery.target,
|
Method::POST, &delivery.target,
|
||||||
|
|
Loading…
Reference in a new issue