Custom emoji support

This commit is contained in:
Thomas Sileo 2022-06-27 20:55:44 +02:00
parent 5b025a8e45
commit 09ce33579a
17 changed files with 357 additions and 70 deletions

View file

@ -52,6 +52,7 @@ from app.config import verify_csrf_token
from app.database import get_db
from app.templates import is_current_user_admin
from app.uploads import UPLOAD_DIR
from app.utils.emoji import EMOJIS_BY_NAME
from app.webfinger import get_remote_follow_template
# TODO(ts):
@ -520,6 +521,16 @@ def tag_by_name(
)
@app.get("/e/{name}")
def emoji_by_name(name: str) -> ActivityPubResponse:
try:
emoji = EMOJIS_BY_NAME[f":{name}:"]
except KeyError:
raise HTTPException(status_code=404)
return ActivityPubResponse({"@context": ap.AS_CTX, **emoji})
@app.post("/inbox")
async def inbox(
request: Request,