mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-10 17:31:03 +00:00
parent
12567f6891
commit
770f6728f6
4 changed files with 7 additions and 13 deletions
|
@ -211,7 +211,6 @@ class Emoji(StatorModel):
|
||||||
def to_ap_tag(self):
|
def to_ap_tag(self):
|
||||||
"""
|
"""
|
||||||
Return this Emoji as an ActivityPub Tag
|
Return this Emoji as an ActivityPub Tag
|
||||||
http://joinmastodon.org/ns#Emoji
|
|
||||||
"""
|
"""
|
||||||
return {
|
return {
|
||||||
"id": self.object_uri or f"https://{settings.MAIN_DOMAIN}/emoji/{self.pk}/",
|
"id": self.object_uri or f"https://{settings.MAIN_DOMAIN}/emoji/{self.pk}/",
|
||||||
|
|
|
@ -672,7 +672,7 @@ class Post(StatorModel):
|
||||||
post.mentions.add(mention_identity)
|
post.mentions.add(mention_identity)
|
||||||
elif tag["type"].lower() == "hashtag":
|
elif tag["type"].lower() == "hashtag":
|
||||||
post.hashtags.append(tag["name"].lower().lstrip("#"))
|
post.hashtags.append(tag["name"].lower().lstrip("#"))
|
||||||
elif tag["type"].lower() == "http://joinmastodon.org/ns#emoji":
|
elif tag["type"].lower() == "toot:emoji":
|
||||||
emoji = Emoji.by_ap_tag(post.author.domain, tag, create=True)
|
emoji = Emoji.by_ap_tag(post.author.domain, tag, create=True)
|
||||||
post.emojis.add(emoji)
|
post.emojis.add(emoji)
|
||||||
else:
|
else:
|
||||||
|
@ -689,10 +689,8 @@ class Post(StatorModel):
|
||||||
# These have no IDs, so we have to wipe them each time
|
# These have no IDs, so we have to wipe them each time
|
||||||
post.attachments.all().delete()
|
post.attachments.all().delete()
|
||||||
for attachment in get_list(data, "attachment"):
|
for attachment in get_list(data, "attachment"):
|
||||||
if "http://joinmastodon.org/ns#focalPoint" in attachment:
|
if "toot:focalPoint" in attachment:
|
||||||
focal_x, focal_y = attachment[
|
focal_x, focal_y = attachment["toot:focalPoint"]["@list"]
|
||||||
"http://joinmastodon.org/ns#focalPoint"
|
|
||||||
]["@list"]
|
|
||||||
else:
|
else:
|
||||||
focal_x, focal_y = None, None
|
focal_x, focal_y = None, None
|
||||||
post.attachments.create(
|
post.attachments.create(
|
||||||
|
@ -701,7 +699,7 @@ class Post(StatorModel):
|
||||||
name=attachment.get("name"),
|
name=attachment.get("name"),
|
||||||
width=attachment.get("width"),
|
width=attachment.get("width"),
|
||||||
height=attachment.get("height"),
|
height=attachment.get("height"),
|
||||||
blurhash=attachment.get("http://joinmastodon.org/ns#blurhash"),
|
blurhash=attachment.get("toot:blurhash"),
|
||||||
focal_x=focal_x,
|
focal_x=focal_x,
|
||||||
focal_y=focal_y,
|
focal_y=focal_y,
|
||||||
)
|
)
|
||||||
|
|
|
@ -96,7 +96,7 @@ class PostAttachment(StatorModel):
|
||||||
"width": self.width,
|
"width": self.width,
|
||||||
"height": self.height,
|
"height": self.height,
|
||||||
"mediaType": self.mimetype,
|
"mediaType": self.mimetype,
|
||||||
"http://joinmastodon.org/ns#focalPoint": [0, 0],
|
"toot:focalPoint": [0, 0],
|
||||||
}
|
}
|
||||||
|
|
||||||
### Mastodon Client API ###
|
### Mastodon Client API ###
|
||||||
|
|
|
@ -321,7 +321,7 @@ class Identity(StatorModel):
|
||||||
},
|
},
|
||||||
"published": self.created.strftime("%Y-%m-%dT%H:%M:%SZ"),
|
"published": self.created.strftime("%Y-%m-%dT%H:%M:%SZ"),
|
||||||
"url": self.absolute_profile_uri(),
|
"url": self.absolute_profile_uri(),
|
||||||
"http://joinmastodon.org/ns#discoverable": self.discoverable,
|
"toot:discoverable": self.discoverable,
|
||||||
}
|
}
|
||||||
if self.name:
|
if self.name:
|
||||||
response["name"] = self.name
|
response["name"] = self.name
|
||||||
|
@ -348,7 +348,6 @@ class Identity(StatorModel):
|
||||||
def to_ap_tag(self):
|
def to_ap_tag(self):
|
||||||
"""
|
"""
|
||||||
Return this Identity as an ActivityPub Tag
|
Return this Identity as an ActivityPub Tag
|
||||||
http://joinmastodon.org/ns#Mention
|
|
||||||
"""
|
"""
|
||||||
return {
|
return {
|
||||||
"href": self.actor_uri,
|
"href": self.actor_uri,
|
||||||
|
@ -472,9 +471,7 @@ class Identity(StatorModel):
|
||||||
self.public_key_id = document.get("publicKey", {}).get("id")
|
self.public_key_id = document.get("publicKey", {}).get("id")
|
||||||
self.icon_uri = document.get("icon", {}).get("url")
|
self.icon_uri = document.get("icon", {}).get("url")
|
||||||
self.image_uri = document.get("image", {}).get("url")
|
self.image_uri = document.get("image", {}).get("url")
|
||||||
self.discoverable = document.get(
|
self.discoverable = document.get("toot:discoverable", True)
|
||||||
"http://joinmastodon.org/ns#discoverable", True
|
|
||||||
)
|
|
||||||
# Profile links/metadata
|
# Profile links/metadata
|
||||||
self.metadata = []
|
self.metadata = []
|
||||||
for attachment in get_list(document, "attachment"):
|
for attachment in get_list(document, "attachment"):
|
||||||
|
|
Loading…
Reference in a new issue