From 35eac05fd90db1dde32449f39a83381b378eb0cd Mon Sep 17 00:00:00 2001 From: Mike0001-droid Date: Thu, 6 Jun 2024 09:35:02 +0500 Subject: [PATCH] =?UTF-8?q?=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB=20?= =?UTF-8?q?=D0=B2=D1=8C=D1=8E=20=D0=B4=D0=BB=D1=8F=20=D0=BE=D0=B4=D0=B8?= =?UTF-8?q?=D0=BD=D0=BE=D1=87=D0=BD=D0=BE=D0=B3=D0=BE=20=D1=82=D1=80=D0=B5?= =?UTF-8?q?=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../site-packages/rest_framework/permissions.py | 2 +- server/proj/api/views.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/env/lib/python3.8/site-packages/rest_framework/permissions.py b/server/env/lib/python3.8/site-packages/rest_framework/permissions.py index 71de226..1fdcdad 100644 --- a/server/env/lib/python3.8/site-packages/rest_framework/permissions.py +++ b/server/env/lib/python3.8/site-packages/rest_framework/permissions.py @@ -154,7 +154,7 @@ class IsAdminUser(BasePermission): """ def has_permission(self, request, view): - return bool(request.user and request.user.is_staff) + return bool(request.user and request.user.) class IsAuthenticatedOrReadOnly(BasePermission): diff --git a/server/proj/api/views.py b/server/proj/api/views.py index 9e0b6c8..5dc080d 100644 --- a/server/proj/api/views.py +++ b/server/proj/api/views.py @@ -7,7 +7,7 @@ from rest_framework import status from rest_framework.decorators import action from rest_framework.permissions import AllowAny -""" class FetchAndServeFile(ViewSet): +class FetchAndServeFile(ViewSet): def list(self, request): file_url = f"http://82.97.242.49:10084/api/station/it-radio/file/fc6377b2dae75d29358783bc/play" @@ -29,7 +29,7 @@ from rest_framework.permissions import AllowAny except requests.RequestException as e: return Response({'error': str(e)}, status=status.HTTP_400_BAD_REQUEST) - def get(self, request, station, song_id, *args, **kwargs): +""" def get(self, request, station, song_id, *args, **kwargs): file_url = f"http://82.97.242.49:10084/api/station/{station}/file/{song_id}/play" api_key = "49226d3488aac3f5:18d88659c6c1c5e131a0ce0a94d55235" @@ -47,9 +47,9 @@ from rest_framework.permissions import AllowAny return file_response except requests.RequestException as e: - return Response({'error': str(e)}, status=status.HTTP_400_BAD_REQUEST) """ - -class FetchAndServeFile(APIView): + return Response({'error': str(e)}, status=status.HTTP_400_BAD_REQUEST) + """ +""" class FetchAndServeFile(APIView): permission_classes = [AllowAny] def get(self, request, station, song_id, *args, **kwargs): @@ -70,4 +70,4 @@ class FetchAndServeFile(APIView): return file_response except requests.RequestException as e: - return Response({'error': str(e)}, status=status.HTTP_400_BAD_REQUEST) \ No newline at end of file + return Response({'error': str(e)}, status=status.HTTP_400_BAD_REQUEST) """ \ No newline at end of file