Update 91-configuration.sh

This commit is contained in:
Alexandre
2021-02-06 18:55:33 +01:00
committed by GitHub
parent d0ff2b5fa8
commit cfc513ed04

View File

@@ -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"