Add playable tracks to gitpod

This commit is contained in:
Kasper Seweryn 2022-07-03 08:45:36 +00:00 committed by Georg Krause
commit e4cc242232
6 changed files with 108 additions and 17 deletions

17
.gitpod/create_library.py Normal file
View file

@ -0,0 +1,17 @@
from funkwhale_api.music.models import Library
from django.contrib.auth import get_user_model
actor = get_user_model().objects.get(username='gitpod').actor
try:
library = Library.objects.get(actor=actor)
except:
# Create library
library = Library()
library.actor = actor
library.description = 'Libre music to build a starter catalog for your instance'
library.name = 'funkwhale/catalog'
library.privacy_level = 'everyone'
library.save()
print(str(library.uuid))

21
.gitpod/init_actor.py Normal file
View file

@ -0,0 +1,21 @@
import requests
# Login to initialize user actor
req = requests.Session()
res = req.get('http://localhost:8000/login')
print(res.status_code, res.cookies)
token = res.cookies['csrftoken']
res = req.post('http://localhost:8000/api/v1/users/login', data={
'username': 'gitpod',
'password': 'gitpod',
'csrfmiddlewaretoken': token,
})
print(res.status_code, res.content)
res = req.get('http://localhost:8000/')
print(res.status_code)
if res.status_code == 401:
exit(1)