},
serde_json::Value::Object(_) => {
let uid = object.id().unwrap_or_default().to_string();
let uri = Uri::web(U::Actor, &uid);
let avatar_url = object.icon().get().map(|x| x.url().id().str().unwrap_or(DEFAULT_AVATAR_URL.into())).unwrap_or(DEFAULT_AVATAR_URL.into());
let username = object.preferred_username().unwrap_or_default().to_string();
let domain = object.id().unwrap_or_default().replace("https://", "").split('/').next().unwrap_or_default().to_string();
let display_name = object.name().unwrap_or_default().to_string();
view! {
}
}
}
#[component]
fn DisplayName(mut name: String) -> impl IntoView {
let custom_emoji_regex = regex::Regex::new(r":\w+:").expect("failed compiling regex pattern");
for m in custom_emoji_regex.find_iter(&name.clone()) {
// TODO this is a clear unmitigated unsanitized html injection ahahahahaha but accounts
// with many custom emojis in their names mess with my frontend and i dont want to
// deal with it rn
name = name.replace(m.as_str(), &format!("[::]", m.as_str()));
}
view! { }
}
#[component]
pub fn FollowRequestButtons(activity_id: String, actor_id: String) -> impl IntoView {
let auth = use_context::().expect("missing auth context");
// TODO lmao what is going on with this double move / triple clone ???????????
let _activity_id = activity_id.clone();
let _actor_id = actor_id.clone();
let from_actor = CACHE.get(&activity_id).map(|x| x.actor().id().str().unwrap_or_default()).unwrap_or_default();
let _from_actor = from_actor.clone();
if actor_id == auth.user_id() {
Some(view! {
})
} else {
None
}
}
async fn send_follow_response(kind: apb::ActivityType, target: String, to: String, auth: Auth) {
let payload = serde_json::Value::Object(serde_json::Map::default())
.set_activity_type(Some(kind))
.set_object(apb::Node::link(target))
.set_to(apb::Node::links(vec![to]));
if let Err(e) = Http::post(&auth.outbox(), &payload, auth).await {
tracing::error!("failed posting follow response: {e}");
}
}