mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-10-30 18:36:27 +01:00
fix(dawarich): serve .mjs MapLibre modules as JavaScript (#18304)
Since Dawarich 1.15.1 the importmap pins maplibre-gl to /maplibre/<version>/maplibre-gl.mjs in public/. Debian's nginx mime.types has no mjs entry, so the vhost served it as application/octet-stream and browsers refused to load the module: blank map, map controllers fail. Add a .mjs location (text/javascript, as Rails serves it upstream) to the install heredoc, and insert it into existing vhosts from update_script() before the release check, applied via nginx_enable_site. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user