Merge branch 'media-proxy' into 'develop'

Media proxy

See merge request pleroma/pleroma!34
This commit is contained in:
lambda 2017-12-20 14:22:24 +00:00
commit 35ac549a99
10 changed files with 152 additions and 10 deletions

View file

@ -1,5 +1,6 @@
defmodule Pleroma.Formatter do
alias Pleroma.User
alias Pleroma.Web.MediaProxy
@link_regex ~r/https?:\/\/[\w\.\/?=\-#%&@~\(\)]+[\w\/]/u
def linkify(text) do
@ -125,7 +126,7 @@ defmodule Pleroma.Formatter do
end
Enum.reduce(all_emoji, text, fn ({emoji, file}, text) ->
String.replace(text, ":#{emoji}:", "<img height='32px' width='32px' alt='#{emoji}' title='#{emoji}' src='#{file}' />")
String.replace(text, ":#{emoji}:", "<img height='32px' width='32px' alt='#{emoji}' title='#{emoji}' src='#{MediaProxy.url(file)}' />")
end)
end