forked from YokaiRick/akkoma
Strip html from emoji stuff.
This commit is contained in:
parent
5da2355e71
commit
fbe9aa3506
2 changed files with 7 additions and 1 deletions
|
@ -132,6 +132,8 @@ def emojify(text, additional \\ nil) do
|
|||
end
|
||||
|
||||
Enum.reduce(all_emoji, text, fn ({emoji, file}, text) ->
|
||||
emoji = HtmlSanitizeEx.strip_tags(emoji)
|
||||
file = HtmlSanitizeEx.strip_tags(file)
|
||||
String.replace(text, ":#{emoji}:", "<img height='32px' width='32px' alt='#{emoji}' title='#{emoji}' src='#{MediaProxy.url(file)}' />")
|
||||
end)
|
||||
end
|
||||
|
|
|
@ -77,7 +77,11 @@ def render("status.json", %{activity: %{data: %{"object" => object}} = activity}
|
|||
reply_to_user = reply_to && User.get_cached_by_ap_id(reply_to.data["actor"])
|
||||
|
||||
emojis = (activity.data["object"]["emoji"] || [])
|
||||
|> Enum.map(fn {name, url} -> %{ shortcode: name, url: url, static_url: url } end)
|
||||
|> Enum.map(fn {name, url} ->
|
||||
name = HtmlSanitizeEx.strip_tags(name)
|
||||
url = HtmlSanitizeEx.strip_tags(url)
|
||||
%{ shortcode: name, url: url, static_url: url }
|
||||
end)
|
||||
|
||||
%{
|
||||
id: to_string(activity.id),
|
||||
|
|
Loading…
Reference in a new issue