From f909aec050498a366d8b0ed6c1b5439b5b0891f1 Mon Sep 17 00:00:00 2001 From: href Date: Tue, 12 Dec 2017 12:30:24 +0100 Subject: [PATCH] proxy emojis (i fix emojos better than gargon but sshhhhh) --- lib/pleroma/formatter.ex | 3 ++- lib/pleroma/web/media_proxy/media_proxy.ex | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/formatter.ex b/lib/pleroma/formatter.ex index c98db2d94..eed5b5786 100644 --- a/lib/pleroma/formatter.ex +++ b/lib/pleroma/formatter.ex @@ -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}:", "#{emoji}") + String.replace(text, ":#{emoji}:", "#{emoji}") end) end diff --git a/lib/pleroma/web/media_proxy/media_proxy.ex b/lib/pleroma/web/media_proxy/media_proxy.ex index 21ebdfbbc..23efc18fa 100644 --- a/lib/pleroma/web/media_proxy/media_proxy.ex +++ b/lib/pleroma/web/media_proxy/media_proxy.ex @@ -3,6 +3,8 @@ defmodule Pleroma.Web.MediaProxy do def url(nil), do: nil + def url(url = "/" <> _), do: url + def url(url) do config = Application.get_env(:pleroma, :media_proxy, []) if !Keyword.get(config, :enabled, false) or String.starts_with?(url, Pleroma.Web.base_url) do -- 2.45.2