hacktoberfestthemedark-themesonarrradarrplexorganizrnginxcustom-csscssthemes-customthemes-csssubfilterguacamoleskinsombilidarrdocker-modsdark-themesdark-mode
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.
84 lines
3.7 KiB
84 lines
3.7 KiB
#!/usr/bin/with-contenv bash
|
|
|
|
echo '------------------------------'
|
|
echo '| qBittorrent theme.park Mod |'
|
|
echo '------------------------------'
|
|
|
|
if ! [[ -x "$(command -v svn)" ]]; then
|
|
echo '--------------------------'
|
|
echo '| Installing svn package |'
|
|
echo '--------------------------'
|
|
apt-get update && \
|
|
apt-get install -y subversion
|
|
fi
|
|
|
|
# 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
|
|
|
|
# Downloading fresh webui files from source.
|
|
if [[ ! -d /themepark ]]; then
|
|
echo '---------------------------------------'
|
|
echo '| Downloading WebUI files from github |'
|
|
echo '---------------------------------------'
|
|
printf '\nDownloading qBittorrent webui to "/themepark"..please wait\n'
|
|
svn export --quiet https://github.com/qbittorrent/qBittorrent/trunk/src/webui/www /themepark
|
|
printf '\nDownload finished\n\n'
|
|
printf '\nDownloading qBittorrent webui icons to "/themepark/xxx"..please wait\n'
|
|
svn export --force --quiet https://github.com/qbittorrent/qBittorrent/trunk/src/icons /temp
|
|
cp -a /temp/. /themepark/public/icons
|
|
cp -a /temp/. /themepark/private/icons
|
|
rm -rf /temp
|
|
printf '\nDownload finished\n\n'
|
|
fi
|
|
|
|
# Adding stylesheets
|
|
if ! grep -q "${TP_DOMAIN}" /themepark/public/index.html; then
|
|
echo '---------------------------------------------------------'
|
|
echo '| Adding the stylesheet to /themepark/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" /themepark/public/index.html
|
|
printf 'Stylesheet set to %s on public index.html\n' "${TP_THEME}"
|
|
fi
|
|
|
|
if ! grep -q "${TP_DOMAIN}" /themepark/private/index.html; then
|
|
echo '----------------------------------------------------------'
|
|
echo '| Adding the stylesheet to /themepark/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" /themepark/private/index.html
|
|
printf 'Stylesheet set to %s on private index.html\n\n' "${TP_THEME}"
|
|
fi
|
|
|
|
if ! grep -q "WebUI\\\RootFolder" /config/qBittorrent/qBittorrent.conf; then
|
|
echo '--------------------------------------'
|
|
echo '| Adding WebUI\RootFolder=/themepark |'
|
|
echo '--------------------------------------'
|
|
sed -i -e '$aWebUI\\RootFolder=/themepark' /config/qBittorrent/qBittorrent.conf;
|
|
fi
|
|
|
|
if ! grep -q "WebUI\\\AlternativeUIEnabled" /config/qBittorrent/qBittorrent.conf; then
|
|
echo '------------------------------------------'
|
|
echo '| Adding WebUI\AlternativeUIEnabled=true |'
|
|
echo '------------------------------------------'
|
|
sed -i -e '$aWebUI\\AlternativeUIEnabled=true' /config/qBittorrent/qBittorrent.conf;
|
|
fi
|
|
|
|
if ! grep -q "WebUI\\\RootFolder=/themepark" /config/qBittorrent/qBittorrent.conf || ! grep -q "WebUI\\\AlternativeUIEnabled=true" /config/qBittorrent/qBittorrent.conf; then
|
|
echo '-------------------------------------------------------'
|
|
echo '| Updating RootFolder and AlternativeUIEnabled values |'
|
|
echo '-------------------------------------------------------'
|
|
sed -i "s/WebUI\\\AlternativeUIEnabled=.*$/WebUI\\\AlternativeUIEnabled=true/g" /config/qBittorrent/qBittorrent.conf;
|
|
sed -i "s/WebUI\\\RootFolder=.*$/WebUI\\\RootFolder=\/themepark/g" /config/qBittorrent/qBittorrent.conf;
|
|
fi
|