diff --git a/.env.dev b/.env.dev index e27084a69..d42cdad02 100644 --- a/.env.dev +++ b/.env.dev @@ -1,4 +1,3 @@ -BACKEND_URL=http://localhost:6001 API_AUTHENTICATION_REQUIRED=True CACHALOT_ENABLED=False RAVEN_ENABLED=false diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cde12894a..0fa450c46 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,6 +20,7 @@ test_api: paths: - "$PIP_CACHE_DIR" variables: + DJANGO_ALLOWED_HOSTS: "localhost" DATABASE_URL: "postgresql://postgres@postgres/postgres" before_script: diff --git a/CHANGELOG b/CHANGELOG index c3aac8eac..3e1ddbb30 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,8 @@ Changelog 0.3.5 (Unreleased) ------------------ +- Front: ambiant colors in player based on current track cover (#59) +- Front: simplified front dev setup thanks to webpack proxy (#59) - Front: added some unittests for the store (#55) - Front: fixed broken login redirection when 401 - Front: Removed autoplay on page reload diff --git a/api/config/settings/common.py b/api/config/settings/common.py index 9e17267bb..6d02cbbc1 100644 --- a/api/config/settings/common.py +++ b/api/config/settings/common.py @@ -23,6 +23,10 @@ try: env.read_env(ROOT_DIR.file('.env')) except FileNotFoundError: pass + +ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS') + + # APP CONFIGURATION # ------------------------------------------------------------------------------ DJANGO_APPS = ( diff --git a/api/config/settings/production.py b/api/config/settings/production.py index e00983305..df15d325f 100644 --- a/api/config/settings/production.py +++ b/api/config/settings/production.py @@ -54,7 +54,6 @@ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') # ------------------------------------------------------------------------------ # Hosts/domain names that are valid for this site # See https://docs.djangoproject.com/en/1.6/ref/settings/#allowed-hosts -ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS') CSRF_TRUSTED_ORIGINS = ALLOWED_HOSTS # END SITE CONFIGURATION diff --git a/api/funkwhale_api/music/serializers.py b/api/funkwhale_api/music/serializers.py index 9f96dad0e..506893a4d 100644 --- a/api/funkwhale_api/music/serializers.py +++ b/api/funkwhale_api/music/serializers.py @@ -31,10 +31,7 @@ class TrackFileSerializer(serializers.ModelSerializer): fields = ('id', 'path', 'duration', 'source', 'filename', 'track') def get_path(self, o): - request = self.context.get('request') url = o.path - if request: - url = request.build_absolute_uri(url) return url diff --git a/api/test.yml b/api/test.yml index c59ce45bb..e892dfb17 100644 --- a/api/test.yml +++ b/api/test.yml @@ -10,6 +10,7 @@ services: volumes: - .:/app environment: + - "DJANGO_ALLOWED_HOSTS=localhost" - "DATABASE_URL=postgresql://postgres@postgres/postgres" postgres: image: postgres diff --git a/dev.yml b/dev.yml index 971e38b62..e3cd50da7 100644 --- a/dev.yml +++ b/dev.yml @@ -49,13 +49,11 @@ services: - ./api:/app - ./data/music:/music environment: - - "DJANGO_ALLOWED_HOSTS=localhost" + - "DJANGO_ALLOWED_HOSTS=localhost,nginx" - "DJANGO_SETTINGS_MODULE=config.settings.local" - "DJANGO_SECRET_KEY=dev" - "DATABASE_URL=postgresql://postgres@postgres/postgres" - "CACHE_URL=redis://redis:6379/0" - ports: - - "12081:12081" links: - postgres - redis diff --git a/docker/nginx/conf.dev b/docker/nginx/conf.dev index 48436173b..1b749c30a 100644 --- a/docker/nginx/conf.dev +++ b/docker/nginx/conf.dev @@ -40,8 +40,8 @@ http { 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; - proxy_set_header X-Forwarded-Host $host:$server_port; - proxy_set_header X-Forwarded-Port $server_port; + proxy_set_header X-Forwarded-Host localhost:8080; + proxy_set_header X-Forwarded-Port 8080; proxy_redirect off; proxy_pass http://api:12081/; } diff --git a/front/config/index.js b/front/config/index.js index a312c7b26..7ce6e26e1 100644 --- a/front/config/index.js +++ b/front/config/index.js @@ -28,7 +28,20 @@ module.exports = { autoOpenBrowser: true, assetsSubDirectory: 'static', assetsPublicPath: '/', - proxyTable: {}, + proxyTable: { + '/api': { + target: 'http://nginx:6001', + changeOrigin: true, + }, + '/media': { + target: 'http://nginx:6001', + changeOrigin: true, + }, + '/staticfiles': { + target: 'http://nginx:6001', + changeOrigin: true, + } + }, // CSS Sourcemaps off by default because relative paths are "buggy" // with this option, according to the CSS-Loader README // (https://github.com/webpack/css-loader#sourcemaps) diff --git a/front/config/prod.env.js b/front/config/prod.env.js index fe0e80b8f..decfe3615 100644 --- a/front/config/prod.env.js +++ b/front/config/prod.env.js @@ -1,4 +1,4 @@ module.exports = { NODE_ENV: '"production"', - BACKEND_URL: '"' + (process.env.BACKEND_URL || '/') + '"' + BACKEND_URL: '"/"' } diff --git a/front/src/components/Sidebar.vue b/front/src/components/Sidebar.vue index 6aaf04c42..86ec57819 100644 --- a/front/src/components/Sidebar.vue +++ b/front/src/components/Sidebar.vue @@ -6,8 +6,7 @@ - - @@ -88,9 +87,7 @@ - - - + @@ -151,6 +148,7 @@ export default { $sidebar-color: #1B1C1D; .sidebar { + background: $sidebar-color; @include media(">tablet") { display:flex; flex-direction:column; @@ -212,11 +210,6 @@ $sidebar-color: #1B1C1D; flex: 1; } -.player-wrapper { - border-top: 1px solid rgba(255, 255, 255, 0.1) !important; - background-color: rgb(46, 46, 46) !important; -} - .logo { cursor: pointer; display: inline-block; @@ -224,9 +217,6 @@ $sidebar-color: #1B1C1D; .ui.search { display: block; - > a { - margin-right: 1.5rem; - } .collapse.button { margin-right: 0.5rem; margin-top: 0.5rem; diff --git a/front/src/components/audio/Player.vue b/front/src/components/audio/Player.vue index 9388c2682..e44a92d4f 100644 --- a/front/src/components/audio/Player.vue +++ b/front/src/components/audio/Player.vue @@ -1,145 +1,147 @@ - - - + + + + - - - - - - - - - {{ currentTrack.title }} - - - - {{ currentTrack.artist.name }} - / - - {{ currentTrack.album.title }} + + + + + + + + + {{ currentTrack.title }} - - - + + + {{ currentTrack.artist.name }} + / + + {{ currentTrack.album.title }} + + + + + - - - - - {{currentTimeFormatted}} - + + + + {{currentTimeFormatted}} + - - {{durationFormatted}} + + {{durationFormatted}} + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + - -
{{currentTimeFormatted}}
{{durationFormatted}}