From f545b8d7979db13d54eeb06c947ecab811583fb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20D=C3=BCren?= Date: Tue, 18 Mar 2025 20:47:23 +0100 Subject: [PATCH] Fix URL construction error by ensuring proper URL formats with protocol prefixes --- start.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/start.sh b/start.sh index 2524bba..d040cb6 100644 --- a/start.sh +++ b/start.sh @@ -1597,6 +1597,17 @@ window.process = window.process || {}; window.process.env = window.process.env || {}; window.process.env.NEXT_PUBLIC_ENTE_ENDPOINT = '${API_ENDPOINT}'; window.process.env.NEXT_PUBLIC_ENTE_PUBLIC_ALBUMS_ENDPOINT = '${CLOUDRON_APP_ORIGIN}/public'; +window.process.env.NEXT_PUBLIC_REACT_APP_ENTE_ENDPOINT = '${API_ENDPOINT}'; +window.process.env.REACT_APP_ENTE_ENDPOINT = '${API_ENDPOINT}'; + +// Make sure all URLs are properly formatted for URL constructor +if (!window.ENTE_CONFIG.API_URL.startsWith('http')) { + console.log('Adding https:// prefix to API_URL'); + window.ENTE_CONFIG.API_URL = window.location.origin + window.ENTE_CONFIG.API_URL; + window.process.env.NEXT_PUBLIC_ENTE_ENDPOINT = window.location.origin + window.process.env.NEXT_PUBLIC_ENTE_ENDPOINT; + window.process.env.REACT_APP_ENTE_ENDPOINT = window.location.origin + window.process.env.REACT_APP_ENTE_ENDPOINT; + window.process.env.NEXT_PUBLIC_REACT_APP_ENTE_ENDPOINT = window.location.origin + window.process.env.NEXT_PUBLIC_REACT_APP_ENTE_ENDPOINT; +} console.log('Ente runtime config loaded from runtime-config.js'); console.log('API_URL:', window.ENTE_CONFIG.API_URL); @@ -1679,6 +1690,17 @@ cat > /app/data/caddy/Caddyfile <