use ammonia::Builder; /// Escape profile colors pub fn color_escape(color: &str) -> String { remove_tags( &color .replace(";", "") .replace("<", "<") .replace(">", "%gt;") .replace("}", "") .replace("{", "") .replace("url(\"", "url(\"/api/v0/util/ext/image?img=") .replace("url('", "url('/api/v0/util/ext/image?img=") .replace("url(https://", "url(/api/v0/util/ext/image?img=https://"), ) } /// Clean profile metadata pub fn remove_tags(input: &str) -> String { Builder::default() .rm_tags(&["img", "a", "span", "p", "h1", "h2", "h3", "h4", "h5", "h6"]) .clean(input) .to_string() .replace("<", "<") .replace(">", ">") .replace("&", "&") .replace("", "