formatting head
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
|||||||
|
.env
|
||||||
|
**__pycache__**
|
||||||
|
__pycache__
|
||||||
|
frontend/node_modules/
|
||||||
|
frontend/dist
|
||||||
|
test*
|
||||||
|
*.sqlite3
|
||||||
|
*.sqlite
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
3.13
|
||||||
+41
@@ -0,0 +1,41 @@
|
|||||||
|
# Build frontend
|
||||||
|
FROM node:18-alpine AS frontend
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY frontend/package*.json ./
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
COPY frontend/ ./
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Build backend
|
||||||
|
FROM python:3.13-alpine
|
||||||
|
|
||||||
|
RUN apk add --no-cache --virtual .build-deps build-base libffi-dev openssl-dev python3-dev
|
||||||
|
RUN apk add --no-cache nginx
|
||||||
|
RUN pip install uv
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY uv.lock pyproject.toml ./
|
||||||
|
RUN uv sync --frozen --no-cache && apk del .build-deps
|
||||||
|
|
||||||
|
# Copy backend files
|
||||||
|
COPY api/ api/
|
||||||
|
COPY musicController/ musicController/
|
||||||
|
COPY spotify/ spotify/
|
||||||
|
COPY manage.py ./
|
||||||
|
COPY db.sqlite3 ./
|
||||||
|
|
||||||
|
# Copy built frontend from first stage
|
||||||
|
COPY --from=frontend /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
|
# Create nginx config (overwrite the default)
|
||||||
|
RUN rm -f /etc/nginx/conf.d/default.conf
|
||||||
|
COPY nginx.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
|
EXPOSE 80 8000
|
||||||
|
|
||||||
|
# Start both services
|
||||||
|
CMD nginx && uv run uvicorn musicController.asgi:application --host 0.0.0.0 --port 8000
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# About
|
||||||
|
|
||||||
|
Django + React application. It allows users to create and join rooms were a host can login to spotify
|
||||||
|
to play music , host can allow users to play/pause music and set votes to skip current song. Users can rejoin
|
||||||
|
a room if they have the code. Host leaving the room destroys it on the DB.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
# Spotify API
|
||||||
|
|
||||||
|
- Api changed they require premium to use any player commands
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
# Build
|
||||||
|
|
||||||
|
- port needs to change frontend/src/Env.ts to django current
|
||||||
|
|
||||||
|
```
|
||||||
|
docker-compose up --build
|
||||||
|
```
|
||||||
|
|
||||||
|
# Debug spotify endpoints
|
||||||
|
|
||||||
|
- Need to implement expiry tokens , refresh
|
||||||
|
|
||||||
|
- if the session is created from react localhost:8000/spotify/ won't carry over the session key
|
||||||
|
, the cookie can be copied from http://127.0.0.1:5173/room/ to the view
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
# Register your models here.
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class ApiConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'api'
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# Generated by Django 5.2.4 on 2025-08-18 22:20
|
||||||
|
|
||||||
|
import api.models
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = []
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Room',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('code', models.CharField(default=api.models.generate_unique_code, max_length=8, unique=True)),
|
||||||
|
('host', models.CharField(max_length=50, unique=True)),
|
||||||
|
('guest_can_pause', models.BooleanField(default=False)),
|
||||||
|
('votes_to_skip', models.IntegerField(default=1)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
from django.db import models
|
||||||
|
import string
|
||||||
|
import random
|
||||||
|
|
||||||
|
# Create your models here.
|
||||||
|
|
||||||
|
|
||||||
|
def generate_unique_code():
|
||||||
|
length = 6
|
||||||
|
|
||||||
|
while True:
|
||||||
|
code = ''.join(random.choices(string.ascii_uppercase, k=length))
|
||||||
|
if not Room.objects.filter(code=code).exists():
|
||||||
|
return code
|
||||||
|
|
||||||
|
|
||||||
|
class Room(models.Model):
|
||||||
|
code = models.CharField(max_length=8, default=generate_unique_code, unique=True)
|
||||||
|
host = models.CharField(max_length=50, unique=True)
|
||||||
|
guest_can_pause = models.BooleanField(null=False, default=False)
|
||||||
|
votes_to_skip = models.IntegerField(null=False, default=1)
|
||||||
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
from rest_framework import serializers
|
||||||
|
from .models import Room
|
||||||
|
|
||||||
|
|
||||||
|
class RoomSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta: # pyright: ignore
|
||||||
|
model = Room
|
||||||
|
fields = (
|
||||||
|
'id',
|
||||||
|
'code',
|
||||||
|
'host',
|
||||||
|
'guest_can_pause',
|
||||||
|
'votes_to_skip',
|
||||||
|
'created_at',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class CreateRoomSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta: # pyright: ignore
|
||||||
|
model = Room
|
||||||
|
fields = ('guest_can_pause', 'votes_to_skip')
|
||||||
|
|
||||||
|
|
||||||
|
class UpdateRoomSerializer(serializers.ModelSerializer):
|
||||||
|
# code is unique so needs to be modifies to get it passed here
|
||||||
|
code = serializers.CharField(validators=[])
|
||||||
|
|
||||||
|
class Meta: # pyright: ignore
|
||||||
|
model = Room
|
||||||
|
fields = ('guest_can_pause', 'votes_to_skip', 'code')
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
# Create your tests here.
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
from django.urls import path
|
||||||
|
from .views import CreateRoom, GetRoom, LeaveRoom, RoomsView, JoinRoom, UpdateRoom, UserInRoom
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('rooms/', RoomsView.as_view()),
|
||||||
|
path('create-room/', CreateRoom.as_view()),
|
||||||
|
path('join-room/', JoinRoom.as_view()),
|
||||||
|
path('get-room/', GetRoom.as_view()),
|
||||||
|
path('user-in-room/', UserInRoom.as_view()),
|
||||||
|
path('leave-room/', LeaveRoom.as_view()),
|
||||||
|
path('update-room/', UpdateRoom.as_view()),
|
||||||
|
]
|
||||||
+159
@@ -0,0 +1,159 @@
|
|||||||
|
from rest_framework import generics, status
|
||||||
|
from rest_framework.views import APIView
|
||||||
|
from rest_framework.response import Response
|
||||||
|
from django.http import JsonResponse
|
||||||
|
|
||||||
|
from .serializers import CreateRoomSerializer, RoomSerializer, UpdateRoomSerializer
|
||||||
|
from .models import Room
|
||||||
|
|
||||||
|
# Create your views here.
|
||||||
|
|
||||||
|
|
||||||
|
class RoomsView(generics.ListAPIView):
|
||||||
|
queryset = Room.objects.all()
|
||||||
|
serializer_class = RoomSerializer
|
||||||
|
|
||||||
|
|
||||||
|
class CreateRoom(APIView):
|
||||||
|
serializer_class = CreateRoomSerializer
|
||||||
|
|
||||||
|
def post(self, request):
|
||||||
|
sessionid = request.COOKIES.get("sessionid")
|
||||||
|
print(" sessionid:", sessionid)
|
||||||
|
|
||||||
|
# check if user has active session , if not , create it
|
||||||
|
if not self.request.session.exists(self.request.session.session_key): # pyright: ignore
|
||||||
|
self.request.session.create()
|
||||||
|
|
||||||
|
serializer = self.serializer_class(data=request.data)
|
||||||
|
|
||||||
|
if serializer.is_valid():
|
||||||
|
guest_can_pause = serializer.data.get('guest_can_pause')
|
||||||
|
votes_to_skip = serializer.data.get('votes_to_skip')
|
||||||
|
host = self.request.session.session_key
|
||||||
|
queryset = Room.objects.filter(host=host)
|
||||||
|
|
||||||
|
if queryset.exists():
|
||||||
|
room = queryset[0]
|
||||||
|
room.guest_can_pause = guest_can_pause
|
||||||
|
room.votes_to_skip = votes_to_skip
|
||||||
|
room.save(update_fields=['guest_can_pause', 'votes_to_skip'])
|
||||||
|
self.request.session['room_code'] = room.code
|
||||||
|
|
||||||
|
return Response(RoomSerializer(room).data, status=status.HTTP_200_OK)
|
||||||
|
else:
|
||||||
|
room = Room(
|
||||||
|
host=host,
|
||||||
|
guest_can_pause=guest_can_pause,
|
||||||
|
votes_to_skip=votes_to_skip,
|
||||||
|
)
|
||||||
|
|
||||||
|
room.save()
|
||||||
|
self.request.session['room_code'] = room.code
|
||||||
|
|
||||||
|
return Response(RoomSerializer(room).data, status=status.HTTP_201_CREATED)
|
||||||
|
return Response(status=status.HTTP_418_IM_A_TEAPOT)
|
||||||
|
|
||||||
|
|
||||||
|
class GetRoom(APIView): # This defines an API endpoint
|
||||||
|
serializer_class = RoomSerializer
|
||||||
|
|
||||||
|
def get(self, request, format=None): # This HANDLES incoming GET requests
|
||||||
|
code = request.GET.get('code') # READS the query parameter from URL
|
||||||
|
|
||||||
|
# Debug
|
||||||
|
print(f"Session Key: {request.session.session_key}")
|
||||||
|
print(f"Session Data: {dict(request.session)}")
|
||||||
|
print(f"All cookies: {request.COOKIES}")
|
||||||
|
|
||||||
|
if code is not None:
|
||||||
|
room = Room.objects.filter(code=code) # QUERIES the database
|
||||||
|
if room:
|
||||||
|
data = RoomSerializer(room[0]).data # SERIALIZES the data to send back
|
||||||
|
if self.request.session.session_key == room[0].host:
|
||||||
|
data['isHost'] = True
|
||||||
|
else:
|
||||||
|
data['isHost'] = False
|
||||||
|
return Response(data, status=status.HTTP_200_OK)
|
||||||
|
|
||||||
|
return Response({'Room not Faunt': 'Invalid Code'}, status=status.HTTP_404_NOT_FOUND)
|
||||||
|
return Response({'Bad request': 'Code not in request'}, status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
|
|
||||||
|
class JoinRoom(APIView):
|
||||||
|
def post(self, request, format=None):
|
||||||
|
# check if user has active session , if not , create it
|
||||||
|
if not self.request.session.exists(self.request.session.session_key): # pyright: ignore
|
||||||
|
self.request.session.create()
|
||||||
|
|
||||||
|
code = request.data.get('code')
|
||||||
|
if code is not None:
|
||||||
|
room_search = Room.objects.filter(code=code)
|
||||||
|
if room_search:
|
||||||
|
room = room_search[0]
|
||||||
|
self.request.session['room_code'] = code
|
||||||
|
return Response({'message': 'Room Joined'}, status=status.HTTP_202_ACCEPTED)
|
||||||
|
|
||||||
|
return Response({'Bad request': ' No Room Found'}, status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
return Response({'Bad request': 'Invalid data'}, status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
|
|
||||||
|
class UserInRoom(APIView):
|
||||||
|
def get(self, request, format=None):
|
||||||
|
# check session , or create
|
||||||
|
if not self.request.session.exists(self.request.session.session_key): # pyright: ignore
|
||||||
|
self.request.session.create()
|
||||||
|
|
||||||
|
# dbug
|
||||||
|
print("Session key:", self.request.session.session_key)
|
||||||
|
print("All session data:", dict(self.request.session))
|
||||||
|
print("room_code value:", self.request.session.get('room_code'))
|
||||||
|
|
||||||
|
data = {'code': self.request.session.get('room_code')}
|
||||||
|
return JsonResponse(data, status=status.HTTP_200_OK)
|
||||||
|
|
||||||
|
|
||||||
|
class LeaveRoom(APIView):
|
||||||
|
def post(self, request, format=None):
|
||||||
|
if 'room_code' in self.request.session:
|
||||||
|
self.request.session.pop('room_code')
|
||||||
|
host_id = self.request.session.session_key
|
||||||
|
room = Room.objects.filter(host=host_id)
|
||||||
|
|
||||||
|
if room:
|
||||||
|
room[0].delete()
|
||||||
|
self.request.session.flush()
|
||||||
|
return Response({'message': 'Room deleted'}, status=status.HTTP_200_OK)
|
||||||
|
return Response({'message': 'left room'}, status=status.HTTP_200_OK)
|
||||||
|
|
||||||
|
|
||||||
|
class UpdateRoom(APIView):
|
||||||
|
serializer_class = UpdateRoomSerializer
|
||||||
|
|
||||||
|
def patch(self, request):
|
||||||
|
if not self.request.session.exists(self.request.session.session_key): # pyright: ignore
|
||||||
|
self.request.session.create()
|
||||||
|
|
||||||
|
serializer = self.serializer_class(data=request.data)
|
||||||
|
if serializer.is_valid():
|
||||||
|
guest_can_pause = serializer.data.get('guest_can_pause')
|
||||||
|
votes_to_skip = serializer.data.get('votes_to_skip')
|
||||||
|
|
||||||
|
code = serializer.data.get('code')
|
||||||
|
query = Room.objects.filter(code=code)
|
||||||
|
|
||||||
|
if not query.exists():
|
||||||
|
return Response({'query': 'Room not found'}, status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
|
room = query[0]
|
||||||
|
# check if host
|
||||||
|
user_id = self.request.session.session_key
|
||||||
|
if room.host != user_id:
|
||||||
|
return Response({'Cant delete room ': 'you are not host'}, status=status.HTTP_403_FORBIDDEN)
|
||||||
|
|
||||||
|
room.guest_can_pause = guest_can_pause
|
||||||
|
room.votes_to_skip = votes_to_skip
|
||||||
|
room.save(update_fields=['guest_can_pause', 'votes_to_skip'])
|
||||||
|
|
||||||
|
return Response(RoomSerializer(room).data, status=status.HTTP_200_OK)
|
||||||
|
return Response({'Bad request': 'Invalid data'}, status=status.HTTP_400_BAD_REQUEST)
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
container_name: musicController
|
||||||
|
build: .
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
ports:
|
||||||
|
- '811:80' # React frontend
|
||||||
|
- '980:8000' # Django API
|
||||||
|
environment:
|
||||||
|
- Docker=true
|
||||||
|
- REACT_PORT=811
|
||||||
|
- API_PORT=980
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
setsid chromium-browser --use-gl=desktop --profile-directory='Default' "http://localhost:8000/" > /dev/null 2>&1 < /dev/null &
|
||||||
|
setsid firefox -p 'devfox' > /dev/null 2>&1 < /dev/null &
|
||||||
|
|
||||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 437 KiB |
@@ -0,0 +1,24 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
dist-ssr
|
||||||
|
*.local
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"printWidth": 120
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
FROM node:18-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM nginx:alpine
|
||||||
|
COPY --from=0 /app/dist /usr/share/nginx/html
|
||||||
|
EXPOSE 80
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import js from '@eslint/js'
|
||||||
|
import globals from 'globals'
|
||||||
|
import reactHooks from 'eslint-plugin-react-hooks'
|
||||||
|
import reactRefresh from 'eslint-plugin-react-refresh'
|
||||||
|
import tseslint from 'typescript-eslint'
|
||||||
|
import { globalIgnores } from 'eslint/config'
|
||||||
|
|
||||||
|
export default tseslint.config([
|
||||||
|
globalIgnores(['dist']),
|
||||||
|
{
|
||||||
|
files: ['**/*.{ts,tsx}'],
|
||||||
|
extends: [
|
||||||
|
js.configs.recommended,
|
||||||
|
tseslint.configs.recommended,
|
||||||
|
reactHooks.configs['recommended-latest'],
|
||||||
|
reactRefresh.configs.vite,
|
||||||
|
],
|
||||||
|
languageOptions: {
|
||||||
|
ecmaVersion: 2020,
|
||||||
|
globals: globals.browser,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Music Controller</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="root"></div>
|
||||||
|
<script type="module" src="/src/main.tsx"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
Generated
+4587
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"name": "frontend",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "tsc -b && vite build",
|
||||||
|
"lint": "eslint .",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@emotion/react": "^11.14.0",
|
||||||
|
"@emotion/styled": "^11.14.1",
|
||||||
|
"@fontsource/roboto": "^5.2.6",
|
||||||
|
"@mui/icons-material": "^7.2.0",
|
||||||
|
"@mui/material": "^7.2.0",
|
||||||
|
"@mui/styled-engine-sc": "^7.2.0",
|
||||||
|
"react": "^19.1.0",
|
||||||
|
"react-dom": "^19.1.0",
|
||||||
|
"react-router-dom": "^7.7.1",
|
||||||
|
"styled-components": "^6.1.19"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@eslint/js": "^9.30.1",
|
||||||
|
"@types/node": "^24.3.0",
|
||||||
|
"@types/react": "^19.1.8",
|
||||||
|
"@types/react-dom": "^19.1.6",
|
||||||
|
"@vitejs/plugin-react": "^5.0.1",
|
||||||
|
"@vitejs/plugin-react-swc": "^3.10.2",
|
||||||
|
"eslint": "^9.30.1",
|
||||||
|
"eslint-plugin-react-hooks": "^5.2.0",
|
||||||
|
"eslint-plugin-react-refresh": "^0.4.20",
|
||||||
|
"globals": "^16.3.0",
|
||||||
|
"typescript": "~5.8.3",
|
||||||
|
"typescript-eslint": "^8.35.1",
|
||||||
|
"vite": "^7.0.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -0,0 +1,57 @@
|
|||||||
|
import { BrowserRouter as Router, Route, Routes, Navigate } from 'react-router-dom';
|
||||||
|
import CreateRoomPage from './components/CreateRoomPage';
|
||||||
|
import JoinRoomPage from './components/JoinRomPage';
|
||||||
|
import HomePage from './components/HomePage';
|
||||||
|
import Room from './components/Room';
|
||||||
|
import './css/create.css';
|
||||||
|
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
|
function App() {
|
||||||
|
const [roomCode, setRoomCode] = useState<string | null>();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
fetch('/api/user-in-room/', {
|
||||||
|
credentials: 'include',
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
return response.json();
|
||||||
|
})
|
||||||
|
.then((data) => {
|
||||||
|
console.log('User in room response:', data);
|
||||||
|
setRoomCode(data.code);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error('error fetching backend', err);
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="center">
|
||||||
|
<Router>
|
||||||
|
<Routes>
|
||||||
|
{roomCode ? (
|
||||||
|
<>
|
||||||
|
<Route path="/" element={<Navigate to={`/room/${roomCode}`} replace />} />
|
||||||
|
<Route path="/home" element={<Navigate to={`/room/${roomCode}`} replace />} />
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<Route path="/" element={<HomePage />} />
|
||||||
|
<Route path="/home" element={<HomePage />} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<Route path="/join" element={<JoinRoomPage />} />
|
||||||
|
<Route
|
||||||
|
path="/create"
|
||||||
|
element={<CreateRoomPage votes_to_skip={2} update={false} allowPause={true} roomCode={null} />}
|
||||||
|
/>
|
||||||
|
<Route path="/room/:roomCode" element={<Room />} />
|
||||||
|
</Routes>
|
||||||
|
</Router>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default App;
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import { useState } from 'react';
|
||||||
|
import Snackbar, { type SnackbarCloseReason } from '@mui/material/Snackbar';
|
||||||
|
import Alert from '@mui/material/Alert';
|
||||||
|
import '../css/AlertComponent.css';
|
||||||
|
|
||||||
|
interface IncomingProps {
|
||||||
|
message: string;
|
||||||
|
severity: 'ok' | 'error';
|
||||||
|
}
|
||||||
|
|
||||||
|
function AlertComponent(props: IncomingProps) {
|
||||||
|
const { message, severity } = props;
|
||||||
|
|
||||||
|
const [open, setOpen] = useState(true);
|
||||||
|
|
||||||
|
const handleClose = (_event?: React.SyntheticEvent | Event, reason?: SnackbarCloseReason) => {
|
||||||
|
if (reason === 'clickaway') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setOpen(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (severity === 'ok') {
|
||||||
|
return (
|
||||||
|
<div className="AlertComponent">
|
||||||
|
<Snackbar
|
||||||
|
open={open}
|
||||||
|
autoHideDuration={6000}
|
||||||
|
onClose={handleClose}
|
||||||
|
anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }}
|
||||||
|
>
|
||||||
|
<Alert
|
||||||
|
onClose={handleClose}
|
||||||
|
severity="success"
|
||||||
|
variant="filled"
|
||||||
|
sx={{
|
||||||
|
width: '100%',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{message}
|
||||||
|
</Alert>
|
||||||
|
</Snackbar>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
} else if (severity === 'error') {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Snackbar
|
||||||
|
open={open}
|
||||||
|
autoHideDuration={6000}
|
||||||
|
anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }}
|
||||||
|
onClose={handleClose}
|
||||||
|
>
|
||||||
|
<Alert onClose={handleClose} severity="error" variant="filled" sx={{ width: '100%' }}>
|
||||||
|
{message}
|
||||||
|
</Alert>
|
||||||
|
</Snackbar>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export default AlertComponent;
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
import Button from '@mui/material/Button';
|
||||||
|
import Grid from '@mui/material/Grid';
|
||||||
|
import Typography from '@mui/material/Typography';
|
||||||
|
import TextField from '@mui/material/TextField';
|
||||||
|
import FormHelperText from '@mui/material/FormHelperText';
|
||||||
|
import FormControl from '@mui/material/FormControl';
|
||||||
|
import Radio from '@mui/material/Radio';
|
||||||
|
import RadioGroup from '@mui/material/RadioGroup';
|
||||||
|
import FormControlLabel from '@mui/material/FormControlLabel';
|
||||||
|
|
||||||
|
import { Link, useNavigate } from 'react-router-dom';
|
||||||
|
import { useEffect, useRef, useState } from 'react';
|
||||||
|
import AlertComponent from './AlertComponent';
|
||||||
|
|
||||||
|
interface PassedProps {
|
||||||
|
votes_to_skip: number;
|
||||||
|
update: boolean;
|
||||||
|
allowPause: boolean;
|
||||||
|
roomCode: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function CreateRoomPage(props: PassedProps) {
|
||||||
|
//default props destructured
|
||||||
|
const { votes_to_skip = 2, allowPause = false, update = false, roomCode = null } = props;
|
||||||
|
|
||||||
|
const [votes, setvotes] = useState<number>(votes_to_skip);
|
||||||
|
let guestCanPause = useRef<boolean>(allowPause);
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [responseMessage, setResponseMessage] = useState<'Error' | 'Succsess' | null>(null);
|
||||||
|
|
||||||
|
//helper funcs
|
||||||
|
function handleGuestCanPause(e: React.ChangeEvent<HTMLInputElement>) {
|
||||||
|
guestCanPause.current = e.target.value === 'true' ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleVotesToSkip(e: React.ChangeEvent<HTMLInputElement>) {
|
||||||
|
setvotes(() => parseInt(e.target.value, 10) || 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleCreateRoom() {
|
||||||
|
const requestOptions: RequestInit = {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
credentials: 'include',
|
||||||
|
body: JSON.stringify({
|
||||||
|
votes_to_skip: votes,
|
||||||
|
guest_can_pause: guestCanPause.current,
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
||||||
|
fetch('/api/create-room/', requestOptions).then((response) =>
|
||||||
|
response.json().then((data) => {
|
||||||
|
navigate('/room/' + data.code);
|
||||||
|
console.log('data:', data);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log('guestCanPause:', guestCanPause);
|
||||||
|
console.log('votes:', votes);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleUpdateRoom() {
|
||||||
|
const requestOptions: RequestInit = {
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
credentials: 'include',
|
||||||
|
body: JSON.stringify({
|
||||||
|
votes_to_skip: votes,
|
||||||
|
guest_can_pause: guestCanPause.current,
|
||||||
|
code: roomCode,
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
||||||
|
fetch('/api/update-room/', requestOptions)
|
||||||
|
.then((response) => {
|
||||||
|
if (response.ok) {
|
||||||
|
setResponseMessage('Succsess');
|
||||||
|
} else {
|
||||||
|
setResponseMessage('Error');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
setResponseMessage('Error');
|
||||||
|
|
||||||
|
console.error('error on HandleUpdateRoom', err);
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('## UpdateRoomBUtton##');
|
||||||
|
console.log('guestCanPause:', guestCanPause);
|
||||||
|
console.log('votes:', votes);
|
||||||
|
console.log('roomCode:', roomCode);
|
||||||
|
console.log('Message:', responseMessage);
|
||||||
|
|
||||||
|
return <Grid size={{ xs: 12 }} alignItems="center"></Grid>;
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (responseMessage !== null) {
|
||||||
|
console.log('Message set to:', responseMessage);
|
||||||
|
|
||||||
|
// Set timer to clear message after 2 seconds
|
||||||
|
const timer = setTimeout(() => {
|
||||||
|
setResponseMessage(null);
|
||||||
|
}, 2000);
|
||||||
|
|
||||||
|
// Cleanup function - clears timer if component unmounts or message changes
|
||||||
|
return () => {
|
||||||
|
clearTimeout(timer);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}, [responseMessage]);
|
||||||
|
|
||||||
|
const title = update ? 'Update Room ' : 'Create Room';
|
||||||
|
|
||||||
|
function renderCreateButton() {
|
||||||
|
return (
|
||||||
|
<Grid container spacing={1}>
|
||||||
|
<Grid size={{ xs: 12 }} alignItems="center">
|
||||||
|
<Button color="primary" variant="contained" onClick={handleCreateRoom}>
|
||||||
|
Create Room
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid size={{ xs: 12 }} alignItems="center">
|
||||||
|
<Button color="secondary" variant="contained" component={Link} to="/">
|
||||||
|
Back
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderUpdateButton() {
|
||||||
|
return (
|
||||||
|
<Grid container spacing={1}>
|
||||||
|
<Grid size={{ xs: 12 }} alignItems="center">
|
||||||
|
<Button color="primary" variant="contained" onClick={handleUpdateRoom}>
|
||||||
|
Update Room
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Grid container spacing={1}>
|
||||||
|
<Grid size={{ xs: 12 }} alignItems="center"></Grid>
|
||||||
|
<Typography component="h4" variant="h4">
|
||||||
|
{title}
|
||||||
|
</Typography>
|
||||||
|
|
||||||
|
<Grid size={{ xs: 12 }} alignItems="center">
|
||||||
|
<FormControl component="fieldset">
|
||||||
|
<FormHelperText sx={{ textAlign: 'center' }}>Guest Control Of Playback State</FormHelperText>
|
||||||
|
<RadioGroup row defaultValue={guestCanPause.current} onChange={handleGuestCanPause}>
|
||||||
|
<FormControlLabel
|
||||||
|
value="true"
|
||||||
|
control={<Radio color="primary" />}
|
||||||
|
label="Play/Pause"
|
||||||
|
labelPlacement="bottom"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FormControlLabel
|
||||||
|
value="false"
|
||||||
|
control={<Radio color="secondary" />}
|
||||||
|
label="No Control"
|
||||||
|
labelPlacement="bottom"
|
||||||
|
/>
|
||||||
|
</RadioGroup>
|
||||||
|
</FormControl>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid size={{ xs: 12 }} alignItems="center">
|
||||||
|
<FormControl>
|
||||||
|
<TextField required={true} type="number" defaultValue={votes} onChange={handleVotesToSkip} />
|
||||||
|
<FormHelperText sx={{ textAlign: 'center' }}>Votes Required to Skip Song</FormHelperText>
|
||||||
|
</FormControl>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
{update ? renderUpdateButton() : renderCreateButton()}
|
||||||
|
{responseMessage === 'Succsess' ? <AlertComponent message="Updated settings" severity="ok" /> : null}
|
||||||
|
{responseMessage === 'Error' ? <AlertComponent message="Error from server" severity="error" /> : null}
|
||||||
|
</Grid>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CreateRoomPage;
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import Button from '@mui/material/Button';
|
||||||
|
import Grid from '@mui/material/Grid';
|
||||||
|
import Typography from '@mui/material/Typography';
|
||||||
|
import ButtonGroup from '@mui/material/ButtonGroup';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
|
function HomePage() {
|
||||||
|
return (
|
||||||
|
<Grid container spacing={5} alignContent="center" alignItems="center">
|
||||||
|
<Grid alignItems="center">
|
||||||
|
<Typography variant="h3">House Party</Typography>
|
||||||
|
|
||||||
|
<Grid alignContent="center">
|
||||||
|
<ButtonGroup disableElevation variant="contained" color="primary">
|
||||||
|
<Button color="primary" component={Link} to="/join">
|
||||||
|
Join a Room
|
||||||
|
</Button>
|
||||||
|
<Button color="secondary" component={Link} to="/create">
|
||||||
|
Create Room
|
||||||
|
</Button>
|
||||||
|
</ButtonGroup>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default HomePage;
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
import Button from '@mui/material/Button';
|
||||||
|
import Grid from '@mui/material/Grid';
|
||||||
|
import Typography from '@mui/material/Typography';
|
||||||
|
import TextField from '@mui/material/TextField';
|
||||||
|
import { Link, useNavigate } from 'react-router-dom';
|
||||||
|
import { useState } from 'react';
|
||||||
|
|
||||||
|
function JoinRoomPage() {
|
||||||
|
const [roomCode, setRoomCode] = useState<string>('');
|
||||||
|
const [errorCode, setErrorcode] = useState<string>('');
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
function joinButton() {
|
||||||
|
const requestOptions: RequestInit = {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
credentials: 'include',
|
||||||
|
body: JSON.stringify({ code: roomCode }),
|
||||||
|
};
|
||||||
|
|
||||||
|
fetch('/api/join-room/', requestOptions)
|
||||||
|
.then((response) => {
|
||||||
|
console.log('The response:', response);
|
||||||
|
if (response.ok) {
|
||||||
|
navigate(`/room/${roomCode}`);
|
||||||
|
} else {
|
||||||
|
setErrorcode('Room not found');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => console.log('fetch error:', err));
|
||||||
|
|
||||||
|
console.log('code :', roomCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Grid container spacing={1}>
|
||||||
|
<Grid size={12} alignItems="center">
|
||||||
|
<Typography variant="h4" component="h4">
|
||||||
|
Join a Room
|
||||||
|
</Typography>
|
||||||
|
<Grid size={12} alignItems="center">
|
||||||
|
<TextField
|
||||||
|
label="Code"
|
||||||
|
placeholder="Enter Room Code"
|
||||||
|
value={roomCode}
|
||||||
|
onChange={(e) => setRoomCode(e.target.value)}
|
||||||
|
helperText={errorCode}
|
||||||
|
variant="outlined"
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<Button variant="contained" color="primary" onClick={joinButton}>
|
||||||
|
Join
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button variant="contained" color="secondary" component={Link} to="/">
|
||||||
|
Back
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default JoinRoomPage;
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
import Grid from '@mui/material/Grid';
|
||||||
|
import Typography from '@mui/material/Typography';
|
||||||
|
import Card from '@mui/material/Card';
|
||||||
|
import IconButton from '@mui/material/IconButton';
|
||||||
|
import LinearProgress from '@mui/material/LinearProgress';
|
||||||
|
import { PlayArrow, SkipNext, Pause } from '@mui/icons-material';
|
||||||
|
import type { PlayerProps } from '../interfaces';
|
||||||
|
import AlertComponent from './AlertComponent';
|
||||||
|
import { useState } from 'react';
|
||||||
|
|
||||||
|
function Player(props: PlayerProps) {
|
||||||
|
const [alert, setAlert] = useState<string | null>(null);
|
||||||
|
let songProgress: number = (props.time / props.duration) * 100;
|
||||||
|
|
||||||
|
function pause() {
|
||||||
|
const requestOptions: RequestInit = {
|
||||||
|
method: 'PUT',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
credentials: 'include',
|
||||||
|
};
|
||||||
|
|
||||||
|
fetch('/spotify/pause', requestOptions)
|
||||||
|
.then((data) => data.json())
|
||||||
|
.then((response) => {
|
||||||
|
if (response.error) {
|
||||||
|
console.error('you got loicence to pause ?:', response);
|
||||||
|
setAlert(response.error.message);
|
||||||
|
}
|
||||||
|
setTimeout(() => setAlert(null), 3000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function play() {
|
||||||
|
const requestOptions: RequestInit = {
|
||||||
|
method: 'PUT',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
credentials: 'include',
|
||||||
|
};
|
||||||
|
|
||||||
|
fetch('/spotify/play', requestOptions)
|
||||||
|
.then((data) => data.json())
|
||||||
|
.then((response) => {
|
||||||
|
if (response.error) {
|
||||||
|
console.error('you got loicence to play ?:', response);
|
||||||
|
setAlert(response.error.message);
|
||||||
|
}
|
||||||
|
setTimeout(() => setAlert(null), 3000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Card>
|
||||||
|
<Grid container alignItems="center">
|
||||||
|
<Grid alignItems="center" size={4}>
|
||||||
|
<img src={props.image_url} height="100%" width="100%" />
|
||||||
|
</Grid>
|
||||||
|
<Grid alignItems="center" size={8}>
|
||||||
|
<Typography component="h5" variant="h5">
|
||||||
|
{props.title}
|
||||||
|
</Typography>
|
||||||
|
|
||||||
|
<Typography color="textSecondary" variant="subtitle1">
|
||||||
|
{props.artist}
|
||||||
|
</Typography>
|
||||||
|
<div>
|
||||||
|
<IconButton
|
||||||
|
onClick={() => {
|
||||||
|
props.is_playing ? pause() : play();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{props.is_playing ? <Pause /> : <PlayArrow />}
|
||||||
|
</IconButton>
|
||||||
|
<IconButton>
|
||||||
|
<SkipNext />
|
||||||
|
</IconButton>
|
||||||
|
</div>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
<LinearProgress variant="determinate" value={songProgress} color="primary" />
|
||||||
|
</Card>
|
||||||
|
{props.id ? (
|
||||||
|
<iframe
|
||||||
|
data-testid="embed-iframe"
|
||||||
|
src={`https://open.spotify.com/embed/track/${props.id}?utm_source=generator`}
|
||||||
|
width="100%"
|
||||||
|
height="152"
|
||||||
|
frameBorder="0"
|
||||||
|
allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture"
|
||||||
|
loading="lazy"
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
{alert ? <AlertComponent message={alert} severity="error" /> : null}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Player;
|
||||||
@@ -0,0 +1,207 @@
|
|||||||
|
import Button from '@mui/material/Button';
|
||||||
|
import Grid from '@mui/material/Grid';
|
||||||
|
import Typography from '@mui/material/Typography';
|
||||||
|
|
||||||
|
import { useState, useEffect } from 'react';
|
||||||
|
import { useParams, useNavigate } from 'react-router-dom';
|
||||||
|
import type { PlayerProps, roomData, SpotifyAuthResponse } from '../interfaces';
|
||||||
|
import CreateRoomPage from './CreateRoomPage';
|
||||||
|
import Player from './Player';
|
||||||
|
import { Stack } from '@mui/material';
|
||||||
|
|
||||||
|
function Room() {
|
||||||
|
let { roomCode } = useParams<{ roomCode: string }>();
|
||||||
|
const [votesToSkip, setVotesToSkip] = useState<number>(2);
|
||||||
|
const [guestCanPause, setGuestCanPause] = useState<boolean>(false);
|
||||||
|
const [isHost, setIsHost] = useState<boolean>(false);
|
||||||
|
const [error, setError] = useState<string>('');
|
||||||
|
const [settings, setSettigs] = useState<boolean>(false);
|
||||||
|
const [isSpotifyAuth, setIsSpotifyAuth] = useState(false);
|
||||||
|
const [playing, setPlaying] = useState<PlayerProps>();
|
||||||
|
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
function LeaveRoom() {
|
||||||
|
const requestOptions: RequestInit = {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
credentials: 'include',
|
||||||
|
};
|
||||||
|
|
||||||
|
fetch('/api/leave-room/', requestOptions)
|
||||||
|
.then((response) => response.json())
|
||||||
|
.then((data) => {
|
||||||
|
if (data.message) {
|
||||||
|
console.log('leaving room ', data);
|
||||||
|
navigate('/');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkAuth() {
|
||||||
|
const requestOptions: RequestInit = {
|
||||||
|
method: 'GET',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
credentials: 'include',
|
||||||
|
};
|
||||||
|
|
||||||
|
fetch('/spotify/is-auth', requestOptions)
|
||||||
|
.then((response) => response.json())
|
||||||
|
.then((data) => {
|
||||||
|
if (data.status) {
|
||||||
|
setIsSpotifyAuth(true);
|
||||||
|
console.log('is-auth response', data.status);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderSettingsButton() {
|
||||||
|
return (
|
||||||
|
<Grid size={12} alignContent="center">
|
||||||
|
<Button variant="contained" color="primary" onClick={() => setSettigs(true)}>
|
||||||
|
Settings
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button variant="contained" color="warning" onClick={() => authenticateSpotify()}>
|
||||||
|
Login To Spotify
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderSerrings() {
|
||||||
|
return (
|
||||||
|
<Grid container spacing={1}>
|
||||||
|
<Grid size={12} alignContent="center">
|
||||||
|
<CreateRoomPage
|
||||||
|
update={true}
|
||||||
|
votes_to_skip={votesToSkip}
|
||||||
|
allowPause={guestCanPause}
|
||||||
|
roomCode={roomCode || null}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
<Grid size={12} alignContent="center">
|
||||||
|
<Button variant="contained" color="secondary" onClick={() => setSettigs(false)}>
|
||||||
|
Exit settings
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// on maunt and settings change
|
||||||
|
useEffect(() => {
|
||||||
|
if (!roomCode) {
|
||||||
|
setError('No room code provided');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fetch('/api/get-room/?code=' + roomCode, {
|
||||||
|
credentials: 'include',
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
if (!response.ok) {
|
||||||
|
navigate('/home');
|
||||||
|
}
|
||||||
|
roomCode = undefined;
|
||||||
|
return response.json();
|
||||||
|
})
|
||||||
|
.then((data: roomData) => {
|
||||||
|
console.log('data:', data);
|
||||||
|
setVotesToSkip(data.votes_to_skip);
|
||||||
|
setGuestCanPause(data.guest_can_pause);
|
||||||
|
console.log('data.isHost', data.isHost);
|
||||||
|
setIsHost(data.isHost);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
setError(err.message);
|
||||||
|
});
|
||||||
|
}, [settings]);
|
||||||
|
|
||||||
|
///get playing song
|
||||||
|
useEffect(() => {
|
||||||
|
function getSong() {
|
||||||
|
fetch('/spotify/current-song', {
|
||||||
|
credentials: 'include',
|
||||||
|
})
|
||||||
|
.then((response) => response.json())
|
||||||
|
.then((data) => {
|
||||||
|
console.log('📡 fetchData called : ', data);
|
||||||
|
setPlaying(data);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log('❌ Error fetching data:', err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
checkAuth();
|
||||||
|
if (isSpotifyAuth === true) {
|
||||||
|
getSong();
|
||||||
|
|
||||||
|
const intervalID = setInterval(() => {
|
||||||
|
getSong();
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
clearInterval(intervalID);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('isSpotifyAuth ', isSpotifyAuth);
|
||||||
|
}, [isSpotifyAuth]);
|
||||||
|
|
||||||
|
function authenticateSpotify() {
|
||||||
|
if (isHost && !isSpotifyAuth) {
|
||||||
|
setIsSpotifyAuth(true);
|
||||||
|
console.log('isSpotifyAuth.current:', isSpotifyAuth);
|
||||||
|
|
||||||
|
fetch('/spotify/is-auth', {
|
||||||
|
credentials: 'include',
|
||||||
|
})
|
||||||
|
.then((response) => response.json())
|
||||||
|
.then((data: SpotifyAuthResponse) => {
|
||||||
|
// isSpotifyAuth.current = data.status;
|
||||||
|
|
||||||
|
if (!data.status) {
|
||||||
|
fetch(`/spotify/get-auth-url?state=${roomCode}`, {
|
||||||
|
credentials: 'include',
|
||||||
|
}).then((response) =>
|
||||||
|
response.json().then((data) => {
|
||||||
|
//redirect to spotify upstream auth
|
||||||
|
window.location.replace(data.url);
|
||||||
|
return;
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log('Clicked Utenticate button ');
|
||||||
|
console.log('isSpotifyAuth:', isSpotifyAuth);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return <div>Error: {error}</div>;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings) {
|
||||||
|
console.log('rendering settings', settings);
|
||||||
|
return renderSerrings();
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<Stack spacing={2} sx={{ maxWidth: 600, mx: 'auto', p: 2 }}>
|
||||||
|
<Typography variant="h4">Room: {roomCode}</Typography>
|
||||||
|
{playing ? <Player {...playing} /> : <Typography variant="h4">Nothing playing</Typography>}
|
||||||
|
<Typography variant="h6">Votes to Skip: {votesToSkip}</Typography>
|
||||||
|
<Typography variant="h6">Guest Can Pause: {guestCanPause ? 'Yes' : 'No'}</Typography>
|
||||||
|
<Typography variant="h6">Is Host: {isHost ? 'Yes' : 'No'}</Typography>
|
||||||
|
{isHost ? renderSettingsButton() : null}
|
||||||
|
<Button variant="contained" color="secondary" onClick={LeaveRoom}>
|
||||||
|
Leave Room
|
||||||
|
</Button>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export default Room;
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
export function getCookie(name: string): string | null {
|
||||||
|
const cookies = document.cookie.split('; ');
|
||||||
|
for (const cookie of cookies) {
|
||||||
|
const [key, value] = cookie.split('=');
|
||||||
|
if (key === name) return decodeURIComponent(value);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Usage
|
||||||
|
//const session = getCookie("sessionid");
|
||||||
|
|
||||||
|
export function deleteCookie(name: string): void {
|
||||||
|
document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Usage
|
||||||
|
// deleteCookie("sessionid");
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
.AlertComponent {
|
||||||
|
all: revert;
|
||||||
|
/* or: all: initial; */
|
||||||
|
position: fixed;
|
||||||
|
left: 50%;
|
||||||
|
bottom: max(16px, env(safe-area-inset-bottom));
|
||||||
|
/* iOS safe area friendly */
|
||||||
|
transform: translateX(-50%);
|
||||||
|
display: inline-block;
|
||||||
|
z-index: 9999;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
.center {
|
||||||
|
min-height: 100dvh;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
export interface roomData {
|
||||||
|
code: number;
|
||||||
|
created_at: string;
|
||||||
|
guest_can_pause: boolean;
|
||||||
|
host: string;
|
||||||
|
id: number;
|
||||||
|
isHost: boolean;
|
||||||
|
votes_to_skip: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type SpotifyAuthResponse = {
|
||||||
|
status: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface PlayerProps {
|
||||||
|
title: string;
|
||||||
|
artist: string;
|
||||||
|
duration: number;
|
||||||
|
time: number;
|
||||||
|
image_url: string;
|
||||||
|
is_playing: boolean;
|
||||||
|
votes: number;
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { StrictMode } from 'react';
|
||||||
|
import { createRoot } from 'react-dom/client';
|
||||||
|
import App from './App.tsx';
|
||||||
|
|
||||||
|
createRoot(document.getElementById('root')!).render(
|
||||||
|
<StrictMode>
|
||||||
|
<App />
|
||||||
|
</StrictMode>,
|
||||||
|
);
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
:root {
|
||||||
|
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
||||||
|
line-height: 1.5;
|
||||||
|
font-weight: 400;
|
||||||
|
|
||||||
|
color-scheme: light dark;
|
||||||
|
color: rgba(255, 255, 255, 0.87);
|
||||||
|
background-color: #242424;
|
||||||
|
|
||||||
|
font-synthesis: none;
|
||||||
|
text-rendering: optimizeLegibility;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
font-weight: 500;
|
||||||
|
color: #646cff;
|
||||||
|
text-decoration: inherit;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
color: #535bf2;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
display: flex;
|
||||||
|
place-items: center;
|
||||||
|
min-width: 320px;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 3.2em;
|
||||||
|
line-height: 1.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
padding: 0.6em 1.2em;
|
||||||
|
font-size: 1em;
|
||||||
|
font-weight: 500;
|
||||||
|
font-family: inherit;
|
||||||
|
background-color: #1a1a1a;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: border-color 0.25s;
|
||||||
|
}
|
||||||
|
button:hover {
|
||||||
|
border-color: #646cff;
|
||||||
|
}
|
||||||
|
button:focus,
|
||||||
|
button:focus-visible {
|
||||||
|
outline: 4px auto -webkit-focus-ring-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: light) {
|
||||||
|
:root {
|
||||||
|
color: #213547;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
color: #747bff;
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
/// <reference types="vite/client" />
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||||
|
"target": "ES2022",
|
||||||
|
"useDefineForClassFields": true,
|
||||||
|
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||||
|
"module": "ESNext",
|
||||||
|
"skipLibCheck": true,
|
||||||
|
|
||||||
|
/* Bundler mode */
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"verbatimModuleSyntax": true,
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"noEmit": true,
|
||||||
|
"jsx": "react-jsx",
|
||||||
|
|
||||||
|
/* Linting */
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"erasableSyntaxOnly": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUncheckedSideEffectImports": true
|
||||||
|
},
|
||||||
|
"include": ["src"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"files": [],
|
||||||
|
"references": [
|
||||||
|
{ "path": "./tsconfig.app.json" },
|
||||||
|
{ "path": "./tsconfig.node.json" }
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||||
|
"target": "ES2023",
|
||||||
|
"lib": ["ES2023"],
|
||||||
|
"module": "ESNext",
|
||||||
|
"skipLibCheck": true,
|
||||||
|
|
||||||
|
/* Bundler mode */
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"verbatimModuleSyntax": true,
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"noEmit": true,
|
||||||
|
|
||||||
|
/* Linting */
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"erasableSyntaxOnly": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUncheckedSideEffectImports": true
|
||||||
|
},
|
||||||
|
"include": ["vite.config.ts"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import { defineConfig } from 'vite';
|
||||||
|
import react from '@vitejs/plugin-react';
|
||||||
|
|
||||||
|
const FrontEndPort = 811;
|
||||||
|
const APIPort = 980;
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [react()],
|
||||||
|
server: {
|
||||||
|
host: '127.0.0.1', // bind IPv4 loopback
|
||||||
|
port: FrontEndPort,
|
||||||
|
proxy: {
|
||||||
|
'/api': {
|
||||||
|
target: `http://127.0.0.1:${APIPort}`,
|
||||||
|
changeOrigin: true,
|
||||||
|
},
|
||||||
|
'/spotify': {
|
||||||
|
target: `http://127.0.0.1:${APIPort}`,
|
||||||
|
changeOrigin: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
"""Django's command-line utility for administrative tasks."""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Run administrative tasks."""
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'musicController.settings')
|
||||||
|
try:
|
||||||
|
from django.core.management import execute_from_command_line
|
||||||
|
except ImportError as exc:
|
||||||
|
raise ImportError(
|
||||||
|
"Couldn't import Django. Are you sure it's installed and "
|
||||||
|
"available on your PYTHONPATH environment variable? Did you "
|
||||||
|
"forget to activate a virtual environment?"
|
||||||
|
) from exc
|
||||||
|
execute_from_command_line(sys.argv)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
"""
|
||||||
|
ASGI config for musicController project.
|
||||||
|
|
||||||
|
It exposes the ASGI callable as a module-level variable named ``application``.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/howto/deployment/asgi/
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from django.core.asgi import get_asgi_application
|
||||||
|
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'musicController.settings')
|
||||||
|
|
||||||
|
application = get_asgi_application()
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
"""
|
||||||
|
Django settings for musicController project.
|
||||||
|
|
||||||
|
Generated by 'django-admin startproject' using Django 5.2.4.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/topics/settings/
|
||||||
|
|
||||||
|
For the full list of settings and their values, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/ref/settings/
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
|
||||||
|
|
||||||
|
# Quick-start development settings - unsuitable for production
|
||||||
|
# See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/
|
||||||
|
|
||||||
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
|
SECRET_KEY = 'django-insecure-%89)2o=sn)5b_f$=$4xq)gj*6#i4t5q471!k9gko(t%i7h&@gt'
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = True
|
||||||
|
|
||||||
|
ALLOWED_HOSTS = ['*']
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
'api.apps.ApiConfig',
|
||||||
|
'spotify.apps.SpotifyConfig',
|
||||||
|
'rest_framework',
|
||||||
|
'corsheaders',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
'corsheaders.middleware.CorsMiddleware',
|
||||||
|
]
|
||||||
|
|
||||||
|
CORS_ALLOW_CREDENTIALS = True
|
||||||
|
|
||||||
|
CORS_ALLOW_ALL_ORIGINS = True
|
||||||
|
# CORS_ALLOWED_ORIGINS = [
|
||||||
|
# "http://localhost:5173",
|
||||||
|
# "http://127.0.0.1:5173",
|
||||||
|
# ]
|
||||||
|
|
||||||
|
CSRF_TRUSTED_ORIGINS = [
|
||||||
|
"http://127.0.0.1:5173",
|
||||||
|
"http://localhost:5173",
|
||||||
|
]
|
||||||
|
|
||||||
|
SESSION_COOKIE_SAMESITE = "Lax"
|
||||||
|
CSRF_COOKIE_SAMESITE = "Lax"
|
||||||
|
SESSION_COOKIE_SECURE = False
|
||||||
|
CSRF_COOKIE_SECURE = False
|
||||||
|
ROOT_URLCONF = 'musicController.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'APP_DIRS': True,
|
||||||
|
'OPTIONS': {
|
||||||
|
'context_processors': [
|
||||||
|
'django.template.context_processors.request',
|
||||||
|
'django.contrib.auth.context_processors.auth',
|
||||||
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
WSGI_APPLICATION = 'musicController.wsgi.application'
|
||||||
|
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': BASE_DIR / 'db.sqlite3',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# Internationalization
|
||||||
|
# https://docs.djangoproject.com/en/5.2/topics/i18n/
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
|
||||||
|
# Static files (CSS, JavaScript, Images)
|
||||||
|
# https://docs.djangoproject.com/en/5.2/howto/static-files/
|
||||||
|
|
||||||
|
STATIC_URL = 'static/'
|
||||||
|
|
||||||
|
# Default primary key field type
|
||||||
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
"""
|
||||||
|
MusicCntroller
|
||||||
|
"""
|
||||||
|
|
||||||
|
from django.contrib import admin
|
||||||
|
from django.urls import path, include
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('admin/', admin.site.urls),
|
||||||
|
path('api/', include('api.urls')),
|
||||||
|
path('', include('api.urls'), name=''),
|
||||||
|
path('spotify/', include('spotify.urls')),
|
||||||
|
]
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
"""
|
||||||
|
WSGI config for musicController project.
|
||||||
|
|
||||||
|
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||||
|
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/5.2/howto/deployment/wsgi/
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'musicController.settings')
|
||||||
|
|
||||||
|
application = get_wsgi_application()
|
||||||
+44
@@ -0,0 +1,44 @@
|
|||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /api/ {
|
||||||
|
proxy_pass http://127.0.0.1:8000;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /admin/ {
|
||||||
|
proxy_pass http://127.0.0.1:8000;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /spotify/ {
|
||||||
|
proxy_pass http://127.0.0.1:8000;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
[project]
|
||||||
|
name = "musiccontroller"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "Full stack application using django + react "
|
||||||
|
readme = "README.md"
|
||||||
|
requires-python = ">=3.13"
|
||||||
|
dependencies = [
|
||||||
|
"django-cors-headers>=4.7.0",
|
||||||
|
"django-stubs>=5.2.2",
|
||||||
|
"django-stubs-ext>=5.2.2",
|
||||||
|
"djangorestframework>=3.16.0",
|
||||||
|
"djangorestframework-types>=0.9.0",
|
||||||
|
"dotenv>=0.9.9",
|
||||||
|
"requests>=2.32.4",
|
||||||
|
"uvicorn>=0.35.0",
|
||||||
|
]
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
# Register your models here.
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class SpotifyConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'spotify'
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# Generated by Django 5.2.4 on 2025-08-18 22:20
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = []
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='SpotifyToken',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('user', models.CharField(max_length=50, unique=True)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('refresh_token', models.CharField(max_length=150)),
|
||||||
|
('access_token', models.CharField(max_length=150)),
|
||||||
|
('expires_in', models.DateTimeField()),
|
||||||
|
('token_type', models.CharField(max_length=50)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
from django.db import models
|
||||||
|
|
||||||
|
|
||||||
|
class SpotifyToken(models.Model):
|
||||||
|
user = models.CharField(max_length=50, unique=True)
|
||||||
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
refresh_token = models.CharField(max_length=150)
|
||||||
|
access_token = models.CharField(max_length=150)
|
||||||
|
expires_in = models.DateTimeField()
|
||||||
|
token_type = models.CharField(max_length=50)
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
from rest_framework import serializers
|
||||||
|
from .models import SpotifyToken
|
||||||
|
|
||||||
|
|
||||||
|
class TokenSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta: # pyright: ignore
|
||||||
|
model = SpotifyToken
|
||||||
|
fields = (
|
||||||
|
'id',
|
||||||
|
'user',
|
||||||
|
'access_token',
|
||||||
|
'token_type',
|
||||||
|
'expires_in',
|
||||||
|
'refresh_token',
|
||||||
|
)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
# Create your tests here.
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
from django.urls import path
|
||||||
|
from .views import AuthURL, CurrentSong, PauseSong, PlaySong, SpotifyList, spotify_callback, IsAuthenticated
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path('get-auth-url', AuthURL.as_view()),
|
||||||
|
path('redirect', spotify_callback),
|
||||||
|
path('is-auth', IsAuthenticated.as_view()),
|
||||||
|
path('current-song', CurrentSong.as_view()),
|
||||||
|
path('tokens', SpotifyList.as_view()),
|
||||||
|
path('play', PlaySong.as_view()),
|
||||||
|
path('pause', PauseSong.as_view()),
|
||||||
|
]
|
||||||
+120
@@ -0,0 +1,120 @@
|
|||||||
|
from django.utils import timezone
|
||||||
|
from .models import SpotifyToken
|
||||||
|
import os
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
from datetime import timedelta
|
||||||
|
from requests import post, put, get
|
||||||
|
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
CLIENT_ID = os.getenv('CLIENT_ID')
|
||||||
|
CLIENT_SECRET = os.getenv('CLIENT_SECRET')
|
||||||
|
|
||||||
|
BASE_URL = 'https://api.spotify.com/v1/me/'
|
||||||
|
|
||||||
|
|
||||||
|
def get_user_token(session_id):
|
||||||
|
user_tokens = SpotifyToken.objects.filter(user=session_id)
|
||||||
|
# DEBUG
|
||||||
|
print('## get_user_token()##')
|
||||||
|
print('user_tokens:', user_tokens.first())
|
||||||
|
print('session_id', session_id)
|
||||||
|
|
||||||
|
if user_tokens.exists():
|
||||||
|
return user_tokens[0]
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def update_or_create_user_tokens(session_id, access_token, token_type, expires_in, refresh_token):
|
||||||
|
# default expires in = 3600 from spotify
|
||||||
|
tokens = get_user_token(session_id)
|
||||||
|
expires_in = timezone.now() + timedelta(seconds=expires_in)
|
||||||
|
|
||||||
|
# update if exist
|
||||||
|
if tokens:
|
||||||
|
tokens.access_token = access_token
|
||||||
|
tokens.expires_in = expires_in
|
||||||
|
tokens.refresh_token = refresh_token
|
||||||
|
tokens.token_type = token_type
|
||||||
|
tokens.save(update_fields=['access_token', 'expires_in', 'refresh_token', 'token_type'])
|
||||||
|
|
||||||
|
else: # create on db
|
||||||
|
tokens = SpotifyToken(
|
||||||
|
user=session_id,
|
||||||
|
access_token=access_token,
|
||||||
|
token_type=token_type,
|
||||||
|
expires_in=expires_in,
|
||||||
|
refresh_token=refresh_token,
|
||||||
|
)
|
||||||
|
tokens.save()
|
||||||
|
|
||||||
|
|
||||||
|
def is_spotify_authenticated(session_id):
|
||||||
|
tokens = get_user_token(session_id)
|
||||||
|
|
||||||
|
if tokens:
|
||||||
|
expiry = tokens.expires_in
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def refresh_spotify_token(session_id):
|
||||||
|
refresh_token = get_user_token(session_id).refresh_token
|
||||||
|
|
||||||
|
_response = post(
|
||||||
|
'https://accounts.spotify.com/api/token',
|
||||||
|
data={
|
||||||
|
'grant_type': 'refresh_token',
|
||||||
|
'refresh_token': refresh_token,
|
||||||
|
'client_id': CLIENT_ID,
|
||||||
|
'client_secret': CLIENT_SECRET,
|
||||||
|
},
|
||||||
|
).json()
|
||||||
|
|
||||||
|
# dont need these just in case
|
||||||
|
access_token = _response.get('access_token')
|
||||||
|
token_type = _response.get('token_type')
|
||||||
|
expires_in = _response.get('expires_in')
|
||||||
|
|
||||||
|
update_or_create_user_tokens(session_id, access_token, token_type, expires_in, refresh_token)
|
||||||
|
|
||||||
|
|
||||||
|
def spotify_api_request(session_id, endpoint, post_=False, put_=False):
|
||||||
|
tokens = get_user_token(session_id)
|
||||||
|
|
||||||
|
# endpoint = 'player/currently-playing'
|
||||||
|
headers = {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Authorization': 'Bearer ' + tokens.access_token,
|
||||||
|
}
|
||||||
|
if post_:
|
||||||
|
response = post(BASE_URL + endpoint, headers=headers)
|
||||||
|
try:
|
||||||
|
return response.json()
|
||||||
|
except:
|
||||||
|
return {'Error': 'Issue with POST request'}
|
||||||
|
|
||||||
|
if put_:
|
||||||
|
response = put(BASE_URL + endpoint, headers=headers)
|
||||||
|
try:
|
||||||
|
return response.json()
|
||||||
|
except:
|
||||||
|
return {'Error': 'Issue with PUT request'}
|
||||||
|
|
||||||
|
# GET request (default)
|
||||||
|
spotify_response = get(BASE_URL + endpoint, headers=headers)
|
||||||
|
|
||||||
|
try:
|
||||||
|
return spotify_response.json()
|
||||||
|
except:
|
||||||
|
return {'Error': 'Issue with GET request', 'status_code': spotify_response.status_code}
|
||||||
|
|
||||||
|
|
||||||
|
def play_song(session_id):
|
||||||
|
return spotify_api_request(session_id, 'player/play', put_=True)
|
||||||
|
|
||||||
|
|
||||||
|
def pause_song(session_id):
|
||||||
|
return spotify_api_request(session_id, 'player/pause', put_=True)
|
||||||
@@ -0,0 +1,200 @@
|
|||||||
|
import os
|
||||||
|
import json
|
||||||
|
import base64
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
from requests import Request, post
|
||||||
|
from rest_framework.views import APIView
|
||||||
|
from rest_framework import status, generics
|
||||||
|
from rest_framework.response import Response
|
||||||
|
from django.shortcuts import redirect
|
||||||
|
from .util import is_spotify_authenticated, update_or_create_user_tokens, spotify_api_request, play_song, pause_song
|
||||||
|
from api.models import Room
|
||||||
|
from .models import SpotifyToken
|
||||||
|
from .serializers import TokenSerializer
|
||||||
|
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
if os.getenv('Docker'):
|
||||||
|
REACT_PORT = os.getenv('REACT_PORT')
|
||||||
|
API_PORT = os.getenv('API_PORT')
|
||||||
|
WEBSITE = 'https://gxnet.cc'
|
||||||
|
REDIRECT_URI = 'https://gxnet.cc/spotify/redirect'
|
||||||
|
else:
|
||||||
|
REACT_PORT = 5173
|
||||||
|
API_PORT = 8000
|
||||||
|
REDIRECT_URI = f'http://127.0.0.1:{API_PORT}/spotify/redirect'
|
||||||
|
|
||||||
|
CLIENT_ID = os.getenv('CLIENT_ID')
|
||||||
|
CLIENT_SECRET = os.getenv('CLIENT_SECRET')
|
||||||
|
|
||||||
|
|
||||||
|
class AuthURL(APIView):
|
||||||
|
def get(self, request):
|
||||||
|
if not request.session.exists(request.session.session_key):
|
||||||
|
request.session.create()
|
||||||
|
orig_sid = request.session.session_key
|
||||||
|
|
||||||
|
room_code = request.GET.get('state')
|
||||||
|
state_obj = {"room": room_code, "sid": orig_sid}
|
||||||
|
state = base64.urlsafe_b64encode(json.dumps(state_obj).encode()).decode()
|
||||||
|
|
||||||
|
scopes = 'user-read-playback-state user-modify-playback-state user-read-currently-playing'
|
||||||
|
url = (
|
||||||
|
Request(
|
||||||
|
'GET',
|
||||||
|
'https://accounts.spotify.com/authorize',
|
||||||
|
params={
|
||||||
|
'scope': scopes,
|
||||||
|
'response_type': 'code',
|
||||||
|
'client_id': CLIENT_ID,
|
||||||
|
'redirect_uri': REDIRECT_URI,
|
||||||
|
'state': state,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.prepare()
|
||||||
|
.url
|
||||||
|
)
|
||||||
|
|
||||||
|
# sanity debug
|
||||||
|
print('🎧client_id:', CLIENT_ID)
|
||||||
|
print('🎧 orig_sid:', orig_sid)
|
||||||
|
print(' 🎧url:', url)
|
||||||
|
|
||||||
|
return Response({'url': url}, status=status.HTTP_200_OK)
|
||||||
|
|
||||||
|
|
||||||
|
# https://developer-assets.spotifycdn.com/images/documentation/web-api/auth-code-flow.png
|
||||||
|
def spotify_callback(request):
|
||||||
|
code = request.GET.get('code')
|
||||||
|
raw_state = request.GET.get("state") or ""
|
||||||
|
state = json.loads(base64.urlsafe_b64decode(raw_state).decode())
|
||||||
|
error = request.GET.get('error')
|
||||||
|
|
||||||
|
room_code = state.get("room") # <- plain string
|
||||||
|
orig_sid = state.get("sid")
|
||||||
|
|
||||||
|
response = post(
|
||||||
|
'https://accounts.spotify.com/api/token',
|
||||||
|
data={
|
||||||
|
'grant_type': 'authorization_code',
|
||||||
|
'code': code,
|
||||||
|
'redirect_uri': REDIRECT_URI,
|
||||||
|
'client_id': CLIENT_ID,
|
||||||
|
'client_secret': CLIENT_SECRET,
|
||||||
|
},
|
||||||
|
).json()
|
||||||
|
|
||||||
|
access_token = response.get('access_token')
|
||||||
|
token_type = response.get('token_type')
|
||||||
|
refresh_token = response.get('refresh_token')
|
||||||
|
expires_in = response.get('expires_in')
|
||||||
|
error = response.get('error')
|
||||||
|
|
||||||
|
if not request.session.exists(request.session.session_key):
|
||||||
|
request.session.create()
|
||||||
|
cur_sid = request.session.session_key
|
||||||
|
|
||||||
|
# if session changed, rebind room host
|
||||||
|
room = Room.objects.filter(code=room_code, host=orig_sid).first()
|
||||||
|
if room and cur_sid != orig_sid:
|
||||||
|
room.host = cur_sid
|
||||||
|
room.save(update_fields=["host"])
|
||||||
|
|
||||||
|
update_or_create_user_tokens(request.session.session_key, access_token, token_type, expires_in, refresh_token)
|
||||||
|
|
||||||
|
if room_code:
|
||||||
|
request.session['room_code'] = room_code
|
||||||
|
|
||||||
|
print('🎧### On spotify Callback() ## 🎧')
|
||||||
|
print("Host:", request.get_host())
|
||||||
|
print("Cookies:", request.COOKIES)
|
||||||
|
print("Session key:", request.session.session_key)
|
||||||
|
print('room_code REDIRECT:', room_code)
|
||||||
|
|
||||||
|
if WEBSITE:
|
||||||
|
target = f'{WEBSITE}/room/{room_code}?code={room_code}&auth=done'
|
||||||
|
else:
|
||||||
|
target = f'http://127.0.0.1:{REACT_PORT}/room/{room_code}?code={room_code}&auth=done'
|
||||||
|
|
||||||
|
return redirect(target)
|
||||||
|
|
||||||
|
|
||||||
|
class IsAuthenticated(APIView):
|
||||||
|
def get(self, request):
|
||||||
|
is_auth = is_spotify_authenticated(self.request.session.session_key)
|
||||||
|
return Response({'status': is_auth, 'message': '🎧'})
|
||||||
|
|
||||||
|
|
||||||
|
class CurrentSong(APIView):
|
||||||
|
def get(self, request):
|
||||||
|
room_code = self.request.session.get('room_code')
|
||||||
|
print('DEBUG ; room_code:', room_code)
|
||||||
|
|
||||||
|
room = Room.objects.filter(code=room_code).first()
|
||||||
|
if room:
|
||||||
|
host = room.host
|
||||||
|
|
||||||
|
else:
|
||||||
|
return Response({'message': 'not a room'}, status=status.HTTP_404_NOT_FOUND)
|
||||||
|
|
||||||
|
endpoint = 'player/currently-playing'
|
||||||
|
response = spotify_api_request(host, endpoint)
|
||||||
|
|
||||||
|
if 'error' in response or 'item' not in response:
|
||||||
|
return Response({'error': 'error response from spotify'}, status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
|
else:
|
||||||
|
item = response.get('item')
|
||||||
|
duration = item.get('duration_ms')
|
||||||
|
progress = response.get('progress_ms')
|
||||||
|
album_cover = item.get('album').get('images')[0].get('url')
|
||||||
|
is_playing = response.get('is_playing')
|
||||||
|
song_id = item.get('id')
|
||||||
|
|
||||||
|
artist_string = ""
|
||||||
|
|
||||||
|
for i, artist in enumerate(item.get('artists')):
|
||||||
|
if i > 0:
|
||||||
|
artist_string += ", "
|
||||||
|
name = artist.get('name')
|
||||||
|
artist_string += name
|
||||||
|
|
||||||
|
song = {
|
||||||
|
'title': item.get('name'),
|
||||||
|
'artist': artist_string,
|
||||||
|
'duration': duration,
|
||||||
|
'time': progress,
|
||||||
|
'image_url': album_cover,
|
||||||
|
'is_playing': is_playing,
|
||||||
|
'votes': 0,
|
||||||
|
'id': song_id,
|
||||||
|
}
|
||||||
|
|
||||||
|
return Response(song, status=status.HTTP_200_OK)
|
||||||
|
|
||||||
|
|
||||||
|
class SpotifyList(generics.ListAPIView):
|
||||||
|
queryset = SpotifyToken.objects.all()
|
||||||
|
serializer_class = TokenSerializer
|
||||||
|
|
||||||
|
|
||||||
|
class PauseSong(APIView):
|
||||||
|
def put(self, request):
|
||||||
|
room_code = self.request.session.get('room_code')
|
||||||
|
room = Room.objects.filter(code=room_code)[0]
|
||||||
|
|
||||||
|
if self.request.session.session_key == room.host or room.guest_can_pause:
|
||||||
|
upstream_response = pause_song(room.host)
|
||||||
|
return Response(upstream_response, status=status.HTTP_200_OK)
|
||||||
|
return Response({'Not allowed': 'you are not the host'}, status=status.HTTP_403_FORBIDDEN)
|
||||||
|
|
||||||
|
|
||||||
|
class PlaySong(APIView):
|
||||||
|
def put(self, request):
|
||||||
|
room_code = self.request.session.get('room_code')
|
||||||
|
room = Room.objects.filter(code=room_code)[0]
|
||||||
|
|
||||||
|
if self.request.session.session_key == room.host or room.guest_can_pause:
|
||||||
|
upstream_response = play_song(room.host)
|
||||||
|
return Response(upstream_response, status=status.HTTP_200_OK)
|
||||||
|
return Response({'Not allowed': 'you are not the host'}, status=status.HTTP_403_FORBIDDEN)
|
||||||
@@ -0,0 +1,287 @@
|
|||||||
|
version = 1
|
||||||
|
revision = 2
|
||||||
|
requires-python = ">=3.13"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "asgiref"
|
||||||
|
version = "3.9.1"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/90/61/0aa957eec22ff70b830b22ff91f825e70e1ef732c06666a805730f28b36b/asgiref-3.9.1.tar.gz", hash = "sha256:a5ab6582236218e5ef1648f242fd9f10626cfd4de8dc377db215d5d5098e3142", size = 36870, upload-time = "2025-07-08T09:07:43.344Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/7c/3c/0464dcada90d5da0e71018c04a140ad6349558afb30b3051b4264cc5b965/asgiref-3.9.1-py3-none-any.whl", hash = "sha256:f3bba7092a48005b5f5bacd747d36ee4a5a61f4a269a6df590b43144355ebd2c", size = 23790, upload-time = "2025-07-08T09:07:41.548Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "certifi"
|
||||||
|
version = "2025.8.3"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/dc/67/960ebe6bf230a96cda2e0abcf73af550ec4f090005363542f0765df162e0/certifi-2025.8.3.tar.gz", hash = "sha256:e564105f78ded564e3ae7c923924435e1daa7463faeab5bb932bc53ffae63407", size = 162386, upload-time = "2025-08-03T03:07:47.08Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/e5/48/1549795ba7742c948d2ad169c1c8cdbae65bc450d6cd753d124b17c8cd32/certifi-2025.8.3-py3-none-any.whl", hash = "sha256:f6c12493cfb1b06ba2ff328595af9350c65d6644968e5d3a2ffd78699af217a5", size = 161216, upload-time = "2025-08-03T03:07:45.777Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "charset-normalizer"
|
||||||
|
version = "3.4.3"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/83/2d/5fd176ceb9b2fc619e63405525573493ca23441330fcdaee6bef9460e924/charset_normalizer-3.4.3.tar.gz", hash = "sha256:6fce4b8500244f6fcb71465d4a4930d132ba9ab8e71a7859e6a5d59851068d14", size = 122371, upload-time = "2025-08-09T07:57:28.46Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/65/ca/2135ac97709b400c7654b4b764daf5c5567c2da45a30cdd20f9eefe2d658/charset_normalizer-3.4.3-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:14c2a87c65b351109f6abfc424cab3927b3bdece6f706e4d12faaf3d52ee5efe", size = 205326, upload-time = "2025-08-09T07:56:24.721Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/71/11/98a04c3c97dd34e49c7d247083af03645ca3730809a5509443f3c37f7c99/charset_normalizer-3.4.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:41d1fc408ff5fdfb910200ec0e74abc40387bccb3252f3f27c0676731df2b2c8", size = 146008, upload-time = "2025-08-09T07:56:26.004Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/60/f5/4659a4cb3c4ec146bec80c32d8bb16033752574c20b1252ee842a95d1a1e/charset_normalizer-3.4.3-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:1bb60174149316da1c35fa5233681f7c0f9f514509b8e399ab70fea5f17e45c9", size = 159196, upload-time = "2025-08-09T07:56:27.25Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/86/9e/f552f7a00611f168b9a5865a1414179b2c6de8235a4fa40189f6f79a1753/charset_normalizer-3.4.3-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:30d006f98569de3459c2fc1f2acde170b7b2bd265dc1943e87e1a4efe1b67c31", size = 156819, upload-time = "2025-08-09T07:56:28.515Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/7e/95/42aa2156235cbc8fa61208aded06ef46111c4d3f0de233107b3f38631803/charset_normalizer-3.4.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:416175faf02e4b0810f1f38bcb54682878a4af94059a1cd63b8747244420801f", size = 151350, upload-time = "2025-08-09T07:56:29.716Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c2/a9/3865b02c56f300a6f94fc631ef54f0a8a29da74fb45a773dfd3dcd380af7/charset_normalizer-3.4.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:6aab0f181c486f973bc7262a97f5aca3ee7e1437011ef0c2ec04b5a11d16c927", size = 148644, upload-time = "2025-08-09T07:56:30.984Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/77/d9/cbcf1a2a5c7d7856f11e7ac2d782aec12bdfea60d104e60e0aa1c97849dc/charset_normalizer-3.4.3-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:fdabf8315679312cfa71302f9bd509ded4f2f263fb5b765cf1433b39106c3cc9", size = 160468, upload-time = "2025-08-09T07:56:32.252Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/f6/42/6f45efee8697b89fda4d50580f292b8f7f9306cb2971d4b53f8914e4d890/charset_normalizer-3.4.3-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:bd28b817ea8c70215401f657edef3a8aa83c29d447fb0b622c35403780ba11d5", size = 158187, upload-time = "2025-08-09T07:56:33.481Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/70/99/f1c3bdcfaa9c45b3ce96f70b14f070411366fa19549c1d4832c935d8e2c3/charset_normalizer-3.4.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:18343b2d246dc6761a249ba1fb13f9ee9a2bcd95decc767319506056ea4ad4dc", size = 152699, upload-time = "2025-08-09T07:56:34.739Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/a3/ad/b0081f2f99a4b194bcbb1934ef3b12aa4d9702ced80a37026b7607c72e58/charset_normalizer-3.4.3-cp313-cp313-win32.whl", hash = "sha256:6fb70de56f1859a3f71261cbe41005f56a7842cc348d3aeb26237560bfa5e0ce", size = 99580, upload-time = "2025-08-09T07:56:35.981Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/9a/8f/ae790790c7b64f925e5c953b924aaa42a243fb778fed9e41f147b2a5715a/charset_normalizer-3.4.3-cp313-cp313-win_amd64.whl", hash = "sha256:cf1ebb7d78e1ad8ec2a8c4732c7be2e736f6e5123a4146c5b89c9d1f585f8cef", size = 107366, upload-time = "2025-08-09T07:56:37.339Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/8e/91/b5a06ad970ddc7a0e513112d40113e834638f4ca1120eb727a249fb2715e/charset_normalizer-3.4.3-cp314-cp314-macosx_10_13_universal2.whl", hash = "sha256:3cd35b7e8aedeb9e34c41385fda4f73ba609e561faedfae0a9e75e44ac558a15", size = 204342, upload-time = "2025-08-09T07:56:38.687Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ce/ec/1edc30a377f0a02689342f214455c3f6c2fbedd896a1d2f856c002fc3062/charset_normalizer-3.4.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b89bc04de1d83006373429975f8ef9e7932534b8cc9ca582e4db7d20d91816db", size = 145995, upload-time = "2025-08-09T07:56:40.048Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/17/e5/5e67ab85e6d22b04641acb5399c8684f4d37caf7558a53859f0283a650e9/charset_normalizer-3.4.3-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:2001a39612b241dae17b4687898843f254f8748b796a2e16f1051a17078d991d", size = 158640, upload-time = "2025-08-09T07:56:41.311Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/f1/e5/38421987f6c697ee3722981289d554957c4be652f963d71c5e46a262e135/charset_normalizer-3.4.3-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:8dcfc373f888e4fb39a7bc57e93e3b845e7f462dacc008d9749568b1c4ece096", size = 156636, upload-time = "2025-08-09T07:56:43.195Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/a0/e4/5a075de8daa3ec0745a9a3b54467e0c2967daaaf2cec04c845f73493e9a1/charset_normalizer-3.4.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:18b97b8404387b96cdbd30ad660f6407799126d26a39ca65729162fd810a99aa", size = 150939, upload-time = "2025-08-09T07:56:44.819Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/02/f7/3611b32318b30974131db62b4043f335861d4d9b49adc6d57c1149cc49d4/charset_normalizer-3.4.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:ccf600859c183d70eb47e05a44cd80a4ce77394d1ac0f79dbd2dd90a69a3a049", size = 148580, upload-time = "2025-08-09T07:56:46.684Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/7e/61/19b36f4bd67f2793ab6a99b979b4e4f3d8fc754cbdffb805335df4337126/charset_normalizer-3.4.3-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:53cd68b185d98dde4ad8990e56a58dea83a4162161b1ea9272e5c9182ce415e0", size = 159870, upload-time = "2025-08-09T07:56:47.941Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/06/57/84722eefdd338c04cf3030ada66889298eaedf3e7a30a624201e0cbe424a/charset_normalizer-3.4.3-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:30a96e1e1f865f78b030d65241c1ee850cdf422d869e9028e2fc1d5e4db73b92", size = 157797, upload-time = "2025-08-09T07:56:49.756Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/72/2a/aff5dd112b2f14bcc3462c312dce5445806bfc8ab3a7328555da95330e4b/charset_normalizer-3.4.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:d716a916938e03231e86e43782ca7878fb602a125a91e7acb8b5112e2e96ac16", size = 152224, upload-time = "2025-08-09T07:56:51.369Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/b7/8c/9839225320046ed279c6e839d51f028342eb77c91c89b8ef2549f951f3ec/charset_normalizer-3.4.3-cp314-cp314-win32.whl", hash = "sha256:c6dbd0ccdda3a2ba7c2ecd9d77b37f3b5831687d8dc1b6ca5f56a4880cc7b7ce", size = 100086, upload-time = "2025-08-09T07:56:52.722Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ee/7a/36fbcf646e41f710ce0a563c1c9a343c6edf9be80786edeb15b6f62e17db/charset_normalizer-3.4.3-cp314-cp314-win_amd64.whl", hash = "sha256:73dc19b562516fc9bcf6e5d6e596df0b4eb98d87e4f79f3ae71840e6ed21361c", size = 107400, upload-time = "2025-08-09T07:56:55.172Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/8a/1f/f041989e93b001bc4e44bb1669ccdcf54d3f00e628229a85b08d330615c5/charset_normalizer-3.4.3-py3-none-any.whl", hash = "sha256:ce571ab16d890d23b5c278547ba694193a45011ff86a9162a71307ed9f86759a", size = 53175, upload-time = "2025-08-09T07:57:26.864Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "click"
|
||||||
|
version = "8.2.1"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "colorama", marker = "sys_platform == 'win32'" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/60/6c/8ca2efa64cf75a977a0d7fac081354553ebe483345c734fb6b6515d96bbc/click-8.2.1.tar.gz", hash = "sha256:27c491cc05d968d271d5a1db13e3b5a184636d9d930f148c50b038f0d0646202", size = 286342, upload-time = "2025-05-20T23:19:49.832Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/85/32/10bb5764d90a8eee674e9dc6f4db6a0ab47c8c4d0d83c27f7c39ac415a4d/click-8.2.1-py3-none-any.whl", hash = "sha256:61a3265b914e850b85317d0b3109c7f8cd35a670f963866005d6ef1d5175a12b", size = 102215, upload-time = "2025-05-20T23:19:47.796Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "colorama"
|
||||||
|
version = "0.4.6"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "django"
|
||||||
|
version = "5.2.4"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "asgiref" },
|
||||||
|
{ name = "sqlparse" },
|
||||||
|
{ name = "tzdata", marker = "sys_platform == 'win32'" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/9c/7e/034f0f9fb10c029a02daaf44d364d6bf2eced8c73f0d38c69da359d26b01/django-5.2.4.tar.gz", hash = "sha256:a1228c384f8fa13eebc015196db7b3e08722c5058d4758d20cb287503a540d8f", size = 10831909, upload-time = "2025-07-02T18:47:39.19Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/14/ae/706965237a672434c8b520e89a818e8b047af94e9beb342d0bee405c26c7/django-5.2.4-py3-none-any.whl", hash = "sha256:60c35bd96201b10c6e7a78121bd0da51084733efa303cc19ead021ab179cef5e", size = 8302187, upload-time = "2025-07-02T18:47:35.373Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "django-cors-headers"
|
||||||
|
version = "4.7.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "asgiref" },
|
||||||
|
{ name = "django" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/93/6c/16f6cb6064c63074fd5b2bd494eb319afd846236d9c1a6c765946df2c289/django_cors_headers-4.7.0.tar.gz", hash = "sha256:6fdf31bf9c6d6448ba09ef57157db2268d515d94fc5c89a0a1028e1fc03ee52b", size = 21037, upload-time = "2025-02-06T22:15:28.924Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/7e/a2/7bcfff86314bd9dd698180e31ba00604001606efb518a06cca6833a54285/django_cors_headers-4.7.0-py3-none-any.whl", hash = "sha256:f1c125dcd58479fe7a67fe2499c16ee38b81b397463cf025f0e2c42937421070", size = 12794, upload-time = "2025-02-06T22:15:24.341Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "django-stubs"
|
||||||
|
version = "5.2.2"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "django" },
|
||||||
|
{ name = "django-stubs-ext" },
|
||||||
|
{ name = "types-pyyaml" },
|
||||||
|
{ name = "typing-extensions" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/bc/27/ab9813da817a29ae69ec92af31ad8fc58ce3c904f23ea604bd3bdd9adc37/django_stubs-5.2.2.tar.gz", hash = "sha256:2a04b510c7a812f88223fd7e6d87fb4ea98717f19c8e5c8b59691d83ad40a8a6", size = 243049, upload-time = "2025-07-17T08:35:02.747Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/55/cb/bb387a1d40691ad54fec2be9e5093becebd63cca0ccb9348cbb27602e1d1/django_stubs-5.2.2-py3-none-any.whl", hash = "sha256:79bd0fdbc78958a8f63e0b062bd9d03f1de539664476c0be62ade5f063c9e41e", size = 485188, upload-time = "2025-07-17T08:35:00.356Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "django-stubs-ext"
|
||||||
|
version = "5.2.2"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "django" },
|
||||||
|
{ name = "typing-extensions" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/fc/06/5e94715d103e6cc72380cb0d0b6682a7d5ad2c366cee478c94d77aad777d/django_stubs_ext-5.2.2.tar.gz", hash = "sha256:d9d151b919fe2438760f5bd938f03e1cb08c84d0651f9e5917f1313907e42683", size = 6244, upload-time = "2025-07-17T08:34:35.054Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/4e/38/2903676f97f7902ee31984a06756b0e8836e897f4b617e1a03be4a43eb4f/django_stubs_ext-5.2.2-py3-none-any.whl", hash = "sha256:8833bbe32405a2a0ce168d3f75a87168f61bd16939caf0e8bf173bccbd8a44c5", size = 8816, upload-time = "2025-07-17T08:34:33.715Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "djangorestframework"
|
||||||
|
version = "3.16.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "django" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/7d/97/112c5a72e6917949b6d8a18ad6c6e72c46da4290c8f36ee5f1c1dcbc9901/djangorestframework-3.16.0.tar.gz", hash = "sha256:f022ff46613584de994c0c6a4aebbace5fd700555fbe9d33b865ebf173eba6c9", size = 1068408, upload-time = "2025-03-28T14:18:42.065Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/eb/3e/2448e93f4f87fc9a9f35e73e3c05669e0edd0c2526834686e949bb1fd303/djangorestframework-3.16.0-py3-none-any.whl", hash = "sha256:bea7e9f6b96a8584c5224bfb2e4348dfb3f8b5e34edbecb98da258e892089361", size = 1067305, upload-time = "2025-03-28T14:18:39.489Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "djangorestframework-types"
|
||||||
|
version = "0.9.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/d6/5d/1a21a5fd10ad9980dcb934b8221934dee2b6b97af5edc58cb169558c0831/djangorestframework_types-0.9.0.tar.gz", hash = "sha256:aa6b27fbdab5ff4ab1dfa5376f3b6ec45713ce48dbcdd4226bf3e1410f0deaca", size = 32521, upload-time = "2024-10-10T00:42:04.01Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/a4/5f/d908ce938356b209d4d27a7fb159ab9100b8814396a69c0204bb66e38703/djangorestframework_types-0.9.0-py3-none-any.whl", hash = "sha256:5e4258fe43774d0a3d018780170bd702bf615407fe244453ea5ec6e6676b98c4", size = 54947, upload-time = "2024-10-10T00:42:02.311Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dotenv"
|
||||||
|
version = "0.9.9"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "python-dotenv" },
|
||||||
|
]
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/b2/b7/545d2c10c1fc15e48653c91efde329a790f2eecfbbf2bd16003b5db2bab0/dotenv-0.9.9-py2.py3-none-any.whl", hash = "sha256:29cf74a087b31dafdb5a446b6d7e11cbce8ed2741540e2339c69fbef92c94ce9", size = 1892, upload-time = "2025-02-19T22:15:01.647Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "h11"
|
||||||
|
version = "0.16.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/01/ee/02a2c011bdab74c6fb3c75474d40b3052059d95df7e73351460c8588d963/h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1", size = 101250, upload-time = "2025-04-24T03:35:25.427Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86", size = 37515, upload-time = "2025-04-24T03:35:24.344Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "idna"
|
||||||
|
version = "3.10"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/f1/70/7703c29685631f5a7590aa73f1f1d3fa9a380e654b86af429e0934a32f7d/idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9", size = 190490, upload-time = "2024-09-15T18:07:39.745Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3", size = 70442, upload-time = "2024-09-15T18:07:37.964Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "musiccontroller"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = { virtual = "." }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "django-cors-headers" },
|
||||||
|
{ name = "django-stubs" },
|
||||||
|
{ name = "django-stubs-ext" },
|
||||||
|
{ name = "djangorestframework" },
|
||||||
|
{ name = "djangorestframework-types" },
|
||||||
|
{ name = "dotenv" },
|
||||||
|
{ name = "requests" },
|
||||||
|
{ name = "uvicorn" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.metadata]
|
||||||
|
requires-dist = [
|
||||||
|
{ name = "django-cors-headers", specifier = ">=4.7.0" },
|
||||||
|
{ name = "django-stubs", specifier = ">=5.2.2" },
|
||||||
|
{ name = "django-stubs-ext", specifier = ">=5.2.2" },
|
||||||
|
{ name = "djangorestframework", specifier = ">=3.16.0" },
|
||||||
|
{ name = "djangorestframework-types", specifier = ">=0.9.0" },
|
||||||
|
{ name = "dotenv", specifier = ">=0.9.9" },
|
||||||
|
{ name = "requests", specifier = ">=2.32.4" },
|
||||||
|
{ name = "uvicorn", specifier = ">=0.35.0" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "python-dotenv"
|
||||||
|
version = "1.1.1"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/f6/b0/4bc07ccd3572a2f9df7e6782f52b0c6c90dcbb803ac4a167702d7d0dfe1e/python_dotenv-1.1.1.tar.gz", hash = "sha256:a8a6399716257f45be6a007360200409fce5cda2661e3dec71d23dc15f6189ab", size = 41978, upload-time = "2025-06-24T04:21:07.341Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/5f/ed/539768cf28c661b5b068d66d96a2f155c4971a5d55684a514c1a0e0dec2f/python_dotenv-1.1.1-py3-none-any.whl", hash = "sha256:31f23644fe2602f88ff55e1f5c79ba497e01224ee7737937930c448e4d0e24dc", size = 20556, upload-time = "2025-06-24T04:21:06.073Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "requests"
|
||||||
|
version = "2.32.4"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "certifi" },
|
||||||
|
{ name = "charset-normalizer" },
|
||||||
|
{ name = "idna" },
|
||||||
|
{ name = "urllib3" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/e1/0a/929373653770d8a0d7ea76c37de6e41f11eb07559b103b1c02cafb3f7cf8/requests-2.32.4.tar.gz", hash = "sha256:27d0316682c8a29834d3264820024b62a36942083d52caf2f14c0591336d3422", size = 135258, upload-time = "2025-06-09T16:43:07.34Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/7c/e4/56027c4a6b4ae70ca9de302488c5ca95ad4a39e190093d6c1a8ace08341b/requests-2.32.4-py3-none-any.whl", hash = "sha256:27babd3cda2a6d50b30443204ee89830707d396671944c998b5975b031ac2b2c", size = 64847, upload-time = "2025-06-09T16:43:05.728Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sqlparse"
|
||||||
|
version = "0.5.3"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/e5/40/edede8dd6977b0d3da179a342c198ed100dd2aba4be081861ee5911e4da4/sqlparse-0.5.3.tar.gz", hash = "sha256:09f67787f56a0b16ecdbde1bfc7f5d9c3371ca683cfeaa8e6ff60b4807ec9272", size = 84999, upload-time = "2024-12-10T12:05:30.728Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/a9/5c/bfd6bd0bf979426d405cc6e71eceb8701b148b16c21d2dc3c261efc61c7b/sqlparse-0.5.3-py3-none-any.whl", hash = "sha256:cf2196ed3418f3ba5de6af7e82c694a9fbdbfecccdfc72e281548517081f16ca", size = 44415, upload-time = "2024-12-10T12:05:27.824Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "types-pyyaml"
|
||||||
|
version = "6.0.12.20250516"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/4e/22/59e2aeb48ceeee1f7cd4537db9568df80d62bdb44a7f9e743502ea8aab9c/types_pyyaml-6.0.12.20250516.tar.gz", hash = "sha256:9f21a70216fc0fa1b216a8176db5f9e0af6eb35d2f2932acb87689d03a5bf6ba", size = 17378, upload-time = "2025-05-16T03:08:04.897Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/99/5f/e0af6f7f6a260d9af67e1db4f54d732abad514252a7a378a6c4d17dd1036/types_pyyaml-6.0.12.20250516-py3-none-any.whl", hash = "sha256:8478208feaeb53a34cb5d970c56a7cd76b72659442e733e268a94dc72b2d0530", size = 20312, upload-time = "2025-05-16T03:08:04.019Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typing-extensions"
|
||||||
|
version = "4.14.1"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/98/5a/da40306b885cc8c09109dc2e1abd358d5684b1425678151cdaed4731c822/typing_extensions-4.14.1.tar.gz", hash = "sha256:38b39f4aeeab64884ce9f74c94263ef78f3c22467c8724005483154c26648d36", size = 107673, upload-time = "2025-07-04T13:28:34.16Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/b5/00/d631e67a838026495268c2f6884f3711a15a9a2a96cd244fdaea53b823fb/typing_extensions-4.14.1-py3-none-any.whl", hash = "sha256:d1e1e3b58374dc93031d6eda2420a48ea44a36c2b4766a4fdeb3710755731d76", size = 43906, upload-time = "2025-07-04T13:28:32.743Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tzdata"
|
||||||
|
version = "2025.2"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/95/32/1a225d6164441be760d75c2c42e2780dc0873fe382da3e98a2e1e48361e5/tzdata-2025.2.tar.gz", hash = "sha256:b60a638fcc0daffadf82fe0f57e53d06bdec2f36c4df66280ae79bce6bd6f2b9", size = 196380, upload-time = "2025-03-23T13:54:43.652Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/5c/23/c7abc0ca0a1526a0774eca151daeb8de62ec457e77262b66b359c3c7679e/tzdata-2025.2-py2.py3-none-any.whl", hash = "sha256:1a403fada01ff9221ca8044d701868fa132215d84beb92242d9acd2147f667a8", size = 347839, upload-time = "2025-03-23T13:54:41.845Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "urllib3"
|
||||||
|
version = "2.5.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/15/22/9ee70a2574a4f4599c47dd506532914ce044817c7752a79b6a51286319bc/urllib3-2.5.0.tar.gz", hash = "sha256:3fc47733c7e419d4bc3f6b3dc2b4f890bb743906a30d56ba4a5bfa4bbff92760", size = 393185, upload-time = "2025-06-18T14:07:41.644Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/a7/c2/fe1e52489ae3122415c51f387e221dd0773709bad6c6cdaa599e8a2c5185/urllib3-2.5.0-py3-none-any.whl", hash = "sha256:e6b01673c0fa6a13e374b50871808eb3bf7046c4b125b216f6bf1cc604cff0dc", size = 129795, upload-time = "2025-06-18T14:07:40.39Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "uvicorn"
|
||||||
|
version = "0.35.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "click" },
|
||||||
|
{ name = "h11" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/5e/42/e0e305207bb88c6b8d3061399c6a961ffe5fbb7e2aa63c9234df7259e9cd/uvicorn-0.35.0.tar.gz", hash = "sha256:bc662f087f7cf2ce11a1d7fd70b90c9f98ef2e2831556dd078d131b96cc94a01", size = 78473, upload-time = "2025-06-28T16:15:46.058Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d2/e2/dc81b1bd1dcfe91735810265e9d26bc8ec5da45b4c0f6237e286819194c3/uvicorn-0.35.0-py3-none-any.whl", hash = "sha256:197535216b25ff9b785e29a0b79199f55222193d47f820816e7da751e9bc8d4a", size = 66406, upload-time = "2025-06-28T16:15:44.816Z" },
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user