diff --git a/app.py b/app.py
index eef70fd..9f5b112 100644
--- a/app.py
+++ b/app.py
@@ -18,6 +18,7 @@ from urllib.parse import urlencode
from urllib.parse import urlparse
import bleach
+import emoji_unicode
import mf2py
import requests
import timeago
@@ -87,6 +88,8 @@ 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"),
@@ -237,6 +240,14 @@ def _get_file_url(url, size, kind):
return url
+@app.template_filter()
+def emojify(text):
+ return emoji_unicode.replace(
+ text,
+ lambda e: EMOJI.format(filename=e.code_points, raw=e.unicode),
+ )
+
+
@app.template_filter()
def gtone(n):
return n > 1
@@ -302,7 +313,11 @@ def is_from_outbox(t):
@app.template_filter()
def clean(html):
- return clean_html(html)
+ out = clean_html(html)
+ return emoji_unicode.replace(
+ out,
+ lambda e: EMOJI.format(filename=e.code_points, raw=e.unicode),
+ )
@app.template_filter()
diff --git a/requirements.txt b/requirements.txt
index 0820c85..51a17b5 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -21,3 +21,4 @@ git+https://github.com/tsileo/little-boxes.git@litepub
pyyaml
pillow
cachetools
+emoji-unicode
diff --git a/templates/layout.html b/templates/layout.html
index eab7301..d805007 100644
--- a/templates/layout.html
+++ b/templates/layout.html
@@ -43,15 +43,5 @@
Powered by microblog.pub {{ microblogpub_version }}
(source code) and the ActivityPub protocol
-
-