You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

56 lines
2.2 KiB

#!/usr/bin/with-contenv bash
echo '------------------------------'
echo '| Rutorrent theme.park Mod |'
echo '------------------------------'
# Display variables for troubleshooting
echo -e "Variables set:\\n\
'TP_DOMAIN'=${TP_DOMAIN}\\n\
'TP_THEME'=${TP_THEME}\\n"
# Set default
if [[ -z ${TP_DOMAIN} ]]; then
echo 'No domain set, defaulting to gilbn.github.io'
TP_DOMAIN='gilbn.github.io'
fi
if [[ -z ${TP_THEME} ]]; then
echo 'No theme set, defaulting to organizr-dark'
TP_THEME='organizr-dark'
fi
# Copying template
if [[ ! -d /theme ]]; then
echo '--------------------------'
echo '| Copying the template |'
echo '--------------------------'
cp -r /root/defaults/theme /theme
printf 'Template copied to "/theme"\n'
fi
# Adding stylesheets
if ! grep -q "${TP_DOMAIN}" /theme/public/index.html; then
echo '-------------------------------------------------'
echo '| Adding the stylesheet to public index.html |'
echo '-------------------------------------------------'
sed -i "s/<\/head>/<link rel='stylesheet' href='https:\/\/${TP_DOMAIN}\/theme.park\/CSS\/themes\/qbittorrent\/${TP_THEME}.css'><\/head> /g" /theme/public/index.html
printf 'Stylesheet set to %s on public index.html\n' "${TP_THEME}"
fi
if ! grep -q "${TP_DOMAIN}" /theme/private/index.html; then
echo '-------------------------------------------------'
echo '| Adding the stylesheet to private index.html |'
echo '-------------------------------------------------'
sed -i "s/<\/head>/<link rel='stylesheet' href='https:\/\/${TP_DOMAIN}\/theme.park\/CSS\/themes\/qbittorrent\/${TP_THEME}.css'><\/head> /g" /theme/private/index.html
printf 'Stylesheet set to %s\n private index.html' "${TP_THEME}"
fi
if ! grep -q "WebUI\\\RootFolder=/theme" /config/qBittorrent/qBittorrent.conf; then
echo '---------------------------------------------'
echo '| Enabling alternate WebUI in qBittorrent |'
echo '---------------------------------------------'
sed -i "s/WebUI\\AlternativeUIEnabled=.*$/WebUI\AlternativeUIEnabled=true/g" /config/qBittorrent/qBittorrent.conf
sed -i "s/WebUI\\RootFolder=.*$/WebUI\RootFolder=\/theme/g" /config/qBittorrent/qBittorrent.conf
printf 'Enabled aternate WebUI in qBittorrent.conf'
fi