update template

This commit is contained in:
Alexandre
2021-02-10 11:18:13 +01:00
parent b665b5910b
commit c5fd05ddcd
4 changed files with 96 additions and 26 deletions

View File

@@ -1,25 +0,0 @@
#!/usr/bin/with-contenv bashio
#clean HTTPS data
sed -i '/HTTPS/d' /config/qBittorrent/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')
KEYFILE=$(bashio::config 'keyfile')
#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
#else bashio::log.error "Certificates not found in $CERTFILE and/or $KEYFILE"
#fi
fi
bashio::log.info "Default username/password : admin/adminadmin"
bashio::log.info "Configuration can be found in /config/qBittorrent"

View File

@@ -0,0 +1,88 @@
#!/usr/bin/with-contenv bashio
##########
# INIT #
##########
# Define preferences line
cd /config/qBittorrent/
LINE=$(sed -n '/Preferences/=' qBittorrent.conf)
LINE=$((LINE + 1))
################
# SSL CONFIG #
################
# 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')
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
################
# WHITELIST #
################
cd /config/qBittorrent/
if bashio::config.has_value 'whitelist'; then
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 '/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
##########
# CLOSE #
##########
bashio::log.info "Default username/password : admin/adminadmin"
bashio::log.info "Configuration can be found in /config/qBittorrent"

View File

@@ -1,8 +1,11 @@
#!/usr/bin/with-contenv bashio
bashio::log.info 'Mounting external hdd...'
######################
# MOUNT LOCAL SHARES #
######################
# Mount local Share if configured and if Protection Mode is active
if bashio::config.has_value 'localdisks'; then
bashio::log.info 'Mounting external hdd...'
MOREDISKS=$(bashio::config 'localdisks')
bashio::log.info "Local Disks mounting.. ${MOREDISKS}" && \
for disk in $MOREDISKS
@@ -20,8 +23,12 @@ if bashio::config.has_value 'localdisks'; then
bashio::log.warning "Protection mode is ON. Unable to mount local drives!"
fi
####################
# MOUNT SMB SHARES #
####################
# Mount CIFS Share if configured and if Protection Mode is active
if bashio::config.has_value 'networkdisks'; then
bashio::log.info 'Mounting smb share...'
MOREDISKS=$(bashio::config 'networkdisks')
CIFS_USERNAME=$(bashio::config 'cifsusername')
CIFS_PASSWORD=$(bashio::config 'cifspassword')

Binary file not shown.