This commit is contained in:
Alexandre
2021-02-10 10:58:05 +01:00
parent fa94fd1132
commit 4672212035
2 changed files with 49 additions and 50 deletions

View File

@@ -53,7 +53,7 @@
"PUID": "int",
"PGID": "int",
"localdisks": "str?",
"customUI": "list(vuetorrent|qbit-matUI)?",
"customUI": "list(vuetorrent|qbit-matUI|qb-web?",
"networkdisks": "str?",
"cifsusername": "str?",
"cifspassword": "str?",

View File

@@ -4,10 +4,10 @@
# INIT #
##########
# Define preferences line
# Define preferences line
cd /config/qBittorrent/
LINE=$(sed -n '/Preferences/=' qBittorrent.conf)
LINE=$[LINE + 1]
LINE=$((LINE + 1))
################
# SSL CONFIG #
@@ -16,69 +16,68 @@ LINE=$[LINE + 1]
# Clean data
sed -i '/HTTPS/d' qBittorrent.conf
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"
#set variables
CERTFILE=$(bashio::config 'certfile')
#set variables
CERTFILE=$(bashio::config 'certfile')
KEYFILE=$(bashio::config 'keyfile')
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
fi
################
# Alternate UI #
################
#clean data
sed -i '/AlternativeUIEnabled/d' qBittorrent.conf
if bashio::config.has_value 'customUI'; then
bashio::log.info "Alternate UI enabled. If webui don't work, disable this option"
CUSTOMUI=$(bashio::config 'customUI')
### IF VUETORRENT
if [ CUSTOMUI="vuetorrent" ];then
CUSTOMUI="WDaan/VueTorrent"
curl -s -S -J -L -o /release.zip $(curl -s https://api.github.com/repos/WDaan/VueTorrent/releases/latest | grep -o "http.*release.zip") > /dev/null
mkdir -p /data/$CUSTOMUI
unzip -o /release.zip -d /data/$CUSTOMUI/
rm /*.zip
CUSTOMUIDIR=$(find /data/$CUSTOMUI -iname "public" -type d)
FOLDER="$(dirname "$CUSTOMUIDIR")"
sed -i "$LINE i\WebUI\\\AlternativeUIEnabled=true" /config/qBittorrent/qBittorrent.conf
sed -i "$LINE i\WebUI\\\RootFolder=$CUSTOMUIDIR" /config/qBittorrent/qBittorrent.conf
fi
### IF qbit-matUI
if [ CUSTOMUI="qbit-matUI" ];then
CUSTOMUI="bill-ahmed/qbit-matUI"
curl -J -L -o /release.zip $(curl -s https://api.github.com/repos/bill-ahmed/qbit-matUI/releases/latest | grep -o "http.*Unix.*.zip")
mkdir -p /data/$CUSTOMUI
unzip -o /release.zip -d /data/$CUSTOMUI/
rm /*.zip
CUSTOMUIDIR=$(find /data/$CUSTOMUI -iname "public" -type d)
FOLDER="$(dirname "$CUSTOMUIDIR")"
sed -i "$LINE i\WebUI\\\AlternativeUIEnabled=true" /config/qBittorrent/qBittorrent.conf
sed -i "$LINE i\WebUI\\\RootFolder=$CUSTOMUIDIR" /config/qBittorrent/qBittorrent.conf
fi
fi
################
# WHITELIST #
################
cd /config/qBittorrent/
if bashio::config.has_value 'whitelist'; then
WHITELIST=$(bashio::config 'whitelist')
WHITELIST=$(bashio::config 'whitelist')
#clean data
sed -i '/AuthSubnetWhitelist/d' qBittorrent.conf
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
################
# Alternate UI #
################
#clean data
sed -i '/AuthSubnetWhitelist/d' qBittorrent.conf
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"
sed -i '/AlternativeUIEnabled/d' qBittorrent.conf
rm -f -r /data/webui
mkdir -p /data/webui
if bashio::config.has_value 'customUI'; then
### Variables
CUSTOMUI=$(bashio::config 'customUI')
bashio::log.info "Alternate UI enabled : $CUSTOMUI. If webui don't work, disable this option"
### Download WebUI
case $CUSTOMUI in
"vuetorrent")
curl -s -S -J -L -o /data/webui/release.zip $(curl -s https://api.github.com/repos/WDaan/VueTorrent/releases/latest | grep -o "http.*release.zip") >/dev/null
;;
"qbit-matUI")
curl -J -L -o /data/webui/release.zip $(curl -s https://api.github.com/repos/bill-ahmed/qbit-matUI/releases/latest | grep -o "http.*Unix.*.zip") >/dev/null
;;
"qb-web")
curl -J -L -o /data/webui/release.zip $(curl -s https://api.github.com/repos/CzBiX/qb-web/releases/latest | grep -o "http.*.zip") >/dev/null
;;
esac
### Install WebUI
mkdir -p /data/webui/$CUSTOMUI
unzip -u -q /data/webui/release.zip -d /data/webui/$CUSTOMUI
rm /data/webui/*.zip
CUSTOMUIDIR=$(find /data/webui/$CUSTOMUI -iname "public" -type d)
CUSTOMUIDIR="$(dirname "$CUSTOMUIDIR")"
sed -i "$LINE i\WebUI\\\AlternativeUIEnabled=true" /config/qBittorrent/qBittorrent.conf
sed -i "$LINE i\WebUI\\\RootFolder=$CUSTOMUIDIR" /config/qBittorrent/qBittorrent.conf
fi
##########