From af3142ac3adb0d1f31d160edcb6d076b293020b1 Mon Sep 17 00:00:00 2001 From: Michael Manfre Date: Thu, 15 Dec 2022 02:50:54 -0500 Subject: Basic Emoji suppport (#157) --- takahe/settings.py | 6 ++++++ takahe/urls.py | 5 +++++ 2 files changed, 11 insertions(+) (limited to 'takahe') 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//", + 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()), -- cgit v1.2.3