diff options
author | Roger Braun <roger@rogerbraun.net> | 2017-09-16 16:49:46 +0200 |
---|---|---|
committer | Roger Braun <roger@rogerbraun.net> | 2017-09-16 16:49:46 +0200 |
commit | 7c82b8219734102ff24d9dc24226c08351e608cc (patch) | |
tree | d9b95270a24505f08fd671bcd9ccd6e96933431d /lib | |
parent | 959e993c7d112d9a30baae3d403687903a7f6a27 (diff) | |
download | pleroma-7c82b8219734102ff24d9dc24226c08351e608cc.tar.gz |
Make emoji configurable in files.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/formatter.ex | 14 | ||||
-rw-r--r-- | lib/pleroma/web/endpoint.ex | 2 |
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/pleroma/formatter.ex b/lib/pleroma/formatter.ex index e9f4bf06b..728d2b3e8 100644 --- a/lib/pleroma/formatter.ex +++ b/lib/pleroma/formatter.ex @@ -93,7 +93,19 @@ defmodule Pleroma.Formatter do {finmoji, "/finmoji/128px/#{finmoji}-128.png"} end) - @emoji @finmoji_with_filenames + @emoji_from_file (with {:ok, file} <- File.read("config/emoji.txt") do + file + |> String.trim + |> String.split("\n") + |> Enum.map(fn(line) -> + [name, file] = String.split(line, ", ") + {name, file} + end) + else + _ -> [] + end) + + @emoji @finmoji_with_filenames ++ @emoji_from_file def emojify(text, additional \\ nil) do all_emoji = if additional do diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex index e869448de..a1b4108cd 100644 --- a/lib/pleroma/web/endpoint.ex +++ b/lib/pleroma/web/endpoint.ex @@ -11,7 +11,7 @@ defmodule Pleroma.Web.Endpoint do at: "/media", from: "uploads", gzip: false plug Plug.Static, at: "/", from: :pleroma, - only: ~w(index.html static finmoji) + only: ~w(index.html static finmoji emoji) # Code reloading can be explicitly enabled under the # :code_reloader configuration of your endpoint. |