Some more JSON-LD namespace fixing

This commit is contained in:
Andrew Godwin 2022-12-17 17:48:33 -07:00
parent c5e00a2c73
commit b6a8737d2e
3 changed files with 11 additions and 6 deletions

View file

@ -12,6 +12,7 @@ from django.utils.safestring import mark_safe
from core.files import get_remote_file
from core.html import strip_html
from core.ld import format_ld_date
from core.models import Config
from core.uploads import upload_emoji_namer
from core.uris import AutoAbsoluteUrl, RelativeAbsoluteUrl, StaticAbsoluteUrl
@ -218,13 +219,14 @@ class Emoji(StatorModel):
"""
return {
"id": self.object_uri or f"https://{settings.MAIN_DOMAIN}/emoji/{self.pk}/",
"type": "toot:Emoji",
"name": self.shortcode,
"type": "Emoji",
"name": f":{self.shortcode}:",
"icon": {
"type": "Image",
"mediaType": self.mimetype,
"url": self.full_url().absolute,
},
"updated": format_ld_date(self.updated),
}
@classmethod

View file

@ -96,7 +96,7 @@ class PostAttachment(StatorModel):
"width": self.width,
"height": self.height,
"mediaType": self.mimetype,
"toot:focalPoint": [0, 0],
"blurhash": self.blurhash,
}
### Mastodon Client API ###

View file

@ -410,12 +410,15 @@ def canonicalise(json_data: dict, include_security: bool = False) -> dict:
context = [
"https://www.w3.org/ns/activitystreams",
{
"blurhash": "toot:blurhash",
"Emoji": "toot:Emoji",
"focalPoint": {"@container": "@list", "@id": "toot:focalPoint"},
"Hashtag": "as:Hashtag",
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
"Public": "as:Public",
"sensitive": "as:sensitive",
"toot": "http://joinmastodon.org/ns#",
"votersCount": "toot:votersCount",
"Hashtag": "as:Hashtag",
"Public": "as:Public",
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
},
]
if include_security: