diff --git a/ct/dawarich.sh b/ct/dawarich.sh index 4c5595a24..03149aa0b 100644 --- a/ct/dawarich.sh +++ b/ct/dawarich.sh @@ -33,6 +33,13 @@ function update_script() { ensure_dependencies libgeos++-dev libxml2-dev libxslt-dev libjemalloc-dev + if [[ -f /etc/nginx/sites-available/dawarich.conf ]] && ! grep -q '\.mjs\$' /etc/nginx/sites-available/dawarich.conf; then + msg_info "Fixing MapLibre delivery in Nginx" + sed -i '/location ~ \^\/(assets|packs)\/ {/i\ location ~ \\.mjs$ {\n types { }\n default_type text/javascript;\n try_files $uri @rails;\n }\n' /etc/nginx/sites-available/dawarich.conf + nginx_enable_site dawarich.conf + msg_ok "Fixed MapLibre delivery in Nginx" + fi + if check_for_gh_release "dawarich" "Freika/dawarich"; then msg_info "Stopping Services" systemctl stop dawarich-web dawarich-worker diff --git a/install/dawarich-install.sh b/install/dawarich-install.sh index ad0565a40..87593908b 100644 --- a/install/dawarich-install.sh +++ b/install/dawarich-install.sh @@ -150,6 +150,12 @@ server { root /opt/dawarich/app/public; client_max_body_size 100M; + location ~ \.mjs\$ { + types { } + default_type text/javascript; + try_files \$uri @rails; + } + location ~ ^/(assets|packs)/ { expires max; add_header Cache-Control "public, immutable";