summaryrefslogtreecommitdiffstats
path: root/stator/views.py
diff options
context:
space:
mode:
authorAndrew Godwin2022-11-18 17:24:43 -0700
committerAndrew Godwin2022-11-18 17:24:43 -0700
commit80193114909a3f6ca1eda9a47b6330ef249a8ee5 (patch)
tree488baeeb9ab98a2d27500c03af70a0a25758e91a /stator/views.py
parent81de10b70c85c5222b17d8c4358a8aa8812f2559 (diff)
downloadtakahe-80193114909a3f6ca1eda9a47b6330ef249a8ee5.tar.gz
takahe-80193114909a3f6ca1eda9a47b6330ef249a8ee5.tar.bz2
takahe-80193114909a3f6ca1eda9a47b6330ef249a8ee5.zip
Deployment re-jiggling
Diffstat (limited to 'stator/views.py')
-rw-r--r--stator/views.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/stator/views.py b/stator/views.py
index ef09b8e..9d2e154 100644
--- a/stator/views.py
+++ b/stator/views.py
@@ -1,8 +1,9 @@
-from django.http import HttpResponse
+from django.conf import settings
+from django.http import HttpResponse, HttpResponseForbidden
from django.views import View
+from stator.models import StatorModel
from stator.runner import StatorRunner
-from users.models import Follow
class RequestRunner(View):
@@ -12,6 +13,11 @@ class RequestRunner(View):
"""
async def get(self, request):
- runner = StatorRunner([Follow])
+ # Check the token, if supplied
+ if settings.STATOR_TOKEN:
+ if request.GET.get("token") != settings.STATOR_TOKEN:
+ return HttpResponseForbidden()
+ # Run on all models
+ runner = StatorRunner(StatorModel.subclasses)
handled = await runner.run()
return HttpResponse(f"Handled {handled}")