summaryrefslogtreecommitdiffstats
path: root/activities
diff options
context:
space:
mode:
authorAndrew Godwin2022-12-10 12:16:08 -0700
committerAndrew Godwin2022-12-10 12:16:08 -0700
commit3595af7bd239f3843aff3ae06df8932cff23173d (patch)
tree84b8a0432fb89f253808be11275e2f78fc57bf42 /activities
parent9a978786d4eac0139b5606e22c605450adbe7a12 (diff)
downloadtakahe-3595af7bd239f3843aff3ae06df8932cff23173d.tar.gz
takahe-3595af7bd239f3843aff3ae06df8932cff23173d.tar.bz2
takahe-3595af7bd239f3843aff3ae06df8932cff23173d.zip
Media proxy, caching and tuning docs
Fixes #67
Diffstat (limited to 'activities')
-rw-r--r--activities/models/post_attachment.py4
-rw-r--r--activities/views/posts.py2
2 files changed, 4 insertions, 2 deletions
diff --git a/activities/models/post_attachment.py b/activities/models/post_attachment.py
index 7feaba5..932ae65 100644
--- a/activities/models/post_attachment.py
+++ b/activities/models/post_attachment.py
@@ -77,13 +77,13 @@ class PostAttachment(StatorModel):
elif self.file:
return self.file.url
else:
- return self.remote_url
+ return f"/proxy/post_attachment/{self.pk}/"
def full_url(self):
if self.file:
return self.file.url
else:
- return self.remote_url
+ return f"/proxy/post_attachment/{self.pk}/"
### ActivityPub ###
diff --git a/activities/views/posts.py b/activities/views/posts.py
index d343567..ccc38fc 100644
--- a/activities/views/posts.py
+++ b/activities/views/posts.py
@@ -3,6 +3,7 @@ from django.db import models
from django.http import JsonResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.utils.decorators import method_decorator
+from django.views.decorators.vary import vary_on_headers
from django.views.generic import TemplateView, View
from activities.models import Post, PostInteraction, PostInteractionStates, PostStates
@@ -15,6 +16,7 @@ from users.shortcuts import by_handle_or_404
@method_decorator(
cache_page_by_ap_json("cache_timeout_page_post", public_only=True), name="dispatch"
)
+@method_decorator(vary_on_headers("Accept"), name="dispatch")
class Individual(TemplateView):
template_name = "activities/post.html"