Fix 'Referer checking failed - Referer is insecure while host is secure'
This commit is contained in:
parent
8cf98afe0b
commit
10eb0b1a75
2
.env.dev
2
.env.dev
|
@ -1,4 +1,4 @@
|
||||||
DJANGO_ALLOWED_HOSTS=.funkwhale.test,localhost,nginx,0.0.0.0,127.0.0.1
|
DJANGO_ALLOWED_HOSTS=.funkwhale.test,localhost,nginx,0.0.0.0,127.0.0.1,.gitpod.io
|
||||||
DJANGO_SETTINGS_MODULE=config.settings.local
|
DJANGO_SETTINGS_MODULE=config.settings.local
|
||||||
DJANGO_SECRET_KEY=dev
|
DJANGO_SECRET_KEY=dev
|
||||||
C_FORCE_ROOT=true
|
C_FORCE_ROOT=true
|
||||||
|
|
15
.gitpod.yml
15
.gitpod.yml
|
@ -12,8 +12,6 @@ tasks:
|
||||||
echo "# Gitpod Environment Variables" > .env
|
echo "# Gitpod Environment Variables" > .env
|
||||||
echo "MEDIA_URL=http://localhost:8000/media/" >> .env
|
echo "MEDIA_URL=http://localhost:8000/media/" >> .env
|
||||||
echo "STATIC_URL=http://localhost:8000/staticfiles/" >> .env
|
echo "STATIC_URL=http://localhost:8000/staticfiles/" >> .env
|
||||||
echo "FUNKWHALE_HOSTNAME=`gp url 8000 | sed 's#https://##'`" >> .env
|
|
||||||
echo "FUNKWHALE_PROTOCOL=https" >> .env
|
|
||||||
echo "GITPOD_WORKSPACE_URL=$GITPOD_WORKSPACE_URL" >> .env
|
echo "GITPOD_WORKSPACE_URL=$GITPOD_WORKSPACE_URL" >> .env
|
||||||
echo "HMR_PORT=8000" >> .env
|
echo "HMR_PORT=8000" >> .env
|
||||||
echo "VUE_APP_INSTANCE_URL=$VUE_APP_INSTANCE_URL" >> .env
|
echo "VUE_APP_INSTANCE_URL=$VUE_APP_INSTANCE_URL" >> .env
|
||||||
|
@ -33,18 +31,27 @@ tasks:
|
||||||
# Compile frontend locales
|
# Compile frontend locales
|
||||||
docker-compose run --rm front yarn run i18n-compile
|
docker-compose run --rm front yarn run i18n-compile
|
||||||
|
|
||||||
# Login with cURL to create actors
|
# Start API to let script create an actor
|
||||||
docker-compose up -d nginx
|
docker-compose up -d nginx
|
||||||
gp ports await 8000
|
gp ports await 8000
|
||||||
|
|
||||||
# Import music
|
# Clone music repo
|
||||||
git clone https://dev.funkwhale.audio/funkwhale/catalog.git
|
git clone https://dev.funkwhale.audio/funkwhale/catalog.git
|
||||||
sudo mv catalog/music data
|
sudo mv catalog/music data
|
||||||
sudo chown -R root:root data/music
|
sudo chown -R root:root data/music
|
||||||
rm -rf catalog
|
rm -rf catalog
|
||||||
|
|
||||||
|
# Login with cURL to create actor
|
||||||
python .gitpod/init_actor.py
|
python .gitpod/init_actor.py
|
||||||
|
|
||||||
|
# Import music
|
||||||
|
docker-compose down
|
||||||
|
echo "FUNKWHALE_HOSTNAME=`gp url 8000 | sed 's#https://##'`" >> .env
|
||||||
|
echo "FUNKWHALE_PROTOCOL=https" >> .env
|
||||||
LIBRARY_ID=`cat .gitpod/create_library.py | docker-compose run --rm -T api python manage.py shell -i python`
|
LIBRARY_ID=`cat .gitpod/create_library.py | docker-compose run --rm -T api python manage.py shell -i python`
|
||||||
docker-compose run --rm api python manage.py import_files $LIBRARY_ID "/music/" --recursive --noinput --in-place
|
docker-compose run --rm api python manage.py import_files $LIBRARY_ID "/music/" --recursive --noinput --in-place
|
||||||
|
|
||||||
|
# Stop docker
|
||||||
docker-compose stop
|
docker-compose stop
|
||||||
command: |
|
command: |
|
||||||
docker-compose up -d nginx
|
docker-compose up -d nginx
|
||||||
|
|
|
@ -9,12 +9,11 @@ token = res.cookies['csrftoken']
|
||||||
|
|
||||||
res = req.post('http://localhost:8000/api/v1/users/login', data={
|
res = req.post('http://localhost:8000/api/v1/users/login', data={
|
||||||
'username': 'gitpod',
|
'username': 'gitpod',
|
||||||
'password': 'gitpod'
|
'password': 'gitpod',
|
||||||
}, headers={
|
'csrfmiddlewaretoken': token,
|
||||||
'Referer': 'http://localhost:8000/login',
|
'next': '/api/v1/libraries/?scope=me'
|
||||||
'X-CSRFTOKEN': token
|
|
||||||
})
|
})
|
||||||
print(res.status_code)
|
print(res.status_code, res.content)
|
||||||
|
|
||||||
res = req.get('http://localhost:8000/api/v1/libraries/?scope=me')
|
if res.status_code == 401:
|
||||||
print(res.status_code)
|
exit(1)
|
Loading…
Reference in New Issue