summaryrefslogtreecommitdiffstats
path: root/mediaproxy
diff options
context:
space:
mode:
Diffstat (limited to 'mediaproxy')
-rw-r--r--mediaproxy/views.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/mediaproxy/views.py b/mediaproxy/views.py
index 57257f3..4fc09b1 100644
--- a/mediaproxy/views.py
+++ b/mediaproxy/views.py
@@ -5,7 +5,7 @@ from django.http import Http404, HttpResponse
from django.shortcuts import get_object_or_404
from django.views.generic import View
-from activities.models import PostAttachment
+from activities.models import Emoji, PostAttachment
from users.models import Identity
@@ -57,6 +57,21 @@ class BaseCacheView(View):
raise NotImplementedError()
+class EmojiCacheView(BaseCacheView):
+ """
+ Caches Emoji
+ """
+
+ item_timeout = 86400 * 7 # One week
+
+ def get_remote_url(self):
+ self.emoji = get_object_or_404(Emoji, pk=self.kwargs["emoji_id"])
+
+ if not self.emoji.remote_url:
+ raise Http404()
+ return self.emoji.remote_url
+
+
class IdentityIconCacheView(BaseCacheView):
"""
Caches identity icons (avatars)