From cfc513ed047399f1c22d5b8f88b01e33462e7a0c Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Sat, 6 Feb 2021 18:55:33 +0100 Subject: [PATCH] Update 91-configuration.sh --- .../etc/cont-init.d/91-configuration.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/qbittorrent/rootfs/etc/cont-init.d/91-configuration.sh b/qbittorrent/rootfs/etc/cont-init.d/91-configuration.sh index 94200aa6e..1dc88a140 100644 --- a/qbittorrent/rootfs/etc/cont-init.d/91-configuration.sh +++ b/qbittorrent/rootfs/etc/cont-init.d/91-configuration.sh @@ -1,8 +1,12 @@ #!/usr/bin/with-contenv bashio -#clean HTTPS data +# Clean HTTPS data sed -i '/HTTPS/d' /config/qBittorrent/qBittorrent.conf +# Define preferences line +LINE=$(sed -n '/Preferences/=' qBittorrent.conf) +LINE=$[LINE + 1] + bashio::config.require.ssl if bashio::config.true 'ssl'; then bashio::log.info "ssl enabled. If webui don't work, disable ssl or check your certificate paths" @@ -12,8 +16,6 @@ if bashio::config.true 'ssl'; then #Check if certificates exist #if [ bashio::fs.file_exists "/ssl/$CERTFILE" ] && [ bashio::fs.file_exists "/ssl/$KEYFILE" ]; then cd /config/qBittorrent - LINE=$(sed -n '/Preferences/=' qBittorrent.conf) - LINE=$[LINE + 1] sed -i "$LINE i\WebUI\\\HTTPS\\\Enabled=True" qBittorrent.conf sed -i "$LINE i\WebUI\\\HTTPS\\\CertificatePath=/ssl/$CERTFILE" qBittorrent.conf sed -i "$LINE i\WebUI\\\HTTPS\\\KeyPath=/ssl/$KEYFILE" qBittorrent.conf @@ -22,4 +24,15 @@ if bashio::config.true 'ssl'; then fi bashio::log.info "Default username/password : admin/adminadmin" + +if bashio::config.has_value 'whitelist'; then +WHITELIST=$(bashio::config 'whitelist') +#clean data +sed -i '/AuthSubnetWhitelist/d' /config/qBittorrent/qBittorrent.conf +cd /config/qBittorrent +sed -i "$LINE i\WebUI\\\AuthSubnetWhitelistEnabled=true" qBittorrent.conf +sed -i "$LINE i\WebUI\\\AuthSubnetWhitelist=$WHITELIST" qBittorrent.conf +bashio::log.info "Whitelisted subsets will not require a password : $WHITELIST" +fi + bashio::log.info "Configuration can be found in /config/qBittorrent"