From 606a2dfa684f880ba93989475afecc31fe78ea5d Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Fri, 6 Sep 2019 20:43:49 +0200 Subject: [PATCH] Add support for profile metadata --- config.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/config.py b/config.py index 7a44fac..18ce40d 100644 --- a/config.py +++ b/config.py @@ -10,6 +10,7 @@ from itsdangerous import JSONWebSignatureSerializer from little_boxes import strtobool from little_boxes.activitypub import CTX_AS as AP_DEFAULT_CTX from pymongo import MongoClient +from bleach import linkify import sass from utils.emojis import _load_emojis @@ -128,6 +129,13 @@ def _admin_jwt_token() -> str: ADMIN_API_KEY = get_secret_key("admin_api_key", _admin_jwt_token) +attachments = [] +if conf.get("profile_metadata"): + for key, value in conf["profile_metadata"].items(): + attachments.append( + {"type": "PropertyValue", "name": key, "value": linkify(value)} + ) + ME = { "@context": DEFAULT_CTX, "type": "Person", @@ -143,7 +151,7 @@ ME = { "endpoints": {}, "url": ID, "manuallyApprovesFollowers": False, - "attachment": [], + "attachment": attachments, "icon": { "mediaType": mimetypes.guess_type(ICON_URL)[0], "type": "Image",