mirror of
https://github.com/versia-pub/activitypub.git
synced 2025-12-06 06:38:20 +01:00
fix: correct urls in AP user
This commit is contained in:
parent
d33de465bf
commit
071f6dcbd8
12
src/http.rs
12
src/http.rs
|
|
@ -115,7 +115,17 @@ pub async fn webfinger(
|
|||
let res = resolve("acct:".to_string() + name + "@" + &LYSAND_DOMAIN, true)
|
||||
.await
|
||||
.unwrap();
|
||||
user = db_user_from_url(Url::parse(res.links.get(0).clone().unwrap().href.clone().unwrap().as_str())?).await?;
|
||||
user = db_user_from_url(Url::parse(
|
||||
res.links
|
||||
.get(0)
|
||||
.clone()
|
||||
.unwrap()
|
||||
.href
|
||||
.clone()
|
||||
.unwrap()
|
||||
.as_str(),
|
||||
)?)
|
||||
.await?;
|
||||
}
|
||||
Ok(HttpResponse::Ok().json(build_webfinger_response(
|
||||
query.resource.clone(),
|
||||
|
|
|
|||
|
|
@ -134,20 +134,27 @@ async fn fetch_user(
|
|||
None => return Ok(HttpResponse::NotFound().finish()),
|
||||
};
|
||||
|
||||
let bridge_user_url = generate_user_id(&API_DOMAIN, &user.id)?;
|
||||
let inbox = Url::parse(&format!(
|
||||
"https://{}/{}/inbox",
|
||||
API_DOMAIN.to_string(),
|
||||
&user.username.clone()
|
||||
))?;
|
||||
|
||||
Ok(HttpResponse::Ok()
|
||||
.content_type(FEDERATION_CONTENT_TYPE)
|
||||
.json(WithContext::new_default(crate::objects::person::Person {
|
||||
kind: Default::default(),
|
||||
id: generate_user_id(&API_DOMAIN, &user.id)?.into(),
|
||||
id: bridge_user_url.clone().into(),
|
||||
preferred_username: user.username.clone(),
|
||||
name: user.name.clone(),
|
||||
summary: user.summary.clone(),
|
||||
url: Url::parse(user.url.as_str()).unwrap(),
|
||||
inbox: Url::parse(user.inbox.as_str()).unwrap(),
|
||||
inbox,
|
||||
public_key: PublicKey {
|
||||
owner: Url::parse(user.url.as_str()).unwrap(),
|
||||
owner: bridge_user_url.clone(),
|
||||
public_key_pem: user.public_key,
|
||||
id: format!("{}#main-key", Url::parse(user.url.as_str()).unwrap()),
|
||||
id: format!("{}#main-key", bridge_user_url.clone()),
|
||||
},
|
||||
})))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue