diff --git a/app.py b/app.py index e7c98e6..a899489 100644 --- a/app.py +++ b/app.py @@ -69,6 +69,7 @@ from config import BASE_URL from config import DB from config import DEBUG_MODE from config import DOMAIN +from config import EMOJI_TPL from config import EMOJIS from config import HEADERS from config import ICON_URL @@ -88,8 +89,6 @@ from utils.key import get_secret_key from utils.lookup import lookup from utils.media import Kind -EMOJI = '' - p = PousseTaches( os.getenv("MICROBLOGPUB_POUSSETACHES_HOST", "http://localhost:7991"), os.getenv("MICROBLOGPUB_INTERNAL_HOST", "http://localhost:5000"), @@ -243,7 +242,7 @@ def _get_file_url(url, size, kind): @app.template_filter() def emojify(text): return emoji_unicode.replace( - text, lambda e: EMOJI.format(filename=e.code_points, raw=e.unicode) + text, lambda e: EMOJI_TPL.format(filename=e.code_points, raw=e.unicode) ) @@ -314,7 +313,7 @@ def is_from_outbox(t): def clean(html): out = clean_html(html) return emoji_unicode.replace( - out, lambda e: EMOJI.format(filename=e.code_points, raw=e.unicode) + out, lambda e: EMOJI_TPL.format(filename=e.code_points, raw=e.unicode) ) diff --git a/config.py b/config.py index 817bacf..bec0202 100644 --- a/config.py +++ b/config.py @@ -219,5 +219,11 @@ ME = { "publicKey": KEY.to_dict(), } -# TODO(tsileo): read the config from the YAML if set EMOJIS = "😺 😸 😹 😻 😼 😽 🙀 😿 😾" +if conf.get("emojis"): + EMOJIS = conf["emojis"] + +# Emoji template for the FE +EMOJI_TPL = '' +if conf.get("emoji_tpl"): + EMOJI_TPL = conf["emoji_tpl"] diff --git a/templates/new.html b/templates/new.html index ddd16c5..a03cc62 100644 --- a/templates/new.html +++ b/templates/new.html @@ -25,7 +25,7 @@
{% for emoji in emojis %} -{{ emoji }} +{{ emoji | emojify | safe }} {% endfor %}