mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2025-06-05 21:59:23 +02:00
Custom emoji support
This commit is contained in:
11
app/main.py
11
app/main.py
@ -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,
|
||||
|
Reference in New Issue
Block a user