Compare commits

..

5 Commits

Author SHA1 Message Date
Michael Manfre
86bc48f3e0
Add github action timeouts (#195) 2022-12-17 22:26:15 -07:00
Michael Manfre
bb81f0e559
Process Identity metadata name same as value (#194) 2022-12-17 21:15:11 -07:00
Tyler Kennedy
fc79551656
Increase the allowed size of URIs
Increase the allowed size of Post.object_uri and Post.url from 500 characters to a more reasonable 2048. See https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers.
2022-12-17 20:20:51 -07:00
Andrew Godwin
b6a8737d2e Some more JSON-LD namespace fixing 2022-12-17 17:48:33 -07:00
Andrew Godwin
c5e00a2c73 Switch ordering for domain default field 2022-12-17 17:17:59 -07:00
8 changed files with 17 additions and 10 deletions

View File

@ -5,6 +5,7 @@ on: [push, pull_request]
jobs:
test_docs:
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
python-version: ["3.10"]

View File

@ -12,6 +12,7 @@ jobs:
test:
name: test py${{ matrix.python-version }} with ${{ matrix.db_name }}
runs-on: ubuntu-latest
timeout-minutes: 8
strategy:
matrix:
python-version: ["3.10", "3.11"]

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

@ -180,7 +180,7 @@ class Post(StatorModel):
local = models.BooleanField()
# The canonical object ID
object_uri = models.CharField(max_length=500, blank=True, null=True, unique=True)
object_uri = models.CharField(max_length=2048, blank=True, null=True, unique=True)
# Who should be able to see this Post
visibility = models.IntegerField(
@ -197,7 +197,7 @@ class Post(StatorModel):
summary = models.TextField(blank=True, null=True)
# The public, web URL of this Post on the original server
url = models.CharField(max_length=500, blank=True, null=True)
url = models.CharField(max_length=2048, blank=True, null=True)
# The Post it is replying to as an AP ID URI
# (as otherwise we'd have to pull entire threads to use IDs)

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:

View File

@ -217,7 +217,7 @@ class Identity(StatorModel):
return []
return [
{
"name": data["name"],
"name": imageify_emojis(strip_html(data["name"]), self.domain),
"value": imageify_emojis(strip_html(data["value"]), self.domain),
}
for data in self.metadata

View File

@ -65,7 +65,7 @@ class DomainCreate(FormView):
)
default = forms.BooleanField(
help_text="If this is the default option for new identities",
widget=forms.Select(choices=[(True, "Yes"), (False, "No")]),
widget=forms.Select(choices=[(False, "No"), (True, "Yes")]),
required=False,
)