Add playable tracks to gitpod
This commit is contained in:
parent
f7952dd023
commit
e4cc242232
6 changed files with 108 additions and 17 deletions
17
.gitpod/create_library.py
Normal file
17
.gitpod/create_library.py
Normal 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
21
.gitpod/init_actor.py
Normal 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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue