Commit 66b4fee8 authored by lain's avatar lain
Browse files

Add finmoji.

parent 18fb0cf9
......@@ -22,4 +22,76 @@ defmodule Pleroma.Formatter do
|> ("@" <> match = full_match) -> {full_match, User.get_cached_by_nickname(match)} end)
|> Enum.filter(fn ({_match, user}) -> user end)
def finmojifiy(text) do
emoji_list = [
Enum.reduce(emoji_list, text, fn (emoji, text) ->
String.replace(text, ":#{String.replace(emoji, "_", "")}:", "<img height='32px' width='32px' alt='#{emoji}' title='#{emoji}' src='#{Pleroma.Web.Endpoint.static_url}/finmoji/128px/#{emoji}-128.png' />")
......@@ -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)
only: ~w(index.html static finmoji)
# Code reloading can be explicitly enabled under the
# :code_reloader configuration of your endpoint.
......@@ -22,6 +22,7 @@ defmodule Pleroma.Web.TwitterAPI.Utils do
|> Formatter.linkify
|> String.replace("\n", "<br>\n")
|> add_user_links(mentions)
|> Formatter.finmojifiy
def add_user_links(text, mentions) do
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment