diff options
author | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2018-07-30 21:59:04 +0200 |
---|---|---|
committer | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2018-08-01 02:52:42 +0200 |
commit | d5091c3175786e5bcb0449f26cafe1795fd5f5d9 (patch) | |
tree | e1f6c6ac15887981c565b14cd192222124bae035 /lib | |
parent | 32a55e96958e949b69578af49cf41e720916988c (diff) | |
download | pleroma-d5091c3175786e5bcb0449f26cafe1795fd5f5d9.tar.gz |
Allow additionnal schemes in the config
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/formatter.ex | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/pleroma/formatter.ex b/lib/pleroma/formatter.ex index fe3da09ac..e15c08fd6 100644 --- a/lib/pleroma/formatter.ex +++ b/lib/pleroma/formatter.ex @@ -199,10 +199,14 @@ defmodule Pleroma.Formatter do @doc "changes scheme:... urls to html links" def add_links({subs, text}) do + additionnal_schemes = + Application.get_env(:pleroma, :uri_schemes, []) + |> Keyword.get(:additionnal_schemes, []) + links = text |> String.split([" ", "\t", "<br>"]) - |> Enum.filter(fn word -> String.starts_with?(word, @uri_schemes) end) + |> Enum.filter(fn word -> String.starts_with?(word, @uri_schemes ++ additionnal_schemes) end) |> Enum.filter(fn word -> Regex.match?(@link_regex, word) end) |> Enum.map(fn url -> {Ecto.UUID.generate(), url} end) |> Enum.sort_by(fn {_, url} -> -String.length(url) end) |