Include Identity metadata fields in ActivityPub messages (#295)

pull/298/head
Michael Manfre 2022-12-27 19:42:30 -05:00 zatwierdzone przez GitHub
rodzic a949c99d48
commit c6c3914cc7
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 11 dodań i 2 usunięć

Wyświetl plik

@ -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))

Wyświetl plik

@ -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):