Add finmoji.
|
@ -22,4 +22,76 @@ def parse_mentions(text) do
|
|||
|> Enum.map(fn ("@" <> match = full_match) -> {full_match, User.get_cached_by_nickname(match)} end)
|
||||
|> Enum.filter(fn ({_match, user}) -> user end)
|
||||
end
|
||||
|
||||
def finmojifiy(text) do
|
||||
emoji_list = [
|
||||
"a_trusted_friend",
|
||||
"alandislands",
|
||||
"association",
|
||||
"auroraborealis",
|
||||
"baby_in_a_box",
|
||||
"bear",
|
||||
"black_gold",
|
||||
"christmasparty",
|
||||
"crosscountryskiing",
|
||||
"cupofcoffee",
|
||||
"education",
|
||||
"fashionista_finns",
|
||||
"finnishlove",
|
||||
"flag",
|
||||
"forest",
|
||||
"four_seasons_of_bbq",
|
||||
"girlpower",
|
||||
"handshake",
|
||||
"happiness",
|
||||
"headbanger",
|
||||
"icebreaker",
|
||||
"iceman",
|
||||
"joulutorttu",
|
||||
"kaamos",
|
||||
"kalsarikannit_f",
|
||||
"kalsarikannit_m",
|
||||
"karjalanpiirakka",
|
||||
"kicksled",
|
||||
"kokko",
|
||||
"lavatanssit",
|
||||
"losthopes_f",
|
||||
"losthopes_m",
|
||||
"mattinykanen",
|
||||
"meanwhileinfinland",
|
||||
"moominmamma",
|
||||
"nordicfamily",
|
||||
"out_of_office",
|
||||
"peacemaker",
|
||||
"perkele",
|
||||
"pesapallo",
|
||||
"polarbear",
|
||||
"pusa_hispida_saimensis",
|
||||
"reindeer",
|
||||
"sami",
|
||||
"sauna_f",
|
||||
"sauna_m",
|
||||
"sauna_whisk",
|
||||
"sisu",
|
||||
"stuck",
|
||||
"suomimainittu",
|
||||
"superfood",
|
||||
"swan",
|
||||
"the_cap",
|
||||
"the_conductor",
|
||||
"the_king",
|
||||
"the_voice",
|
||||
"theoriginalsanta",
|
||||
"tomoffinland",
|
||||
"torillatavataan",
|
||||
"unbreakable",
|
||||
"waiting",
|
||||
"white_nights",
|
||||
"woollysocks"
|
||||
]
|
||||
|
||||
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' />")
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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 @@ def format_input(text, mentions) do
|
|||
|> Formatter.linkify
|
||||
|> String.replace("\n", "<br>\n")
|
||||
|> add_user_links(mentions)
|
||||
|> Formatter.finmojifiy
|
||||
end
|
||||
|
||||
def add_user_links(text, mentions) do
|
||||
|
|
BIN
priv/static/finmoji/1000px/a_trusted_friend.png
Normal file
After Width: | Height: | Size: 88 KiB |
BIN
priv/static/finmoji/1000px/alandislands.png
Normal file
After Width: | Height: | Size: 95 KiB |
BIN
priv/static/finmoji/1000px/association.png
Normal file
After Width: | Height: | Size: 104 KiB |
BIN
priv/static/finmoji/1000px/auroraborealis.png
Normal file
After Width: | Height: | Size: 280 KiB |
BIN
priv/static/finmoji/1000px/baby_in_a_box.png
Normal file
After Width: | Height: | Size: 99 KiB |
BIN
priv/static/finmoji/1000px/bear.png
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
priv/static/finmoji/1000px/black_gold.png
Normal file
After Width: | Height: | Size: 81 KiB |
BIN
priv/static/finmoji/1000px/christmasparty.png
Normal file
After Width: | Height: | Size: 135 KiB |
BIN
priv/static/finmoji/1000px/crosscountryskiing.png
Normal file
After Width: | Height: | Size: 80 KiB |
BIN
priv/static/finmoji/1000px/cupofcoffee.png
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
priv/static/finmoji/1000px/education.png
Normal file
After Width: | Height: | Size: 90 KiB |
BIN
priv/static/finmoji/1000px/fashionista_finns.png
Normal file
After Width: | Height: | Size: 72 KiB |
BIN
priv/static/finmoji/1000px/finnishlove.png
Normal file
After Width: | Height: | Size: 87 KiB |
BIN
priv/static/finmoji/1000px/flag.png
Normal file
After Width: | Height: | Size: 83 KiB |
BIN
priv/static/finmoji/1000px/forest.png
Normal file
After Width: | Height: | Size: 59 KiB |
BIN
priv/static/finmoji/1000px/four_seasons_of_bbq.png
Normal file
After Width: | Height: | Size: 173 KiB |
BIN
priv/static/finmoji/1000px/girlpower.png
Normal file
After Width: | Height: | Size: 63 KiB |
BIN
priv/static/finmoji/1000px/handshake.png
Normal file
After Width: | Height: | Size: 41 KiB |
BIN
priv/static/finmoji/1000px/happiness.png
Normal file
After Width: | Height: | Size: 51 KiB |
BIN
priv/static/finmoji/1000px/headbanger.png
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
priv/static/finmoji/1000px/icebreaker.png
Normal file
After Width: | Height: | Size: 66 KiB |
BIN
priv/static/finmoji/1000px/iceman.png
Normal file
After Width: | Height: | Size: 372 KiB |
BIN
priv/static/finmoji/1000px/joulutorttu.png
Normal file
After Width: | Height: | Size: 59 KiB |
BIN
priv/static/finmoji/1000px/kaamos.png
Normal file
After Width: | Height: | Size: 144 KiB |
BIN
priv/static/finmoji/1000px/kalsarikannit_f.png
Normal file
After Width: | Height: | Size: 98 KiB |
BIN
priv/static/finmoji/1000px/kalsarikannit_m.png
Normal file
After Width: | Height: | Size: 68 KiB |
BIN
priv/static/finmoji/1000px/karjalanpiirakka.png
Normal file
After Width: | Height: | Size: 70 KiB |
BIN
priv/static/finmoji/1000px/kicksled.png
Normal file
After Width: | Height: | Size: 121 KiB |
BIN
priv/static/finmoji/1000px/kokko.png
Normal file
After Width: | Height: | Size: 194 KiB |
BIN
priv/static/finmoji/1000px/lavatanssit.png
Normal file
After Width: | Height: | Size: 139 KiB |
BIN
priv/static/finmoji/1000px/losthopes_f.png
Normal file
After Width: | Height: | Size: 73 KiB |
BIN
priv/static/finmoji/1000px/losthopes_m.png
Normal file
After Width: | Height: | Size: 91 KiB |
BIN
priv/static/finmoji/1000px/mattinykanen.png
Normal file
After Width: | Height: | Size: 159 KiB |
BIN
priv/static/finmoji/1000px/meanwhileinfinland.png
Normal file
After Width: | Height: | Size: 133 KiB |
BIN
priv/static/finmoji/1000px/moominmamma.png
Normal file
After Width: | Height: | Size: 214 KiB |
BIN
priv/static/finmoji/1000px/nordicfamily.png
Normal file
After Width: | Height: | Size: 162 KiB |
BIN
priv/static/finmoji/1000px/out_of_office.png
Normal file
After Width: | Height: | Size: 79 KiB |
BIN
priv/static/finmoji/1000px/peacemaker.png
Normal file
After Width: | Height: | Size: 72 KiB |
BIN
priv/static/finmoji/1000px/perkele.png
Normal file
After Width: | Height: | Size: 72 KiB |
BIN
priv/static/finmoji/1000px/pesapallo.png
Normal file
After Width: | Height: | Size: 62 KiB |
BIN
priv/static/finmoji/1000px/polarbear.png
Normal file
After Width: | Height: | Size: 77 KiB |
BIN
priv/static/finmoji/1000px/pusa_hispida_saimensis.png
Normal file
After Width: | Height: | Size: 61 KiB |
BIN
priv/static/finmoji/1000px/reindeer.png
Normal file
After Width: | Height: | Size: 64 KiB |
BIN
priv/static/finmoji/1000px/sami.png
Normal file
After Width: | Height: | Size: 67 KiB |
BIN
priv/static/finmoji/1000px/sauna_f.png
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
priv/static/finmoji/1000px/sauna_m.png
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
priv/static/finmoji/1000px/sauna_whisk.png
Normal file
After Width: | Height: | Size: 142 KiB |
BIN
priv/static/finmoji/1000px/sisu.png
Normal file
After Width: | Height: | Size: 107 KiB |
BIN
priv/static/finmoji/1000px/stuck.png
Normal file
After Width: | Height: | Size: 59 KiB |
BIN
priv/static/finmoji/1000px/suomimainittu.png
Normal file
After Width: | Height: | Size: 79 KiB |
BIN
priv/static/finmoji/1000px/superfood.png
Normal file
After Width: | Height: | Size: 178 KiB |
BIN
priv/static/finmoji/1000px/swan.png
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
priv/static/finmoji/1000px/the_cap.png
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
priv/static/finmoji/1000px/the_conductor.png
Normal file
After Width: | Height: | Size: 58 KiB |
BIN
priv/static/finmoji/1000px/the_king.png
Normal file
After Width: | Height: | Size: 125 KiB |
BIN
priv/static/finmoji/1000px/the_voice.png
Normal file
After Width: | Height: | Size: 102 KiB |
BIN
priv/static/finmoji/1000px/theoriginalsanta.png
Normal file
After Width: | Height: | Size: 70 KiB |
BIN
priv/static/finmoji/1000px/tomoffinland.png
Normal file
After Width: | Height: | Size: 82 KiB |
BIN
priv/static/finmoji/1000px/torillatavataan.png
Normal file
After Width: | Height: | Size: 222 KiB |
BIN
priv/static/finmoji/1000px/unbreakable.png
Normal file
After Width: | Height: | Size: 86 KiB |
BIN
priv/static/finmoji/1000px/waiting.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
priv/static/finmoji/1000px/white_nights.png
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
priv/static/finmoji/1000px/woollysocks.png
Normal file
After Width: | Height: | Size: 161 KiB |
BIN
priv/static/finmoji/128px/a_trusted_friend-128.png
Normal file
After Width: | Height: | Size: 9.7 KiB |
BIN
priv/static/finmoji/128px/alandislands-128.png
Normal file
After Width: | Height: | Size: 9 KiB |
BIN
priv/static/finmoji/128px/association-128.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
priv/static/finmoji/128px/auroraborealis-128.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
priv/static/finmoji/128px/baby_in_a_box-128.png
Normal file
After Width: | Height: | Size: 9.9 KiB |
BIN
priv/static/finmoji/128px/bear-128.png
Normal file
After Width: | Height: | Size: 6.5 KiB |
BIN
priv/static/finmoji/128px/black_gold-128.png
Normal file
After Width: | Height: | Size: 8.8 KiB |
BIN
priv/static/finmoji/128px/christmasparty-128.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
priv/static/finmoji/128px/crosscountryskiing-128.png
Normal file
After Width: | Height: | Size: 8.3 KiB |
BIN
priv/static/finmoji/128px/cupofcoffee-128.png
Normal file
After Width: | Height: | Size: 5.5 KiB |
BIN
priv/static/finmoji/128px/education-128.png
Normal file
After Width: | Height: | Size: 9 KiB |
BIN
priv/static/finmoji/128px/fashionista_finns-128.png
Normal file
After Width: | Height: | Size: 8.5 KiB |
BIN
priv/static/finmoji/128px/finnishlove-128.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
priv/static/finmoji/128px/flag-128.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
priv/static/finmoji/128px/forest-128.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
priv/static/finmoji/128px/four_seasons_of_bbq-128.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
priv/static/finmoji/128px/girlpower-128.png
Normal file
After Width: | Height: | Size: 6.5 KiB |
BIN
priv/static/finmoji/128px/handshake-128.png
Normal file
After Width: | Height: | Size: 4 KiB |
BIN
priv/static/finmoji/128px/happiness-128.png
Normal file
After Width: | Height: | Size: 6 KiB |
BIN
priv/static/finmoji/128px/headbanger-128.png
Normal file
After Width: | Height: | Size: 8 KiB |
BIN
priv/static/finmoji/128px/icebreaker-128.png
Normal file
After Width: | Height: | Size: 7.8 KiB |
BIN
priv/static/finmoji/128px/iceman-128.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
priv/static/finmoji/128px/joulutorttu-128.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
priv/static/finmoji/128px/kaamos-128.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
priv/static/finmoji/128px/kalsarikannit_f-128.png
Normal file
After Width: | Height: | Size: 9.4 KiB |
BIN
priv/static/finmoji/128px/kalsarikannit_m-128.png
Normal file
After Width: | Height: | Size: 7 KiB |
BIN
priv/static/finmoji/128px/karjalanpiirakka-128.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
BIN
priv/static/finmoji/128px/kicksled-128.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
priv/static/finmoji/128px/kokko-128.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
priv/static/finmoji/128px/lavatanssit-128.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
priv/static/finmoji/128px/losthopes_f-128.png
Normal file
After Width: | Height: | Size: 7 KiB |
BIN
priv/static/finmoji/128px/losthopes_m-128.png
Normal file
After Width: | Height: | Size: 9.8 KiB |
BIN
priv/static/finmoji/128px/mattinykanen-128.png
Normal file
After Width: | Height: | Size: 8.1 KiB |
BIN
priv/static/finmoji/128px/meanwhileinfinland-128.png
Normal file
After Width: | Height: | Size: 12 KiB |