mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-08-22 04:43:33 +02:00
Merge pull request #2912 from alexbelgium/ai-fix/bazarr-base-url-scope
Fix Bazarr base_url sed clobbering Radarr/Sonarr's own base_url
This commit is contained in:
@@ -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://<host>: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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
;;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user