diff --git a/bazarr/CHANGELOG.md b/bazarr/CHANGELOG.md index 10249b94b1..f9b1dee8e2 100644 --- a/bazarr/CHANGELOG.md +++ b/bazarr/CHANGELOG.md @@ -1,4 +1,8 @@ +## 1.6.0.2 (2026-07-27) + +- Fix base_url sed patterns rewriting *every* `base_url` key in Bazarr's config.yaml (radarr.base_url, sonarr.base_url, and any other configured integration), instead of only Bazarr's own under `general:`. This silently broke the Radarr/Sonarr connections inside Bazarr on every addon restart when ingress was enabled + ## 1.6.0.1 (2026-07-27) - Fix ingress: nginx rewrote Bazarr's redirects into an absolute `http://:8099/...` URL, which the browser blocked as mixed content when Home Assistant is served over HTTPS. Redirects now stay relative and point at the ingress path diff --git a/bazarr/config.yaml b/bazarr/config.yaml index 0ad56e4885..31d9cb7bbb 100644 --- a/bazarr/config.yaml +++ b/bazarr/config.yaml @@ -112,4 +112,4 @@ schema: slug: bazarr_nas udev: true url: https://github.com/alexbelgium/hassio-addons/tree/master/bazarr -version: "1.6.0.1" +version: "1.6.0.2" diff --git a/bazarr/rootfs/etc/cont-init.d/32-nginx_ingress.sh b/bazarr/rootfs/etc/cont-init.d/32-nginx_ingress.sh index 56df012b68..0db15509ee 100755 --- a/bazarr/rootfs/etc/cont-init.d/32-nginx_ingress.sh +++ b/bazarr/rootfs/etc/cont-init.d/32-nginx_ingress.sh @@ -35,16 +35,20 @@ if [ -f "$CONFIG_LOCATION" ]; then ingress_noauth) bashio::log.green "Ingress is enabled, authentication is disabled" bashio::log.yellow "WARNING : Make sure that the port is not exposed externally by your router to avoid a security risk !" - # Set base_url (must start with / for Flask blueprint registration) - sed -i "s| base_url:.*| base_url: /$slug|" "$CONFIG_LOCATION" + # Set base_url (must start with / for Flask blueprint registration). + # Scoped to the general: block only -- config.yaml also carries a + # base_url under each configured *arr integration (radarr.base_url, + # sonarr.base_url, ...) and those must not be touched. + sed -i "/^general:/,/^[^ ]/{ s| base_url:.*| base_url: /$slug|; }" "$CONFIG_LOCATION" # Disable auth sed -i '/^auth:/,/^[^ ]/{ s/ type:.*/ type: null/ }' "$CONFIG_LOCATION" ;; # Ingress mode, with authentication ingress_auth) bashio::log.green "Ingress is enabled, and external authentication is enabled" - # Set base_url (must start with / for Flask blueprint registration) - sed -i "s| base_url:.*| base_url: /$slug|" "$CONFIG_LOCATION" + # Set base_url (must start with / for Flask blueprint registration). + # Scoped to the general: block only -- see note above. + sed -i "/^general:/,/^[^ ]/{ s| base_url:.*| base_url: /$slug|; }" "$CONFIG_LOCATION" # Enable Bazarr auth when leaving ingress_noauth sed -i '/^auth:/,/^[^ ]/{ s/ type:.*/ type: form/ }' "$CONFIG_LOCATION" ;; @@ -52,7 +56,8 @@ if [ -f "$CONFIG_LOCATION" ]; then noingress_auth) bashio::log.green "Disabling ingress and enabling authentication" bashio::log.yellow "WARNING : Ingress is disabled so the app won't be available from HA itself !" - sed -i "s/ base_url:.*/ base_url: ''/" "$CONFIG_LOCATION" + # Scoped to the general: block only -- see note above. + sed -i "/^general:/,/^[^ ]/{ s/ base_url:.*/ base_url: ''/; }" "$CONFIG_LOCATION" # Enable Bazarr auth when leaving ingress_noauth sed -i '/^auth:/,/^[^ ]/{ s/ type:.*/ type: form/ }' "$CONFIG_LOCATION" ;; diff --git a/bazarr/rootfs/etc/services.d/nginx/run b/bazarr/rootfs/etc/services.d/nginx/run index daf1d3739b..e434541bf6 100644 --- a/bazarr/rootfs/etc/services.d/nginx/run +++ b/bazarr/rootfs/etc/services.d/nginx/run @@ -15,10 +15,13 @@ bashio::net.wait_for "$port" localhost 900 if [ -f "$CONFIG_LOCATION" ]; then if ! bashio::config.true "ingress_disabled"; then if ! bashio::config.has_value "connection_mode" || [ "$(bashio::config 'connection_mode')" != "noingress_auth" ]; then - if ! grep -q "base_url: /$slug" "$CONFIG_LOCATION"; then + if ! sed -n "/^general:/,/^[^ ]/ { /^ base_url: \/$slug$/p; }" "$CONFIG_LOCATION" | grep -q .; then bashio::log.warning "BaseUrl not set properly, restarting" - # Must start with / for Flask blueprint registration - sed -i "s| base_url:.*| base_url: /$slug|" "$CONFIG_LOCATION" + # Must start with / for Flask blueprint registration. Scoped to + # the general: block only -- config.yaml also carries a base_url + # under each configured *arr integration (radarr.base_url, + # sonarr.base_url, ...) and those must not be touched. + sed -i "/^general:/,/^[^ ]/{ s| base_url:.*| base_url: /$slug|; }" "$CONFIG_LOCATION" bashio::addon.restart fi fi