From af78df56638e8fb0569b5312e66e8aba88bf6e19 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20Pe=C3=B1a?= <devilcius@gmail.com>
Date: Sat, 2 Apr 2022 19:38:14 +0200
Subject: [PATCH] Fix compatibility between dev setups

---
 CONTRIBUTING.rst     | 4 ++--
 dev.yml              | 2 +-
 front/package.json   | 2 +-
 front/vite.config.js | 8 ++++----
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index ac0f1687b4..bad83dacb4 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -47,8 +47,8 @@ Setup front-end only development environment
 
 5. Launch the development server::
 
-    # this will serve the front-end on http://localhost:8080
-    yarn dev
+    # this will serve the front-end on http://localhost:8000
+    VUE_PORT=8000 yarn dev
 
 6. Make the front-end talk with an existing server (like https://demo.funkwhale.audio or https://open.audio),
    by clicking on the corresponding link in the footer
diff --git a/dev.yml b/dev.yml
index 8859820504..df855d9b37 100644
--- a/dev.yml
+++ b/dev.yml
@@ -17,7 +17,7 @@ services:
       - "./po:/po"
     networks:
       - internal
-    command: "yarn dev --base /front/"
+    command: "yarn dev --host --base /front/"
 
   postgres:
     env_file:
diff --git a/front/package.json b/front/package.json
index 4ccf133140..a6f1e2b60a 100644
--- a/front/package.json
+++ b/front/package.json
@@ -5,7 +5,7 @@
   "description": "Funkwhale front-end",
   "author": "Funkwhale Collective <contact@funkwhale.audio>",
   "scripts": {
-    "dev": "vite --host",
+    "dev": "vite",
     "build": "vite build",
     "build:deployment": "vite build --base /front/",
     "serve": "vite preview",
diff --git a/front/vite.config.js b/front/vite.config.js
index 0e23f8ba4f..82e3ba06e7 100644
--- a/front/vite.config.js
+++ b/front/vite.config.js
@@ -29,13 +29,13 @@ export default defineConfig({
   server: {
     port: process.env.VUE_PORT || '8080',
     hmr: {
-      port: '8000',
-      protocol: 'ws',
+      port: process.env.FUNKWHALE_PROTOCOL === 'https' ? 443 : 8000,
+      protocol: process.env.FUNKWHALE_PROTOCOL === 'https' ? 'wss' : 'ws',
     }
-  },  
+  },
   resolve: {
     alias: {
       "@": path.resolve(__dirname, "./src"),
     },
-  },  
+  },
 })
-- 
GitLab