diff --git a/core/html.py b/core/html.py index 4fb07c1..18eb1ec 100644 --- a/core/html.py +++ b/core/html.py @@ -45,14 +45,14 @@ def sanitize_html(post_html: str) -> str: return mark_safe(cleaner.clean(post_html)) -def strip_html(post_html: str) -> str: +def strip_html(post_html: str, *, linkify: bool = True) -> str: """ Strips all tags from the text, then linkifies it. """ cleaner = bleach.Cleaner( tags=[], strip=True, - filters=[partial(LinkifyFilter, url_re=url_regex)], + filters=[partial(LinkifyFilter, url_re=url_regex)] if linkify else [], ) return mark_safe(cleaner.clean(post_html)) diff --git a/users/models/identity.py b/users/models/identity.py index a77f9e4..ca948be 100644 --- a/users/models/identity.py +++ b/users/models/identity.py @@ -483,6 +483,15 @@ class Identity(StatorModel): response["endpoints"] = { "sharedInbox": f"https://{self.domain.uri_domain}/inbox/", } + if self.metadata: + response["attachment"] = [ + { + "type": "http://schema.org#PropertyValue", + "name": strip_html(item["name"], linkify=False), + "value": strip_html(item["value"]), + } + for item in self.metadata + ] return response def to_ap_tag(self):