Add support for profile metadata

This commit is contained in:
Thomas Sileo 2022-08-10 08:58:18 +02:00
parent ff59e49866
commit e8397f802d
6 changed files with 62 additions and 7 deletions

View file

@ -5,6 +5,7 @@ from typing import TYPE_CHECKING
from typing import Any
import httpx
from markdown import markdown
from app import config
from app.config import AP_CONTENT_TYPE # noqa: F401
@ -96,7 +97,16 @@ ME = {
},
"url": config.ID + "/", # XXX: the path is important for Mastodon compat
"manuallyApprovesFollowers": config.CONFIG.manually_approves_followers,
"attachment": [],
"attachment": [
{
"name": kv.key,
"type": "PropertyValue",
"value": markdown(kv.value, extensions=["mdx_linkify", "fenced_code"]),
}
for kv in config.CONFIG.metadata
]
if config.CONFIG.metadata
else [],
"icon": {
"mediaType": mimetypes.guess_type(config.CONFIG.icon_url)[0],
"type": "Image",