summaryrefslogtreecommitdiffstats
path: root/takahe
diff options
context:
space:
mode:
authorMichael Manfre2022-12-15 02:50:54 -0500
committerGitHub2022-12-15 00:50:54 -0700
commitaf3142ac3adb0d1f31d160edcb6d076b293020b1 (patch)
tree73cfd5d447f6444602c2ff401399d567c673949b /takahe
parent69f1b3168ac3f29fc4bafba0418769248b10062a (diff)
downloadtakahe-af3142ac3adb0d1f31d160edcb6d076b293020b1.tar.gz
takahe-af3142ac3adb0d1f31d160edcb6d076b293020b1.tar.bz2
takahe-af3142ac3adb0d1f31d160edcb6d076b293020b1.zip
Basic Emoji suppport (#157)
Diffstat (limited to 'takahe')
-rw-r--r--takahe/settings.py6
-rw-r--r--takahe/urls.py5
2 files changed, 11 insertions, 0 deletions
diff --git a/takahe/settings.py b/takahe/settings.py
index 91bfe7b..98bc9dd 100644
--- a/takahe/settings.py
+++ b/takahe/settings.py
@@ -107,6 +107,11 @@ class Settings(BaseSettings):
#: is necessary for compatibility with Mastodon’s image proxy.
MEDIA_MAX_IMAGE_FILESIZE_MB: int = 10
+ #: Maximum filesize for Emoji. Attempting to upload Local Emoji larger than this size will be
+ #: blocked. Remote Emoji larger than this size will not be fetched and served from media, but
+ #: served through the image proxy.
+ EMOJI_MAX_IMAGE_FILESIZE_KB: int = 200
+
#: Request timeouts to use when talking to other servers Either
#: float or tuple of floats for (connect, read, write, pool)
REMOTE_TIMEOUT: float | tuple[float, float, float, float] = 5.0
@@ -194,6 +199,7 @@ MIDDLEWARE = [
"core.middleware.ConfigLoadingMiddleware",
"api.middleware.ApiTokenMiddleware",
"users.middleware.IdentityMiddleware",
+ "activities.middleware.EmojiDefaultsLoadingMiddleware",
]
ROOT_URLCONF = "takahe.urls"
diff --git a/takahe/urls.py b/takahe/urls.py
index e8aa359..d6d893f 100644
--- a/takahe/urls.py
+++ b/takahe/urls.py
@@ -194,6 +194,11 @@ urlpatterns = [
mediaproxy.PostAttachmentCacheView.as_view(),
name="proxy_post_attachment",
),
+ path(
+ "proxy/emoji/<emoji_id>/",
+ mediaproxy.EmojiCacheView.as_view(),
+ name="proxy_emoji",
+ ),
# Well-known endpoints and system actor
path(".well-known/webfinger", activitypub.Webfinger.as_view()),
path(".well-known/host-meta", activitypub.HostMeta.as_view()),