mirror of
https://github.com/versia-pub/activitypub.git
synced 2025-12-06 06:38:20 +01:00
fix: lysand ap fetch UUID change and wrong URI
This commit is contained in:
parent
b5b4144f39
commit
45a7555db3
|
|
@ -110,7 +110,7 @@ pub async fn lysand_user_from_db(
|
||||||
);
|
);
|
||||||
let user = super::objects::User {
|
let user = super::objects::User {
|
||||||
rtype: super::objects::LysandType::User,
|
rtype: super::objects::LysandType::User,
|
||||||
id: uuid::Uuid::parse_str(&user.id)?,
|
id: uuid::Uuid::try_parse(&user.id)?,
|
||||||
uri: url.clone(),
|
uri: url.clone(),
|
||||||
username: user.username,
|
username: user.username,
|
||||||
display_name,
|
display_name,
|
||||||
|
|
@ -129,7 +129,8 @@ pub async fn lysand_user_from_db(
|
||||||
created_at: OffsetDateTime::from_unix_timestamp(user.created_at.timestamp()).unwrap(),
|
created_at: OffsetDateTime::from_unix_timestamp(user.created_at.timestamp()).unwrap(),
|
||||||
public_key: PublicKey {
|
public_key: PublicKey {
|
||||||
actor: url.clone(),
|
actor: url.clone(),
|
||||||
public_key: "AAAAC3NzaC1lZDI1NTE5AAAAIMxsX+lEWkHZt9NOvn9yYFP0Z++186LY4b97C4mwj/f2".to_string(), // dummy key
|
public_key: "AAAAC3NzaC1lZDI1NTE5AAAAIMxsX+lEWkHZt9NOvn9yYFP0Z++186LY4b97C4mwj/f2"
|
||||||
|
.to_string(), // dummy key
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
Ok(user)
|
Ok(user)
|
||||||
|
|
|
||||||
|
|
@ -58,9 +58,18 @@ async fn query_post(
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(user) = query.user_url.clone() {
|
if let Some(user) = query.user_url.clone() {
|
||||||
let target = ObjectId::<user::Model>::from(user)
|
let opt_model = prelude::User::find()
|
||||||
|
.filter(user::Column::Url.eq(user.as_str()))
|
||||||
|
.one(db)
|
||||||
|
.await?;
|
||||||
|
let target;
|
||||||
|
if let Some(model) = opt_model {
|
||||||
|
target = model;
|
||||||
|
} else {
|
||||||
|
target = ObjectId::<user::Model>::from(user)
|
||||||
.dereference(&data.to_request_data())
|
.dereference(&data.to_request_data())
|
||||||
.await?;
|
.await?;
|
||||||
|
}
|
||||||
let lysand_user = lysand_user_from_db(target).await?;
|
let lysand_user = lysand_user_from_db(target).await?;
|
||||||
|
|
||||||
return Ok(HttpResponse::Ok()
|
return Ok(HttpResponse::Ok()
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ impl Object for user::Model {
|
||||||
public_key: Set(json.public_key.public_key_pem),
|
public_key: Set(json.public_key.public_key_pem),
|
||||||
local: Set(false),
|
local: Set(false),
|
||||||
summary: Set(json.summary),
|
summary: Set(json.summary),
|
||||||
url: Set(json.url.to_string()),
|
url: Set(json.id.to_string()),
|
||||||
follower_count: Set(0),
|
follower_count: Set(0),
|
||||||
following_count: Set(0),
|
following_count: Set(0),
|
||||||
created_at: Set(Utc::now()),
|
created_at: Set(Utc::now()),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue