diff --git a/CloudronManifest.json b/CloudronManifest.json index 851f017..7856c4a 100644 --- a/CloudronManifest.json +++ b/CloudronManifest.json @@ -7,7 +7,7 @@ "contactEmail": "contact@ente.io", "tagline": "Open Source End-to-End Encrypted Photos & Authentication", "upstreamVersion": "1.0.0", - "version": "0.1.66", + "version": "0.1.69", "healthCheckPath": "/ping", "httpPort": 3080, "memoryLimit": 1073741824, diff --git a/Dockerfile b/Dockerfile index 6c2ed83..5b2655f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,10 +28,20 @@ RUN apt-get update && apt-get install -y git && \ RUN corepack enable # Set environment variables for web app build -# Set the API endpoint to use current origin - this will work at runtime -ENV NEXT_PUBLIC_ENTE_ENDPOINT="/api" -# Use relative path so it works with any domain -RUN echo "Building with NEXT_PUBLIC_ENTE_ENDPOINT=/api, will work with any domain via Caddy proxy" +# Instead of using a relative path, patch the origins.ts file to use dynamic origin +RUN echo "Patching origins.ts to use dynamic API endpoint based on current origin" + +# Patch the origins.ts file to use relative API endpoint instead of hardcoded ente.io +RUN if [ -f "web/packages/base/origins.ts" ]; then \ + echo "Patching origins.ts to use window.location.origin + '/api'"; \ + sed -i 's|(await customAPIOrigin()) ?? "https://api.ente.io"|(await customAPIOrigin()) ?? (typeof window !== "undefined" ? window.location.origin + "/api" : "https://api.ente.io")|g' web/packages/base/origins.ts; \ + sed -i 's|(await customAPIOrigin()) ?? "https://uploader.ente.io"|(await customAPIOrigin()) ?? (typeof window !== "undefined" ? window.location.origin + "/api" : "https://uploader.ente.io")|g' web/packages/base/origins.ts; \ + echo "Patched origins.ts:"; \ + cat web/packages/base/origins.ts | head -20; \ + else \ + echo "origins.ts not found, checking alternative paths"; \ + find . -name "origins.ts" -type f; \ + fi # Debugging the repository structure RUN find . -type d -maxdepth 3 | sort diff --git a/debug-network.html b/debug-network.html new file mode 100644 index 0000000..e4a788a --- /dev/null +++ b/debug-network.html @@ -0,0 +1,38 @@ + + +
+