diff --git a/.env.example b/.env.example index 28cd8d9..065200d 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,8 @@ # Copy to .env and fill in your values -# Pre-fills the server URL on the setup screen +# Pre-fills the URLs on the setup screen NAVIDROME_URL=https://music.yourdomain.com +BACKEND_URL=https://novasonic-api.yourdomain.com # Path to your Navidrome music library on the host MUSIC_PATH=/path/to/your/navidrome/music diff --git a/app.js b/app.js index 5bab516..94d1964 100644 --- a/app.js +++ b/app.js @@ -110,11 +110,9 @@ function disconnect(){ window.addEventListener('load',()=>{ const saved=localStorage.getItem('ns_cfg'); if(saved){cfg=JSON.parse(saved);startApp()} - // Autofill server URL from Docker env (set via config.js) - if(window.NS_SERVER_URL){ - const el=document.getElementById('srv-url'); - if(el&&!el.value)el.value=window.NS_SERVER_URL; - } + // Autofill URLs from Docker env (set via config.js) + if(window.NS_SERVER_URL){const el=document.getElementById('srv-url');if(el&&!el.value)el.value=window.NS_SERVER_URL;} + if(window.NS_BACKEND_URL){const el=document.getElementById('backend-url');if(el&&!el.value)el.value=window.NS_BACKEND_URL;} document.getElementById('srv-pass').addEventListener('keydown',e=>{if(e.key==='Enter')doConnect()}); audio.addEventListener('timeupdate',updateProgress); audio.addEventListener('ended',onEnded); diff --git a/docker-compose.yml b/docker-compose.yml index dcbce6a..48a1172 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,6 +9,7 @@ services: - "8080:80" # route this port through your reverse proxy environment: - NAVIDROME_URL=${NAVIDROME_URL} # pre-filled on the setup screen + - BACKEND_URL=${BACKEND_URL} # pre-filled on the setup screen # ── Backend (yt-dlp download server) ───────────────────────────────────────── novasonic-backend: diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 1e72bda..2ff9196 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,6 +1,7 @@ #!/bin/sh # Generate runtime config from env vars so the frontend knows the Navidrome URL cat > /usr/share/nginx/html/config.js <