mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-30 11:16:06 +02:00
Bugs fixed in 01-structure.sh: - Database backup created during BIRDSONGS_FOLDER migration was written to the script's CWD instead of /config, and the restore path was recomputed with a fresh timestamp — so any second-boundary crossing between backup and restore left the user unable to recover. Backup path is now absolute and reused for restore. - Path inputs are validated against [A-Za-z0-9._/-]+ before being interpolated into the SQL UPDATE statement. - Default-config download tolerates network failure instead of leaving an empty config.yaml behind. - output.sqlite.path and logging.file_output.* are now seeded with the "set-if-missing" idiom (`//=`) so user edits to config.yaml survive restarts. (Breaking: addon options for log rotation now only seed defaults on first run.) - Path normalization centralized; trailing-slash juggling removed. UX upgrades: - 33-mqtt.sh now auto-configures realtime.mqtt.* in config.yaml from the HA Mosquitto addon (with new mqtt_disable opt-out option). - 33-mariadb.sh now auto-switches output.mysql.* to the HA MariaDB addon and disables SQLite (with mariadb_disable opt-out option). Cleanup: - Dockerfile: upstream entrypoint sed-patch now warns (not silently succeeds) when the target pattern is missing in a new nightly. - Removed dead nginx upstream.conf pointing at unused port 8096. - Trimmed redundant nginx HTML-attribute sub_filters; upstream birdnet-go handles those itself via X-Ingress-Path. JS string rewrites kept since the upstream HTML rewriter does not touch JS. (Breaking UI-side if upstream regresses — see CHANGELOG.)
55 lines
2.1 KiB
Plaintext
55 lines
2.1 KiB
Plaintext
server {
|
|
listen %%interface%%:%%port%% default_server;
|
|
include /etc/nginx/includes/server_params.conf;
|
|
include /etc/nginx/includes/proxy_params.conf;
|
|
|
|
location / {
|
|
proxy_pass http://localhost:8080/;
|
|
rewrite ^%%ingress_entry%%/?(.*)$ /$1 break;
|
|
|
|
# Disable buffering (required for SSE and sub_filter)
|
|
proxy_buffering off;
|
|
proxy_request_buffering off;
|
|
proxy_cache off;
|
|
|
|
# WebSocket support
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
# Tell BirdNET-Go its proxy prefix. Upstream honours X-Ingress-Path
|
|
# in internal/api/server.go and rewrites HTML href/src/action
|
|
# attributes itself, so we no longer duplicate that work here.
|
|
proxy_set_header X-Ingress-Path %%ingress_entry%%;
|
|
|
|
# Prevent timeouts
|
|
proxy_read_timeout 86400;
|
|
proxy_send_timeout 86400;
|
|
|
|
# sub_filter setup: keep gzip off and the type filter wide so JS gets
|
|
# touched too (the upstream HTML rewriter does not look inside JS).
|
|
proxy_set_header Accept-Encoding "";
|
|
sub_filter_once off;
|
|
sub_filter_types *;
|
|
|
|
# JS string-literal rewrites — paths embedded in JS code are not
|
|
# touched by upstream's HTML rewriter, so we patch them here.
|
|
sub_filter EventSource('/ EventSource('%%ingress_entry%%/;
|
|
sub_filter fetch('/ fetch('%%ingress_entry%%/;
|
|
sub_filter `/api/v `%%ingress_entry%%/api/v;
|
|
sub_filter "'/api/v" "'%%ingress_entry%%/api/v";
|
|
sub_filter \"/api/v \"%%ingress_entry%%/api/v;
|
|
sub_filter `/u `%%ingress_entry%%/u;
|
|
sub_filter "'/u" "'%%ingress_entry%%/u";
|
|
sub_filter \"/u \"%%ingress_entry%%/u;
|
|
sub_filter `/asset `%%ingress_entry%%/asset;
|
|
sub_filter "'/asset" "'%%ingress_entry%%/asset";
|
|
sub_filter \"/asset \"%%ingress_entry%%/asset;
|
|
sub_filter window.location.origin} window.location.origin}%%ingress_entry%%;
|
|
}
|
|
}
|