mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-07-13 17:40:31 +02:00
fix: auto-fix linting issues
This commit is contained in:
committed by
github-actions[bot]
parent
3539f328fb
commit
f5428e0950
@@ -7,10 +7,10 @@ set -e
|
||||
##################
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == /etc/cont-init.d/* ]]; then
|
||||
mkdir -p /etc/scripts-init
|
||||
sed -i "s|/etc/cont-init.d|/etc/scripts-init|g" /ha_entrypoint.sh
|
||||
sed -i "/ rm/d" /ha_entrypoint.sh
|
||||
cp "${BASH_SOURCE[0]}" /etc/scripts-init/
|
||||
mkdir -p /etc/scripts-init
|
||||
sed -i "s|/etc/cont-init.d|/etc/scripts-init|g" /ha_entrypoint.sh
|
||||
sed -i "/ rm/d" /ha_entrypoint.sh
|
||||
cp "${BASH_SOURCE[0]}" /etc/scripts-init/
|
||||
fi
|
||||
|
||||
#################
|
||||
@@ -24,9 +24,9 @@ ingress_entry=$(bashio::addon.ingress_entry)
|
||||
|
||||
# Quits if ingress is not active
|
||||
if [[ "$ingress_entry" != "/api"* ]]; then
|
||||
bashio::log.info "Ingress entry is not set, exiting configuration."
|
||||
sed -i "1a sleep infinity" /custom-services.d/02-nginx.sh
|
||||
exit 0
|
||||
bashio::log.info "Ingress entry is not set, exiting configuration."
|
||||
sed -i "1a sleep infinity" /custom-services.d/02-nginx.sh
|
||||
exit 0
|
||||
fi
|
||||
|
||||
bashio::log.info "Adapting for ingress"
|
||||
@@ -35,26 +35,26 @@ echo "... setting up nginx"
|
||||
# Check if the NGINX configuration file exists
|
||||
nginx_conf="/etc/nginx/servers/ingress.conf"
|
||||
if [ -f "$nginx_conf" ]; then
|
||||
sed -i "s/%%port%%/${ingress_port}/g" "$nginx_conf"
|
||||
sed -i "s/%%interface%%/${ingress_interface}/g" "$nginx_conf"
|
||||
sed -i "s|%%ingress_entry%%|${ingress_entry}|g" "$nginx_conf"
|
||||
sed -i "s/%%port%%/${ingress_port}/g" "$nginx_conf"
|
||||
sed -i "s/%%interface%%/${ingress_interface}/g" "$nginx_conf"
|
||||
sed -i "s|%%ingress_entry%%|${ingress_entry}|g" "$nginx_conf"
|
||||
else
|
||||
bashio::log.error "NGINX configuration file not found: $nginx_conf"
|
||||
exit 1
|
||||
bashio::log.error "NGINX configuration file not found: $nginx_conf"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Disable log
|
||||
sed -i "/View Log/d" "$HOME/BirdNET-Pi/homepage/views.php"
|
||||
|
||||
echo "... ensuring restricted area access"
|
||||
echo "${ingress_entry}" >/ingress_url
|
||||
echo "${ingress_entry}" > /ingress_url
|
||||
|
||||
# Modify PHP file safely
|
||||
php_file="$HOME/BirdNET-Pi/scripts/common.php"
|
||||
if [ -f "$php_file" ]; then
|
||||
sed -i "/function is_authenticated/a if (strpos(\$_SERVER['HTTP_REFERER'], '/api/hassio_ingress') !== false && strpos(\$_SERVER['HTTP_REFERER'], trim(file_get_contents('/ingress_url'))) !== false) { \$ret = true; return \$ret; }" "$php_file"
|
||||
sed -i "/function is_authenticated/a if (strpos(\$_SERVER['HTTP_REFERER'], '/api/hassio_ingress') !== false && strpos(\$_SERVER['HTTP_REFERER'], trim(file_get_contents('/ingress_url'))) !== false) { \$ret = true; return \$ret; }" "$php_file"
|
||||
else
|
||||
bashio::log.warning "PHP file not found: $php_file"
|
||||
bashio::log.warning "PHP file not found: $php_file"
|
||||
fi
|
||||
|
||||
echo "... adapting Caddyfile for ingress"
|
||||
@@ -66,8 +66,8 @@ chmod +x /helpers/caddy_ingress.sh
|
||||
# Update the Caddyfile if update script exists
|
||||
caddy_update_script="$HOME/BirdNET-Pi/scripts/update_caddyfile.sh"
|
||||
if [ -f "$caddy_update_script" ]; then
|
||||
sed -i "/sudo caddy fmt --overwrite/i /helpers/caddy_ingress.sh" "$caddy_update_script"
|
||||
sed -i "/sudo caddy fmt --overwrite/i /helpers/caddy_ingress.sh" "$caddy_update_script"
|
||||
else
|
||||
bashio::log.error "Caddy update script not found: $caddy_update_script"
|
||||
exit 1
|
||||
bashio::log.error "Caddy update script not found: $caddy_update_script"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user