summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Godwin2022-12-17 17:48:33 -0700
committerAndrew Godwin2022-12-17 17:48:33 -0700
commitb6a8737d2e95438ada6c84feeec22db41fa73095 (patch)
tree217e671a0f822f514f9beedcb344c510b1244111
parentc5e00a2c7397c58bb1282f6858401c491057953c (diff)
downloadtakahe-b6a8737d2e95438ada6c84feeec22db41fa73095.tar.gz
takahe-b6a8737d2e95438ada6c84feeec22db41fa73095.tar.bz2
takahe-b6a8737d2e95438ada6c84feeec22db41fa73095.zip
Some more JSON-LD namespace fixing
-rw-r--r--activities/models/emoji.py6
-rw-r--r--activities/models/post_attachment.py2
-rw-r--r--core/ld.py9
3 files changed, 11 insertions, 6 deletions
diff --git a/activities/models/emoji.py b/activities/models/emoji.py
index 522cbc2..8068881 100644
--- a/activities/models/emoji.py
+++ b/activities/models/emoji.py
@@ -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
diff --git a/activities/models/post_attachment.py b/activities/models/post_attachment.py
index ed50771..0162f5a 100644
--- a/activities/models/post_attachment.py
+++ b/activities/models/post_attachment.py
@@ -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 ###
diff --git a/core/ld.py b/core/ld.py
index 946e030..389cd94 100644
--- a/core/ld.py
+++ b/core/ld.py
@@ -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: