From 3c8309dffd074370e953569dce87a8b487dfd879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20D=C3=BCren?= Date: Thu, 20 Mar 2025 14:48:06 +0100 Subject: [PATCH] Fix directory creation for static assets and web app files --- start.sh | 149 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 114 insertions(+), 35 deletions(-) diff --git a/start.sh b/start.sh index 330f1cd..fa228a7 100644 --- a/start.sh +++ b/start.sh @@ -677,8 +677,14 @@ EOF chmod 644 /app/data/web/runtime-config.js -# Create a custom URL patch file to fix the URL constructor error -echo "==> Creating URL and SRP patch file" +# Create necessary directories +mkdir -p /app/data/web/photos/static +mkdir -p /app/data/web/photos/_next/static/runtime +mkdir -p /app/data/web/accounts +mkdir -p /app/data/web/auth +mkdir -p /app/data/web/cast + +# Now create the ente-patches.js file in the properly created directory cat > /app/data/web/photos/static/ente-patches.js << 'ENDPATCHES' (function() { console.log('Applying Ente URL and SRP patches...'); @@ -1071,47 +1077,120 @@ cat > /app/data/web/photos/static/ente-patches.js << 'ENDPATCHES' })(); ENDPATCHES -# Create the static HTML files with scripts pre-injected -for app_dir in photos accounts auth cast; do - # Create directory for our modified files - mkdir -p /app/data/web/$app_dir - - # If the original index.html exists, copy and modify it - if [ -f "/app/web/$app_dir/index.html" ]; then - echo "==> Copying and modifying index.html for $app_dir app" - cp "/app/web/$app_dir/index.html" "/app/data/web/$app_dir/index.html" +# Create a patched runtime configuration for the Ente web app +cat > /app/data/web/photos/static/runtime-config.js << 'ENDCONFIG' +// Runtime configuration for Ente web app +(function() { + if (typeof window !== 'undefined') { + // Polyfill process for browser environment + if (!window.process) { + window.process = { + env: {}, + nextTick: function(cb) { setTimeout(cb, 0); } + }; + } - # Fix any potential issues with the head tag - if ! grep -q "" "/app/data/web/$app_dir/index.html"; then - echo "==> Warning: No head tag found in $app_dir/index.html, adding one" - sed -i 's//\n<\/head>/' "/app/data/web/$app_dir/index.html" - fi + const BASE_URL = window.location.origin; + const API_URL = BASE_URL + '/api'; + const PUBLIC_ALBUMS_URL = BASE_URL + '/public'; - # Insert config scripts right after the opening head tag - sed -i 's//\n - - - - - Ente $app_dir + + + Ente Photos + + + + -

Ente $app_dir

-

Loading...

-

If this page doesn't redirect automatically, click here.

+
+ +

Welcome to Ente Photos

+

End-to-end encrypted photo storage and sharing platform. Your photos stay private, always.

+ Get Started +
+ -HTMLFILE - fi -done +EOT # Create Caddy configuration file mkdir -p /app/data/caddy