Compare commits

..

No commits in common. "b2d23b7c4cd37a9e64f5528190d76f4f8966c185" and "c173064627e4c68e189ed28e7ee7b276e5f080fe" have entirely different histories.

2 changed files with 3 additions and 6 deletions

View file

@ -3,10 +3,6 @@ use crate::{prelude::*, DEFAULT_AVATAR_URL};
use apb::{field::OptionalString, Activity, ActivityMut, Actor, Base, Object, ObjectMut}; use apb::{field::OptionalString, Activity, ActivityMut, Actor, Base, Object, ObjectMut};
lazy_static::lazy_static! {
static ref REGEX: regex::Regex = regex::Regex::new(r":\w+:").expect("failed compiling custom emoji regex");
}
#[component] #[component]
pub fn ActorStrip(object: crate::Object) -> impl IntoView { pub fn ActorStrip(object: crate::Object) -> impl IntoView {
let actor_id = object.id().unwrap_or_default().to_string(); let actor_id = object.id().unwrap_or_default().to_string();
@ -55,7 +51,8 @@ pub fn ActorBanner(object: crate::Object) -> impl IntoView {
#[component] #[component]
fn DisplayName(mut name: String) -> impl IntoView { fn DisplayName(mut name: String) -> impl IntoView {
for m in REGEX.find_iter(&name.clone()) { 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 // 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 // with many custom emojis in their names mess with my frontend and i dont want to
// deal with it rn // deal with it rn

View file

@ -7,7 +7,7 @@ use crate::prelude::*;
use apb::{field::OptionalString, target::Addressed, ActivityMut, Base, Collection, CollectionMut, Object, ObjectMut}; use apb::{field::OptionalString, target::Addressed, ActivityMut, Base, Collection, CollectionMut, Object, ObjectMut};
lazy_static::lazy_static! { lazy_static::lazy_static! {
static ref REGEX: Regex = regex::Regex::new("<a href=\"([-a-zA-Z0-9()@:%_\\+.~#?&\\/=]+)\" class=\"u-url mention\">@(\\w+)(@\\w+|)</a>").expect("failed compiling @ regex"); static ref REGEX: Regex = regex::Regex::new("<a href=\"(.+)\" class=\"u-url mention\">@(\\w+)(@\\w+|)</a>").expect("failed compiling @ regex");
} }
#[component] #[component]