Log activities coming to instance actor inbox
This commit is contained in:
parent
8c8aee59cd
commit
ec36dea0c9
2 changed files with 19 additions and 5 deletions
|
@ -92,12 +92,12 @@ async fn inbox(
|
||||||
web::Path(username): web::Path<String>,
|
web::Path(username): web::Path<String>,
|
||||||
activity: web::Json<serde_json::Value>,
|
activity: web::Json<serde_json::Value>,
|
||||||
) -> Result<HttpResponse, HttpError> {
|
) -> Result<HttpResponse, HttpError> {
|
||||||
log::info!("received to '{}' inbox: {}", username, activity);
|
log::info!("received in '{}' inbox: {}", username, activity);
|
||||||
if let Err(err) = verify_http_signature(&config, &db_pool, &request).await {
|
if let Err(err) = verify_http_signature(&config, &db_pool, &request).await {
|
||||||
log::warn!("invalid signature: {}", err);
|
log::warn!("invalid signature: {}", err);
|
||||||
}
|
}
|
||||||
receive_activity(&config, &db_pool, username, activity.into_inner()).await?;
|
receive_activity(&config, &db_pool, username, activity.into_inner()).await?;
|
||||||
Ok(HttpResponse::Ok().body("success"))
|
Ok(HttpResponse::Ok().finish())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
@ -149,8 +149,8 @@ pub fn actor_scope() -> Scope {
|
||||||
.service(following_collection)
|
.service(following_collection)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/actor")]
|
#[get("")]
|
||||||
pub async fn instance_actor_view(
|
async fn instance_actor_view(
|
||||||
config: web::Data<Config>,
|
config: web::Data<Config>,
|
||||||
) -> Result<HttpResponse, HttpError> {
|
) -> Result<HttpResponse, HttpError> {
|
||||||
let actor = get_instance_actor(&config.instance())
|
let actor = get_instance_actor(&config.instance())
|
||||||
|
@ -161,6 +161,20 @@ pub async fn instance_actor_view(
|
||||||
Ok(response)
|
Ok(response)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[post("/inbox")]
|
||||||
|
async fn instance_actor_inbox(
|
||||||
|
activity: web::Json<serde_json::Value>,
|
||||||
|
) -> Result<HttpResponse, HttpError> {
|
||||||
|
log::info!("received in instance inbox: {}", activity);
|
||||||
|
Ok(HttpResponse::Ok().finish())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn instance_actor_scope() -> Scope {
|
||||||
|
web::scope("/actor")
|
||||||
|
.service(instance_actor_view)
|
||||||
|
.service(instance_actor_inbox)
|
||||||
|
}
|
||||||
|
|
||||||
#[get("/objects/{object_id}")]
|
#[get("/objects/{object_id}")]
|
||||||
pub async fn object_view(
|
pub async fn object_view(
|
||||||
config: web::Data<Config>,
|
config: web::Data<Config>,
|
||||||
|
|
|
@ -88,7 +88,7 @@ async fn main() -> std::io::Result<()> {
|
||||||
.service(timeline_api_scope())
|
.service(timeline_api_scope())
|
||||||
.service(webfinger::get_descriptor)
|
.service(webfinger::get_descriptor)
|
||||||
.service(activitypub::actor_scope())
|
.service(activitypub::actor_scope())
|
||||||
.service(activitypub::instance_actor_view)
|
.service(activitypub::instance_actor_scope())
|
||||||
.service(activitypub::object_view)
|
.service(activitypub::object_view)
|
||||||
.service(nodeinfo::get_nodeinfo)
|
.service(nodeinfo::get_nodeinfo)
|
||||||
.service(nodeinfo::get_nodeinfo_2_0);
|
.service(nodeinfo::get_nodeinfo_2_0);
|
||||||
|
|
Loading…
Reference in a new issue