From 3d3047bafcd3f077e90e7a2c3100165d484fd128 Mon Sep 17 00:00:00 2001 From: gilbN Date: Sun, 27 Jun 2021 00:55:49 +0200 Subject: [PATCH] vuetorrent hotio support --- vuetorrent/root/etc/cont-init.d/98-themepark | 72 +++++++++++--------- 1 file changed, 38 insertions(+), 34 deletions(-) diff --git a/vuetorrent/root/etc/cont-init.d/98-themepark b/vuetorrent/root/etc/cont-init.d/98-themepark index 2e561b60..ee3c30de 100644 --- a/vuetorrent/root/etc/cont-init.d/98-themepark +++ b/vuetorrent/root/etc/cont-init.d/98-themepark @@ -1,8 +1,10 @@ #!/usr/bin/with-contenv bash APP_FILEPATH='/config/qBittorrent/qBittorrent.conf' +INDEX_FILEPATH='/vuetorrent/public/index.html' if [ "${TP_HOTIO}" = true ]; then - echo 'Changing to Hotio file path!' + echo 'Changing to Hotio file paths!' APP_FILEPATH='/config/config/qBittorrent.conf' + INDEX_FILEPATH='/app/vuetorrent/public/index.html' fi # Display variables for troubleshooting echo -e "Variables set:\\n\ @@ -70,45 +72,47 @@ echo '-----------------------------------------' echo '| qBittorrent vuetorrent theme.park Mod |' echo '-----------------------------------------' -install_deps -check_updates +if [[ -z ${TP_HOTIO} ]]; then + install_deps + check_updates -if [ "$NEEDS_UPDATE" = true ]; then - echo '---------------------------------------' - echo '| Downloading WebUI files from github |' - echo '---------------------------------------' - update_ui -else - echo ' WebUI files are up-to-date!' + if [ "$NEEDS_UPDATE" = true ]; then + echo '---------------------------------------' + echo '| Downloading WebUI files from github |' + echo '---------------------------------------' + update_ui + else + echo ' WebUI files are up-to-date!' + fi + + if ! grep -q "WebUI\\\RootFolder" "${APP_FILEPATH}"; then + echo '--------------------------------------' + echo '| Adding WebUI\RootFolder=/vuetorrent |' + echo '--------------------------------------' + sed -i -e '$aWebUI\\RootFolder=/vuetorrent' "${APP_FILEPATH}" + fi + + if ! grep -q "WebUI\\\AlternativeUIEnabled" "${APP_FILEPATH}"; then + echo '------------------------------------------' + echo '| Adding WebUI\AlternativeUIEnabled=true |' + echo '------------------------------------------' + sed -i -e '$aWebUI\\AlternativeUIEnabled=true' "${APP_FILEPATH}" + fi + + if ! grep -q "WebUI\\\RootFolder=/vuetorrent" "${APP_FILEPATH}" || ! grep -q "WebUI\\\AlternativeUIEnabled=true" "${APP_FILEPATH}"; then + echo '-------------------------------------------------------' + echo '| Updating RootFolder and AlternativeUIEnabled values |' + echo '-------------------------------------------------------' + sed -i "s/WebUI\\\AlternativeUIEnabled=.*$/WebUI\\\AlternativeUIEnabled=true/g" "${APP_FILEPATH}" + sed -i "s/WebUI\\\RootFolder=.*$/WebUI\\\RootFolder=\/vuetorrent/g" "${APP_FILEPATH}" + fi fi # Adding stylesheets -if ! grep -q "${TP_DOMAIN}" /vuetorrent/public/index.html; then +if ! grep -q "${TP_DOMAIN}" "${INDEX_FILEPATH}"; then echo '---------------------------------------------------------' echo '| Adding the stylesheet to /vuetorrent/public/index.html |' echo '---------------------------------------------------------' - sed -i "s/<\/body>/<\/body> /g" /vuetorrent/public/index.html + sed -i "s/<\/body>/<\/body> /g" "${INDEX_FILEPATH}" printf 'Stylesheet set to %s on public index.html\n' "${TP_THEME}" -fi - -if ! grep -q "WebUI\\\RootFolder" "${APP_FILEPATH}"; then - echo '--------------------------------------' - echo '| Adding WebUI\RootFolder=/vuetorrent |' - echo '--------------------------------------' - sed -i -e '$aWebUI\\RootFolder=/vuetorrent' "${APP_FILEPATH}" -fi - -if ! grep -q "WebUI\\\AlternativeUIEnabled" "${APP_FILEPATH}"; then - echo '------------------------------------------' - echo '| Adding WebUI\AlternativeUIEnabled=true |' - echo '------------------------------------------' - sed -i -e '$aWebUI\\AlternativeUIEnabled=true' "${APP_FILEPATH}" -fi - -if ! grep -q "WebUI\\\RootFolder=/vuetorrent" "${APP_FILEPATH}" || ! grep -q "WebUI\\\AlternativeUIEnabled=true" "${APP_FILEPATH}"; then - echo '-------------------------------------------------------' - echo '| Updating RootFolder and AlternativeUIEnabled values |' - echo '-------------------------------------------------------' - sed -i "s/WebUI\\\AlternativeUIEnabled=.*$/WebUI\\\AlternativeUIEnabled=true/g" "${APP_FILEPATH}" - sed -i "s/WebUI\\\RootFolder=.*$/WebUI\\\RootFolder=\/vuetorrent/g" "${APP_FILEPATH}" fi \ No newline at end of file