use crate::{
apub::{
activities::{generate_activity_id, send_activity_to_community},
+ check_is_apub_id_valid,
create_apub_response,
create_apub_tombstone_response,
create_tombstone,
None => None,
};
+ let ap_id = note.id_unchecked().unwrap().to_string();
+ check_is_apub_id_valid(&Url::parse(&ap_id)?)?;
+
Ok(CommentForm {
creator_id: creator.id,
post_id: post.id,
published: note.published().map(|u| u.to_owned().naive_local()),
updated: note.updated().map(|u| u.to_owned().naive_local()),
deleted: None,
- ap_id: note.id_unchecked().unwrap().to_string(),
+ ap_id,
local: false,
})
}
use crate::{
apub::{
activities::{generate_activity_id, send_activity},
+ check_is_apub_id_valid,
create_apub_response,
create_apub_tombstone_response,
create_tombstone,
.unwrap();
let creator = get_or_fetch_and_upsert_user(creator_uri, client, pool).await?;
+ let actor_id = group.inner.id_unchecked().unwrap().to_string();
+ check_is_apub_id_valid(&Url::parse(&actor_id)?)?;
Ok(CommunityForm {
name: group
updated: group.inner.updated().map(|u| u.to_owned().naive_local()),
deleted: None,
nsfw: group.ext_one.sensitive,
- actor_id: group.inner.id_unchecked().unwrap().to_string(),
+ actor_id,
local: false,
private_key: None,
public_key: Some(group.ext_two.to_owned().public_key.public_key_pem),
use crate::{
apub::{
activities::{generate_activity_id, send_activity_to_community},
+ check_is_apub_id_valid,
create_apub_response,
create_apub_tombstone_response,
create_tombstone,
None => (None, None, None),
};
+ let ap_id = page.inner.id_unchecked().unwrap().to_string();
+ check_is_apub_id_valid(&Url::parse(&ap_id)?)?;
+
let url = page
.inner
.url()
embed_description,
embed_html,
thumbnail_url,
- ap_id: page.inner.id_unchecked().unwrap().to_string(),
+ ap_id,
local: false,
})
}
use crate::{
apub::{
activities::{generate_activity_id, send_activity},
+ check_is_apub_id_valid,
create_tombstone,
fetcher::get_or_fetch_and_upsert_user,
insert_activity,
.unwrap();
let creator = get_or_fetch_and_upsert_user(&creator_actor_id, client, pool).await?;
-
let recipient_actor_id = note.to().unwrap().clone().single_xsd_any_uri().unwrap();
-
let recipient = get_or_fetch_and_upsert_user(&recipient_actor_id, client, pool).await?;
+ let ap_id = note.id_unchecked().unwrap().to_string();
+ check_is_apub_id_valid(&Url::parse(&ap_id)?)?;
Ok(PrivateMessageForm {
creator_id: creator.id,
updated: note.updated().map(|u| u.to_owned().naive_local()),
deleted: None,
read: None,
- ap_id: note.id_unchecked().unwrap().to_string(),
+ ap_id,
local: false,
})
}
use crate::{
apub::{
activities::{generate_activity_id, send_activity},
+ check_is_apub_id_valid,
create_apub_response,
insert_activity,
ActorType,
None => None,
};
+ // TODO: here and in community we could actually check against the exact domain where we fetched
+ // the actor from, if we can pass it in somehow
+ let actor_id = person.id_unchecked().unwrap().to_string();
+ check_is_apub_id_valid(&Url::parse(&actor_id)?)?;
+
Ok(UserForm {
name: person
.name()
show_avatars: false,
send_notifications_to_email: false,
matrix_user_id: None,
- actor_id: person.id_unchecked().unwrap().to_string(),
+ actor_id,
bio: person
.inner
.summary()