This commit is contained in:
relikd
2023-10-02 23:39:20 +02:00
commit 8629b01da3
47 changed files with 1412 additions and 0 deletions

24
backend/app/urls.py Normal file
View File

@@ -0,0 +1,24 @@
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.http import HttpRequest
from django.urls import path
from django.views.static import serve
from app.views import EncryptedJsonREST
def ensure_authenticated(request: HttpRequest):
if not request.user.is_authenticated:
raise PermissionDenied()
def protected_serve(request, **kwargs):
ensure_authenticated(request)
return serve(request, **kwargs)
urlpatterns = []
if settings.API_ENABLED:
urlpatterns.append(
path('api/json/<str:org>/<uuid:uuid>', EncryptedJsonREST.as_view()))